英文:
Why I cant set 10 fps to output video with mpeg1video codec?
问题
ffmpeg显示支持的帧率如下:
ffmpeg -h encoder=mpeg1video
...
支持的帧率: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
但我遇到了错误。
我执行以下命令:
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
然后出现了错误:[error] MPEG-1/2 不支持 10/1 帧率。
英文:
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
答案1
得分: 0
只有帧率 24000/1001、24/1、25/1、30000/1001、30/1、50/1、60000/1001 和 60/1 支持使用 ffmpeg 的 normal
严格模式,这可能是因为它们明确在 MPEG-1 规范中支持。
要启用 15/1、5/1、10/1、12/1 中的任何一个,您需要使用 -strict unofficial
选项打开 unofficial
或 experimental
模式。这需要在编码选项中(即在最后一个输入之后)。
请注意,由于这些帧率似乎不被原始规范中的任何定义的配置文件所支持,一些 MPEG-1 解码器可能会拒绝使用这些帧率创建的内容。为了最大的兼容性,如果可以的话,您可能最好使用不同的编解码器。
根据您上面的示例,您的命令将变成:
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
参考链接:https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/mpeg12framerate.c#L24
英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论