This is a picky encoder so you have to choose proper parameters including:
- frame rate
- pixel format / color space
- width x height / resolution / frame size
See the Valid DNxHD parameters below for accepted values.
This example will scale to 1280x720, choose a frame rate of 30000/1001 (aka "29.97"), and a pixel format of YUV 4:2:2 planar.
ffmpeg -i input -c:v dnxhd -vf "scale=1280:720,fps=30000/1001,format=yuv422p" -b:v 110M -c:a pcm_s16le output.mov
DNxHR is for resolutions bigger than 1080p such as 2K, 4K, and 8K.
If you want DNxHR then add the
-profile:v output option, such as
Accepted values are:
- DNxHR LB:
dnxhr_lb - Low Bandwidth. 8-bit 4:2:2 (
yuv422p). Offline Quality.
- DNxHR SQ:
dnxhr_sq - Standard Quality. 8-bit 4:2:2 (
yuv422p). Suitable for delivery format.
- DNxHR HQ:
dnxhr_hq - High Quality. 8-bit 4:2:2 (
- DNxHR HQX:
dnxhr_hqx - High Quality. 10-bit 4:2:2 (
yuv422p10le). UHD/4K Broadcast-quality delivery.
- DNxHR 444:
dnxhr_444 - Finishing Quality. 10-bit 4:4:4 (
yuv444p10le). Cinema-quality delivery.
The above list was adapted from DNxHR codec.
Valid DNxHD parameters
ffmpeg will fail if you provide incorrect values, but it can provide a list of what is accepted.
You can show the list with the following "dummy" command:
ffmpeg -f lavfi -i testsrc2 -c:v dnxhd -f null -
Important Notes about Frame Rate
Frame rate is missing from the list that is generated from this command.
ffmpeg will blindly accept any frame rate for this encoder, and Avid software will reportedly accept it (unconfirmed), but the DNxHD bitrate is supposed to be matched to specific frame rates only. For maximum compatibility I recommended only using the proper bitrate/frame rate combination. So use the command above to get the proper bitrates and pixel formats accepted by
ffmpeg, and cross reference with the List of Avid DNxHD resolutions or the DNxHD White Paper (page 9) for the proper frame rates.
The frame rates listed in the links above are using inaccurate rounded approximations. The proper values are listed below; the abbreviated name is to the left and the proper value is to the right.
- 29.97 = 30000/1001 (or use the alias
- 59.94 = 60000/1001
- 23.967 = 24000/1001 (or use the alias
For additional encoder specific options, and a list of supported pixel formats, refer to:
ffmpeg -h encoder=dnxhd
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
This means that your frame rate, width, height, pixel format, and/or bitrate are incorrect. Refer to Valid DNxHD parameters above for accepted values.
pixel format is incompatible with DNxHD profile
Choose a proper pixel format using the format filter. See the DNxHD example above.