Search code examples
ffmpeg

Why I cant set 10 fps to output video with mpeg1video codec?


ffmpeg shows me that it is supported:

ffmpeg -h encoder=mpeg1video ... Supported framerates: 24000/1001 24/1 25/1 30000/1001 30/1 50/1 60000/1001 60/1 15/1 5/1 10/1 12/1 15/1

But I got error

I do:

ffmpeg -loglevel level+info -i rtsp://10.110.63.70:554/ISAPI/Streaming/Channels/101/ -n -f mpegts -r 10 -s 672x380 -c:v mpeg1video -b:v 600K tcp://127.0.0.1:56883

and got: [error] MPEG-1/2 does not support 10/1 fps


Solution

  • It's not noted in the help as shown above, but only the frame rates 24000/1001, 24/1, 25/1, 30000/1001, 30/1, 50/1, 60000/1001, 60/1 are supported using ffmpeg's normal strictness mode, presumably because they are the rates explicitly supported in the MPEG-1 specification.

    In order to enable any of 15/1, 5/1, 10/1, 12/1, you need to turn on unofficial or experimental mode using the -strict unofficial option. This needs to be in the encode options (so after the last input).

    Note that it's possible some MPEG-1 decoders will reject the content created with this frame rate since it appears to be precluded by any defined profile in the original specification. For maximum compatibility, you may be better using a different codec if you can.

    From your example above, your command would become: ffmpeg -loglevel level+info -i rtsp://10.110.63.70:554/ISAPI/Streaming/Channels/101/ -n -f mpegts -r 10 -s 672x380 -c:v mpeg1video -b:v 600K -strict unofficial tcp://127.0.0.1:56883

    Reference: https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/mpeg12framerate.c#L24