[FFmpeg-user] Let ffmpeg pick correct fps from stdin

Jean-Marie Baran jean-marie.baran at ama.bzh
Thu Jan 14 11:57:42 CET 2016


Hello,

I have ffmpeg reading a stream which is sent to its stdin. ffmpeg then 
record the stream in an mp4 (h.264). The problem is that I don't know 
the fps in advance so I would like that ffmpeg guess it.

So far all my attempts failed with ffmpeg recording systematically at 25 
fps, and the recorded video is then played too fast by players (ffplay, 
VLC, ...). When recording, I see:

fmpeg -y -thread_queue_size 1024 -f s16le -ar 44100 -i 
tcp://localhost:5624?listen=1 -re -f mjpeg -thread_queue_size 1024 -i - 
-c:v libx264 -preset fast -crf 28 -vsync 0 -strict -2 -acodec aac 
-threads 0 -ar 44100 file.mp4
...
frame=    8 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A
frame=   14 fps= 13 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A
frame=   21 fps= 13 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A
frame=   26 fps= 12 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A
frame=   31 fps= 12 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A
frame=   37 fps= 11 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A
frame=   46 fps= 12 q=33.0 size=      33kB time=00:00:00.16 
bitrate=1689.9kbits/s
frame=   52 fps= 12 q=33.0 size=      69kB time=00:00:00.40 
bitrate=1408.2kbits/s
frame=   57 fps= 12 q=33.0 size=      96kB time=00:00:00.60 
bitrate=1299.8kbits/s
frame=   64 fps= 12 q=33.0 size=     136kB time=00:00:00.88 
bitrate=1266.3kbits/s
frame=   71 fps= 12 q=33.0 size=     174kB time=00:00:01.16 
bitrate=1227.3kbits/s
...

So ffmpeg seems to be able to retrieve the fps (13, then 12, then 11, 
...), but it doesn't use it for the recorded video. My best bet was to 
use "-re" but it did not change anything.

Any help would be appreciated,
Thanks

-- 
*Jean-Marie Baran*



More information about the ffmpeg-user mailing list