![DNxHD 示例](https://linux22.com/image/892747/DNxHD%20%E7%A4%BA%E4%BE%8B.png)
我正在学习如何使用 cinelerra-cv 的教程,一开始就说,使用 cinelerra 的第一步是将任何视频剪辑转换为 dnxhd 格式。只是说说而已,并没有解释如何操作。
经过一番研究,我遇到了 ffmpeg,但我不知道如何将它用于 dnxhd,凭借我对 ffmpeg 的一点了解,我猜测应该这样做:
ffmpeg -i <video-clip> -vcodec dnxhd <video-clip-in-dnxhd>
然而,这并不起作用,而且我所见过的使用 ffmpeg 转换为 dnxhd 的例子我看不懂,它们每次似乎都有一些不同的标签,却没有解释为什么要使用它们。
答案1
这是一个挑剔的编码器,因此您必须选择适当的参数,包括:
- 帧速率
- 像素格式/色彩空间
- 宽度 x 高度 / 分辨率 / 帧尺寸
- 比特率
查看有效的 DNxHD 参数以下是可接受的值。
DNxHD 示例
此示例将缩放至 1280x720,选择帧速率为 30000/1001(又名“29.97”),像素格式为 YUV 4:2:2 平面。
ffmpeg -i input -c:v dnxhd -vf "scale=1280:720,fps=30000/1001,format=yuv422p" -b:v 110M -c:a pcm_s16le output.mov
如果您的输入文件已经符合某些可接受的参数,那么您不必手动声明它们。
DNxHD 的输出格式容器通常是 MXF 或 MOV。
DNxHR 示例
DNxHR 适用于大于 1080p 的分辨率,例如 2K、4K 和 8K。
DNxHR HQX、10 位 4:2:2、4K (4096x2160)、24 fps 的示例:
ffmpeg -i input -c:v dnxhd -vf "scale=4096:2160,fps=24,format=yuv422p10le" -profile:v dnxhr_hqx -b:v 746M -c:a pcm_s16le output.mov
输出-profile:v
选项需要选择 DNxHR 配置文件,例如-profile:v dnxhr_hq
。
接受的值-profile:v
有:dnxhd
,dnxhr_444
,dnxhr_hqx
,dnxhr_hq
,dnxhr_sq
。dnxhr_lb
- DNxHR LB:
dnxhr_lb
- 低带宽。8 位 4:2:2(yuv422p
)。离线质量。 - DNxHR SQ:
dnxhr_sq
- 标准质量。8 位 4:2:2(yuv422p
)。适合交付格式。 - DNxHR HQ:
dnxhr_hq
- 高品质。8 位 4:2:2(yuv422p
)。 - DNxHR HQX:
dnxhr_hqx
- 高品质。10 位 4:2:2(yuv422p10le
)。UHD/4K 广播质量交付。 - DNxHR 444:
dnxhr_444
- 精加工品质。10 位 4:4:4(yuv444p10le
)。影院品质交付。
以上列表改编自DNxHR 编解码器。
有效的 DNxHD 参数
ffmpeg
如果您提供的值不正确,则将失败,但它可以提供可接受的值的列表。(对于 DNxHR,向下滚动到有效的 DNxHR 参数(请参见下文)
您可以使用以下“虚拟”命令显示列表:
$ ffmpeg -loglevel error -f lavfi -i testsrc2 -c:v dnxhd -f null -
Frame size: 1920x1080p; bitrate: 175Mbps; pixel format: yuv422p10
Frame size: 1920x1080p; bitrate: 185Mbps; pixel format: yuv422p10
Frame size: 1920x1080p; bitrate: 365Mbps; pixel format: yuv422p10
Frame size: 1920x1080p; bitrate: 440Mbps; pixel format: yuv422p10
Frame size: 1920x1080p; bitrate: 115Mbps; pixel format: yuv422p
Frame size: 1920x1080p; bitrate: 120Mbps; pixel format: yuv422p
Frame size: 1920x1080p; bitrate: 145Mbps; pixel format: yuv422p
Frame size: 1920x1080p; bitrate: 240Mbps; pixel format: yuv422p
Frame size: 1920x1080p; bitrate: 290Mbps; pixel format: yuv422p
Frame size: 1920x1080p; bitrate: 175Mbps; pixel format: yuv422p
Frame size: 1920x1080p; bitrate: 185Mbps; pixel format: yuv422p
Frame size: 1920x1080p; bitrate: 220Mbps; pixel format: yuv422p
Frame size: 1920x1080p; bitrate: 365Mbps; pixel format: yuv422p
Frame size: 1920x1080p; bitrate: 440Mbps; pixel format: yuv422p
Frame size: 1920x1080i; bitrate: 185Mbps; pixel format: yuv422p10
Frame size: 1920x1080i; bitrate: 220Mbps; pixel format: yuv422p10
Frame size: 1920x1080i; bitrate: 120Mbps; pixel format: yuv422p
Frame size: 1920x1080i; bitrate: 145Mbps; pixel format: yuv422p
Frame size: 1920x1080i; bitrate: 185Mbps; pixel format: yuv422p
Frame size: 1920x1080i; bitrate: 220Mbps; pixel format: yuv422p
Frame size: 1440x1080i; bitrate: 120Mbps; pixel format: yuv422p
Frame size: 1440x1080i; bitrate: 145Mbps; pixel format: yuv422p
Frame size: 1280x720p; bitrate: 90Mbps; pixel format: yuv422p10
Frame size: 1280x720p; bitrate: 180Mbps; pixel format: yuv422p10
Frame size: 1280x720p; bitrate: 220Mbps; pixel format: yuv422p10
Frame size: 1280x720p; bitrate: 90Mbps; pixel format: yuv422p
Frame size: 1280x720p; bitrate: 110Mbps; pixel format: yuv422p
Frame size: 1280x720p; bitrate: 180Mbps; pixel format: yuv422p
Frame size: 1280x720p; bitrate: 220Mbps; pixel format: yuv422p
Frame size: 1280x720p; bitrate: 60Mbps; pixel format: yuv422p
Frame size: 1280x720p; bitrate: 75Mbps; pixel format: yuv422p
Frame size: 1280x720p; bitrate: 120Mbps; pixel format: yuv422p
Frame size: 1280x720p; bitrate: 145Mbps; pixel format: yuv422p
Frame size: 1920x1080p; bitrate: 36Mbps; pixel format: yuv422p
Frame size: 1920x1080p; bitrate: 45Mbps; pixel format: yuv422p
Frame size: 1920x1080p; bitrate: 75Mbps; pixel format: yuv422p
Frame size: 1920x1080p; bitrate: 90Mbps; pixel format: yuv422p
Frame size: 1920x1080p; bitrate: 350Mbps; pixel format: yuv444p10, gbrp10
Frame size: 1920x1080p; bitrate: 390Mbps; pixel format: yuv444p10, gbrp10
Frame size: 1920x1080p; bitrate: 440Mbps; pixel format: yuv444p10, gbrp10
Frame size: 1920x1080p; bitrate: 730Mbps; pixel format: yuv444p10, gbrp10
Frame size: 1920x1080p; bitrate: 880Mbps; pixel format: yuv444p10, gbrp10
Frame size: 960x720p; bitrate: 42Mbps; pixel format: yuv422p
Frame size: 960x720p; bitrate: 60Mbps; pixel format: yuv422p
Frame size: 960x720p; bitrate: 75Mbps; pixel format: yuv422p
Frame size: 960x720p; bitrate: 115Mbps; pixel format: yuv422p
Frame size: 1440x1080p; bitrate: 63Mbps; pixel format: yuv422p
Frame size: 1440x1080p; bitrate: 84Mbps; pixel format: yuv422p
Frame size: 1440x1080p; bitrate: 100Mbps; pixel format: yuv422p
Frame size: 1440x1080p; bitrate: 110Mbps; pixel format: yuv422p
Frame size: 1440x1080i; bitrate: 80Mbps; pixel format: yuv422p
Frame size: 1440x1080i; bitrate: 90Mbps; pixel format: yuv422p
Frame size: 1440x1080i; bitrate: 100Mbps; pixel format: yuv422p
Frame size: 1440x1080i; bitrate: 110Mbps; pixel format: yuv422p
有效的 DNxHR 参数
请参阅第 111-112 页Avid 高分辨率工作流程指南。
关于帧速率的重要说明
此命令生成的列表中缺少帧速率。
ffmpeg
将盲目接受此编码器的任何帧速率,据报道 Avid 软件将接受它(未经证实),但 DNxHD 比特率应该仅与特定帧速率匹配。为了获得最大兼容性,我建议仅使用正确的比特率/帧速率组合。因此,使用上述命令获取 接受的正确比特率和像素格式ffmpeg
,并与 进行交叉引用Avid DNxHD 分辨率列表或者DNxHD 白皮书(第 9 页)以了解适当的帧速率。上述链接中列出的帧速率使用了不准确的四舍五入近似值。正确值列在下面;左侧是错误的别名,右侧是正确值。
Wrong Correct 29.97 30000/1001 59.94 60000/1001 23.967 24000/1001
因此,不要
fps=29.97
使用fps=30000/1001
,或者不要-r 59.94
使用-r 60000/1001
。
更多的选择
有关其他编码器特定选项以及支持的像素格式列表,请参阅:
ffmpeg -h encoder=dnxhd
Alpha/透明度
FFmpeg DNxHD/DNxHR 编码器不支持 alpha。
错误
ff_frame_thread_encoder_init failed
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!
这意味着您的帧速率、宽度、高度、像素格式和/或比特率不正确。请参阅有效的 DNxHD 参数以上为可接受的值。
pixel format is incompatible with DNxHD profile
使用选择适当的像素格式格式过滤器。请参见上面的 DNxHD 示例。