[Ffmpeg-devel] [RFC] proof-of-concept DNxHD decoder patch

Solomon Hykes solomon.hykes
Mon Feb 5 16:36:10 CET 2007

Hello list,

Following this post in ffmpeg-user:

On Thu, 11 Jan 2007 15:24:45 +0100 (CET), Godwin Stewart <godwin.stewart 
at gmail.com> wrote:

 > On Thu, 11 Jan 2007 15:21:06 +0100 (CET), V?ctor Paesa <wzrlpy at
arsystel.com> wrote:

 > > DNxHD Codec Source Code license says "THIS LICENSE IS AN
 > > CREATION OF DERIVATIVE WORKS", so I'm afraid that this code can't go
 > > into any public distribution of ffmpeg.
 > It should, however, be possible to do the same thing as for AMR, no?
 > Provide the hooks for it to be included in the build but make it the
 > builder's responsibility to download the code and decompress it into
 > the ffmpeg source tree.

If you guys are interested I have a proof-of-concept patch that glues
Avid's open-source DNxHD implementation into ffmpeg. It's quite
primitive and _painfully_ slow, but it has successfully decoded a few
samples :-)

A far cry from anything production-ready, but whoever wants to take this 
further is welcome to do so.

The patch adds a test dnxhd decoder (not encoder), and registers it
on the "AVdn" fourCC. That worked for my samples (MOV files generated by
Quicktime's DNxHD codec).

I have also ran into what seems to be a bug in Avid's source. A separate 
patch is included for that as well.

The limitations of my code are the following:
	- VERY slow
	- Decoder only (note that Avid's source includes an encoder)
	- No MXF integration
	- Not thoroughly tested
	- Only tested on Linux/x86
Again, do not expect anything from this other than a basis for more
serious work.

I have done my best to integrate cleanly, but I am not an ffmpeg expert:
my apologies if your aesthetic feelings are hurt :-)

Feel free to comment and criticize.


1- Put everything to the same directory: both patches, Avid's source
archive (get it from http://www.avid.com/dnxhd) and a fresh ffmpeg checkout.
Note: the patch was created from revision 7768 of ffmpeg: there might be 
conflicts when patching more recent versions.

$ ls
AvidDNxHDReleaseCodec.zip              ffmpeg
DNxHDReleaseCodec-bug-correction.diff  ffmpeg-dnxhd-patch-7768.diff

2- Unzip Avid's codec, apply the patch, compile, install the lib

$ unzip AvidDNxHDReleaseCodec.zip
$ cd DNxHDReleaseCodec
$ patch -p0 < ../DNxHDReleaseCodec-bug-correction.diff
$ cd Source
$ make -f makefile.mak unix
$ sudo cp DNxHDCodec.a /usr/local/lib/libDNxHDCodec.a
$ sudo cp *.h /usr/include/c++/`g++ -dumpversion`/
$ cd ../..

3- Patch ffmpeg, compile

$ cd ffmpeg
$ patch -p0 < ../ffmpeg-dnxhd-patch-7768.diff
$ ./configure --enable-dnxhd && make

4- Verify

$ ./ffmpeg -formats | grep dnxhd

5- Play

$ ./ffmpeg -i great-dnxhd-sample.mov
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'great-dnxhd-sample.mov':
        Duration: 00:00:30.9, start: 0.000000, bitrate: 183501 kb/s
        Stream #0.0(eng): Video: dnxhd, uyvy422, 1920x1080, 25.00 fps(r)
Must supply at least one output file


Solomon Hykes - System & Video Solutions Engineer
Smartjog C.A. | Phone: +33 (0)6 25 95 16 33 | www.smartjog.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: DNxHDReleaseCodec-bug-correction.diff
Type: text/x-diff
Size: 1094 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070205/74de0925/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg-dnxhd-patch-7768.diff
Type: text/x-diff
Size: 14476 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070205/74de0925/attachment-0001.diff>

More information about the ffmpeg-devel mailing list