[FFmpeg-user] Regarding getting output fps constant at 30 fps

Devyani Godbole devyani.godbole at gmail.com
Tue Sep 15 06:29:37 CEST 2015


<http://stackoverflow.com/questions/32557584/ffmpeg-output-rate-constant-at-30-fps#>

I need to keep the output fps of my video file to constant 30 fps. This is
being used in a video recorder that is getting live input from a 3rd party
server.

I tried using following commands:

ffmpeg -f rawvideo -pix_fmt yuv420p -s 200x600 -y -an -i pipe:0 -vcodec
libx264 -filter:v 'setpts=N/(30*TB)' -crf 20 -g 30 test.mp4

ffmpeg -f rawvideo -pix_fmt yuv420p -s 200x600 -r 30 -y -an -i pipe:0
-vcodec libx264 -filter:v -r 30 -crf 20 -g 30 test.mp4

But in both the cases I get a video file of a shorter duration when there
are less number of frames at the input.

What I mean to say is, If I give a burst of 10 frames, then no frames for
10 seconds and again a burst of 10 frames no frames for 10 seconds and
again a burst of 10 frames and again no frames for 10 seconds, as the input
to above command; I get output with duration, 1second!

I need it to be 30 seconds, since I have given the input of duration 30
seconds.

According the the ffmpeg manual, "-r" duplicates the frames when necessary
to achieve 30 fps. So, shouldn’t it be stretching the 10th frame for 10
seconds, till it gets a new frame.

Are the fps parameters in the command used correctly?
-- 
*Devyani *


More information about the ffmpeg-user mailing list