Use ffmpeg for DCP to h.264 conversion

You can use ffmpeg to convert a movie to mpeg4. We show it in multiple step, but you can convert it also in one step

Put your DCP folder in a folder we will call work and prepare the folder

cd work
mkdir mov
mkdir mov/jpg

Identify the video stream MXF in the dcp folder. Suppose it is picture.mxf

ffmpeg -ss 0 -lowres 0 -i dcp/picture.mxf -vf "xyz2rgb" -t 10 -q:v 0.9 mov/jpg/image%06d.jpg

-ss defines the start in seconds

-lowres allows for subsampling. As jpeg2000 is a codec based on subsampling, the subsampling allows to achieve quite realtime performance using 50% or 25% size.

Note that the video is not always 1080 pixel height. The resulting height must be a multiple of 2 to be accepted by the h264 codec

-vf "xyz2rgb" adds the XYZ2RGB conversion

-i defines the input file.

-t defines the duration in seconds

-q defines the quality. We will compress to JPEG with 90% quality.

The speed for this part is about 400% realtime on our sample file with MacBook Air.

Now identify the audio stream in the dcp folder. Suppose it is sound.mxf

ffmpeg -ss 0 -i dcp/sound.mxf -y mov/sound.wav

This operation was immediate on our MacBook Air.

Now lets compress and mux them together to MPEG4.

ffmpeg -r 24 -i mov/jpg/image%06d.jpg -sameq -i mov/sound.wav -ac 2 -ab 256k -y mov/movie.mp4

-r defines the framerate of the picture. It is 24 most of the time.
-sameq tries to keep the same quality as the jpg files are
-ac 2 the audio is downmixed from 5.1 to stereo
-ab the audio rate is 256kb
-y overwrite the file if it is already there

The speed for this part is about 250% of realtime on our MacBook Air.

Benchmark MacBook Air

The whole conversion for 16 seconds takes about 104 seconds.
DCP picture 16 seconds 30fps 281 MB
DCP sound 16 seconds stereo 3.1 MB
jpeg folder 85 MB
movie h.264 1920x1080 10.2 MB

Benchmark MacPro QuadCore

ffpmeg can use multiple processors.
The whole conversion for 16 seconds takes about 50 seconds.

See also Open Source DCP Player Proof of Concept