I am following a tutorial on how to work with cinelerra-cv,
in the very beginning it was said, that the very first step
in working with cinelerra, is to convert whatever video clip
one has into the dnxhd format.
It was just said, not explained how to do it.
After some research, I came across ffmpeg, but I have no idea how to use it with regard to dnxhd, with the little knowledge I gathered about ffmpeg, my guess how to do it would be:
ffmpeg -i <video-clip> -vcodec dnxhd <video-clip-in-dnxhd>
however, this does not work, and the examples I have seen on converting into dnxhd with ffmpeg I do not understand, they seemed each time having some different tags without explaining why to use them.
Best Answer
This is a picky encoder so you have to choose proper parameters including:
See the Valid DNxHD parameters below for accepted values.
DNxHD example
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.
If your input file already conforms to some of the accepted parameters then you don't have to manually declare them.
Output format container for DNxHD is typically MXF or MOV.
DNxHR example
DNxHR is for resolutions bigger than 1080p such as 2K, 4K, and 8K.
Example for DNxHR HQX, 10-bit 4:2:2, 4K (4096x2160), 24 fps:
The
-profile:v
output option is required to select the DNxHR profile, such as-profile:v dnxhr_hq
.Accepted values for
-profile:v
are:dnxhd
,dnxhr_444
,dnxhr_hqx
,dnxhr_hq
,dnxhr_sq
,dnxhr_lb
.dnxhr_lb
- Low Bandwidth. 8-bit 4:2:2 (yuv422p
). Offline Quality.dnxhr_sq
- Standard Quality. 8-bit 4:2:2 (yuv422p
). Suitable for delivery format.dnxhr_hq
- High Quality. 8-bit 4:2:2 (yuv422p
).dnxhr_hqx
- High Quality. 10-bit 4:2:2 (yuv422p10le
). UHD/4K Broadcast-quality delivery.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. (For DNxHR, scroll down to Valid DNxHR parameters section below.)You can show the list with the following "dummy" command:
Valid DNxHR parameters
See pages 111-112 of Avid High-Resolution Workflows Guide.
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 byffmpeg
, 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 incorrect alias is to the left and the proper value is to the right.
So instead of
fps=29.97
usefps=30000/1001
, or instead of-r 29.97
use-r 30000/1001
.More options
For additional encoder specific options, and a list of supported pixel formats, refer to:
Alpha / transparency
The FFmpeg DNxHD/DNxHR encoder does not support alpha.
Errors
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.