How to force decoding a video at a certain fps
Hello,
I am working on video decoding using FFmpeg. When I try to decode a video which is encoded with h265 at a certain fps (ex: fps=25), the result is a decoded video but at a different fps. How can I decode a video at exactly fps=25, even if I have a high miss rate? I use this command to decode: ffmpeg -benchmark -i <file_name> -f null out.null Please, any help is welcome. Thank you in advance. |
I use HandBrake. give it a try, it has both, gui, and cli.
|
Thank you for your suggestion. I found it interesting.
However, in my research project, I have to work with FFmpeg. |
Quote:
25 frames every second. Quote:
From man ffmpeg Code:
-benchmark (global) Quote:
What are you trying to accomplish? |
Thank you for your reply.
Yes, I mean by "fps" frame per second. In my study, I want to decode a video without displaying it. Then, calculate the miss rate. You mentioned an important point: "This runs as fast as your machine will go". However, I want that FFmpeg decodes at 25 fps in order to be able to calculate the miss rate. Please, How to play a video at normal speed? |
Surely the important thing in your calculation is the rate at which it was ENCODED.?
You can then calculate how many frames would need to be dropped or not at any speed. |
Quote:
Please, could you describe how to run at a specific speed (fps)? |
It should play at the rate you encoded it at if the machine is fast enough.
It should never play faster unless you deliberately ask it to or change your machines clock speed. It may play slower if your machine cannot cope with the speed it was encoded at. |
Thank you for your explanation.
If the speed (fps) depends on the machine, so we never get the miss rate? Could you explain to me how do the video players (like vlc) work? If we give it a video encoded at 30 fps it will play it at 30 fps, but the result is not the same if we use 2 different machines in terms of performance. One presents better quality than the other. |
If your cpu and video card are powerful enough to play at 30 fps at the resolution you have chosen (and no other programs are interfering) there should be no dropped frames.
VLC will play at the rate the file was encoded at unless you tell it otherwise or the machine cannot cope ( as above) The QUALITY of the output will depend on the quality of the graphics card and the screen even if both have sufficient resources to play it, so you should not really expect the output to look exactly the same. For instance: DIGITAL displays do not have as high a screen resolution as a CRT screens and also do not support the same range of colours. Even two CRTs stood next to each other may have been set up differently and display different colours. Why do you think that graphics cards vary so much in price?? |
Thank you for all these details.
I am a newbie to this field and I don't have enough knowledge. |
you need to get your terminology right.
what do you mean by "decode"? this is what happens when you watch the video: it gets decoded into frames that you see, at the exact framerate, if your hardware is fast enough (otherwise, during playback, usually framedrops occur. is that what you mean by "miss"?). if you don't want to watch it, choose /dev/null as video output, or dummy or something. read ffmpeg documentation. or maybe you mean "transcode"? the process of decoding the video, and then re-encoding it in a different format? that is usually much slower than watching ("decoding") it. |
Thank you for your reply.
Yes, this is what I mean by "miss rate". I don't want to watch the video. I want to decode the frames and throw them into /dev/null. I am using this command: ffmpeg -benchmark -i <file_name> -f null /dev/null If I decode at the speed of my hardware, that means that if I want to decode a video of 10 seconds encoded at 25fps, it may take 1 minute or more to decode it if my hardware is not fast enough. But I want to decode it at 25fps in 10 seconds even if my hardware is not fast enough. Of course, I will get a bad visual quality. This is not a problem. My purpose is to assess the video decoding (calculate the miss rate). |
Quote:
and in the case of HEVC, if your GPU doesn't support it and your CPU isn't fast, it will eat a LOT of resources, to the extent that you might have to specifically tell ffmpeg to not just give up. Quote:
it won't get more precise than that, because you never know what else your system is busy with atm, and how many cpu (or gpu) cycles it can spare for ffmpeg's decoding. |
Quote:
Then you have some really old hardware if it takes a minute to play a 10 second video. Update your hardware Enable frame dropping in your media player Resize the video player window into a smaller size, Or re-encode the video into a lesser bitrate. Quote:
You can't change the frame rate that a video is, without re encoding it. You could also dump the video to a rawvideo, then play the raw video. If you have old hardware that won't play a modern video, then update it, drop frames, or reencode the video to a format that the old machine will handle. Quote:
|
All times are GMT -5. The time now is 04:01 PM. |