Feedback

What's your question?

By: [ Editor ] Asked from United Kingdom

ffmpeg - creating DNxHD MFX files with alphas

Hi all,

I'm struggling with something in FFMpeg at the moment...

I'm trying to make DNxHD 1080p/24, 36Mb/s MXF files from a sequence of PNG files.

My current command-line is:

ffmpeg -y -f image2 -i /tmp/temp.%04d.png -s 1920x1080 -r 24 -vcodec dnxhd -f mxf -pix_fmt rgb32 -b 36Mb /tmp/temp.mxf

To which ffmpeg gives me the output:

Input #0, image2, from '/tmp/temp.%04d.png':
  Duration: 00:00:01.60, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: png, rgb32, 1920x1080, 25 tbr, 25 tbn, 25 tbc
Output #0, mxf, to '/tmp/temp.mxf':
    Stream #0.0: Video: dnxhd, yuv422p, 1920x1080, q=2-31, 36000 kb/s, 90k tbn, 24 tbc
Stream mapping:
  Stream #0.0 -> #0.0
[mxf @ 0x1005800]unsupported video frame rate
Could not write header for output file #0 (incorrect codec parameters ?)

There are a few things in here that concern me:

  • The output stream is insisting on being yuv422p, which doesn't support alpha.
  • 24fps is an unsupported video frame rate? I've tried 23.976 too, and get the same thing.

I then tried the same thing, but writing to a quicktime (still DNxHD, though) with:

ffmpeg -y -f image2 -i /tmp/temp.%04d.png -s 1920x1080 -r 24 -vcodec dnxhd -f mov -pix_fmt rgb32 -b 36Mb /tmp/temp.mov

This gives me the output:

Input #0, image2, from '/tmp/1274263259.28098.%04d.png':
  Duration: 00:00:01.60, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: png, rgb32, 1920x1080, 25 tbr, 25 tbn, 25 tbc
Output #0, mov, to '/tmp/1274263259.28098.mov':
    Stream #0.0: Video: dnxhd, yuv422p, 1920x1080, q=2-31, 36000 kb/s, 90k tbn, 24 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
frame=   39 fps=  9 q=1.0 Lsize=    7177kB time=1.62 bitrate=36180.8kbits/s    
video:7176kB audio:0kB global headers:0kB muxing overhead 0.013636%

Which obviously works, to a certain extent, but still has the issue of being yuv422p, and therefore losing the alpha.

If I'm going to QuickTime, then I can get what I need using Shake, but my main aim here is to be able to generate .mxf files.

Any thoughts?

Thanks

Add comment viewed 980 times Latest activity 11 months ago

or Cancel

1 answer

  • 1

wrosecrans

I'm not sure that DNXHD supports an alpha channel at all. I just poked through an Avid white paper on DNXHD, and I didn't spot any mention of it. Even if it does support one, ffmpeg supports only a subset of DNXHD, so I really wouldn't expect to find support for it there. It's maddeningly frustrating making sure that you slot every variable in exactly the way that ffmpeg wants it. Not all resolutions are supported at all bit rates, no 10 bit support, etc.

As for the MXF, I haven't tried that route. Our workflow is currently based on DNXHD Quicktime Movies for normal footage, and EXR sequences for anything involving compositing.

NN comments
hugh_gid
-

Certainly when rendering DNxHD quicktimes out of Shake, an alpha is supported…

For now, I’m generating the quicktimes using PNG compression and letting them be converted in the Avid.

wrosecrans
-

I’ve done a little extra reading. As near as I can figure, 422p is the only pixel format that ffmpeg supports for dnxhd. The format itself does support an alpha channel, but that support apparently didn’t exist in the first version, and I think ffmpeg only supports the earlier spec. You’ll need to do something like have two files, one MXF with the RGB (stored as yuv), and then a separate one with the alpha.

or Cancel