[FFmpeg-user] Regarding keeping the output frame rate at 30 fps constant

Devyani Godbole devyani.godbole at gmail.com
Mon Sep 14 07:40:28 CEST 2015


Hi Team,
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" dupicates the frames when necessary
to achieve 30 fps.
So, shoudn't it be streching the 10th frame for 10 seconds, till it gets a
new frame.

Are the fps parameters in the command used correctly?

Thanks,
-- Devyani


More information about the ffmpeg-user mailing list