如果使用libx264将一堆图像转换为带有FFMPEG的.mp4来编码h.264视频,并且在调用FFMPEG时没有指定像素格式的是默认像素格式YUVJ420?我一直在做一些实验,并且如果我为我的格式指定了YUVJ420而且我没有指定格式,那么结果是相同的。
答案 0 :(得分:0)
输出像素格式取决于输入像素格式,正在使用的编码器以及您是否正在执行任何过滤。
根据ffmpeg -h encoder=libx264
,此编码器支持以下像素格式:yuv420p yuvj420p yuv422p yuvj422p yuv444p yuvj444p nv12 nv16 nv21。
默认情况下,ffmpeg
会自动执行像素格式转换为支持的格式之一:最符合源像素格式的格式。您可以使用-loglevel debug
来增加控制台输出的详细程度,以便更详细地查看它。来自rgb24输入的示例:
[format @ 0x55657882d6e0] compat: called with args=[yuv420p|yuvj420p|yuv422p|yuvj422p|yuv444p|yuvj444p|nv12|nv16|nv21]
[format @ 0x55657882d6e0] Setting 'pix_fmts' to value 'yuv420p|yuvj420p|yuv422p|yuvj422p|yuv444p|yuvj444p|nv12|nv16|nv21'
[format @ 0x55657882d6e0] auto-inserting filter 'auto_scaler_0' between the filter 'Parsed_null_0' and the filter 'format'
[auto_scaler_0 @ 0x55657882eb00] picking yuv444p out of 8 ref:rgb24 alpha:0
[auto_scaler_0 @ 0x55657882eb00] w:320 h:240 fmt:rgb24 sar:1/1 -> w:320 h:240 fmt:yuv444p sar:1/1 flags:0x4
强制输出像素格式的示例:-vf format=yuv420p
或-pix_fmt yuv420p
。