我正在从 mp2 解码视频并编码为 mp4。
原始文件:
视频:mpeg2video(主)([2][0][0][0]/0x0002),yuv420p,720x576 [SAR 64:45 DAR 16:9]
生成的文件:
视频:mpeg4(简单配置文件)(mp4v/0x7634706D),yuv420p,720x576 [SAR 1:1 DAR 5:4]
如您所见,分辨率没有改变,但宽高比改变了。
我的问题是如何设置这些值(SAR 和/或 DAR)?
要设置输出纵横比,您可以使用“-aspect”选项,参见ffmpeg documentation .
-aspect[:stream_specifier] aspect (output,per-stream)’
Set the video display aspect ratio specified by aspect.
aspect can be a floating point number string, or a string of the form num:den, where num and den are the numerator and denominator of the aspect ratio. For example "4:3", "16:9", "1.3333", and "1.7777" are valid argument values.
If used together with ‘-vcodec copy’, it will affect the aspect ratio stored at container level, but not the aspect ratio stored in encoded frames, if it exists.
我是一名优秀的程序员,十分优秀!