Saturday, November 20, 2010

Making a DCP entirely with open source tools (update)

Here I detail my most up-to-date pipeline for producing a DCP with open source tools. I have used these techniques to produce a DCP for The Incident at Tower 37 that has (to date) ingested and played properly on Doremi and Dolby servers. This technique is an updated version of the original pipeline I posted earlier this year, but with many small but important changes (mostly related to audio and proper formatting of the hard drive).

Step 0: prepare sources

My source video was a 24fps lossless QuickTime movie, RGB color, 1920 x 1080 (16:9). For the purposes of this document, call it INMOVIE.mov.

My source audio comprised of six wav files for Dolby 5.1 surround, each 48kHz mono and 24 bits per sample. This bit depth is critical! Dolby DSS servers considered the DCP corrupt until the audio sources were 24 bit.

Step 1: export PNGs from source QuickTime movie

Tool: ffmpeg
Version: SVN-r21770 (compiled locally)
Command:

ffmpeg -r 24 -i INMOVIE.mov -f image2 %08d.png
This marches through the video file outputting a lossless, compressed PNG 24 times per second.

Step 2: convert to 12 bit per channel XYZ color imagesTool: ImageMagick's convert
Version: 6.5.9 (compiled locally)
Must be run once per PNG frame.
Command:
convert FRAME.png -type TrueColor -alpha Off -depth 12 \
-gamma 0.454545 \
-recolor "0.4124564 0.3575761 0.18
04375 \
0.2126729 0.7151522 0.0721750 \
0.0193339 0.1191920 0.9503041" \
-gamma 2.6 FRAME.tif
This takes a 1920 x 1080 PNG from step 1, removes any alpha, sets the bit depth to 12 bits per pixel, and does a linear-space color shift from RGB->XYZ. Then it writes the image out as a TIFF. According to a comment I saw here, only one of the dimensions of the image need to match 2048 x 1080.

Step 3: convert TIFFs to JPEG-2000Tool: OpenJPEG's image_to_j2k
Version: 2.1.3.0(compiled locally from subversion revision 543)
Must be run once per TIFF frame.
Command:
image_to_j2k -cinema2K 24 -i FRAME.tif -o FRAME.j2c
This takes longer per frame than convert, in my experience. About 2x longer.

Step 4: make all the necessary DCP filesTool: OpenCinemaTools
Version: 1.1.2 (compiled locally)
Tool: asdcplib
Version: 1.6.37 (compiled locally)

NOTE: the next time I revisit this process I'm going to try using the new openDCP library instead of OpenCinemaTools, which is not actively supported and was quite challenging to build.

This step has five substeps, each of which generates one or more of the files needed for the DCP. Naming conventions are very important in DCP land, so I highly recommend that you read about them yourself and make informed choices. When you see DCPFULLNAME below, that's shorthand for what I used, which was the mouthful:
TOWER37_SHR_F_EN-XX_US-XX_51_2K_ST_20101105_OV
Command A (create a video MXF file from the folder of J2K files):
asdcptest -v -E -L -c PROJ.video.mxf FOLDER_OF_J2KS
Command B (create an audio MXF file from the six wavs):
asdcptest -v -l 5.1 -E -L -c PROJ.audio.mxf \
left.wav right.wav center.wav \
sub.wav surrLeft.wav surrRight.wav
Command C (create an XML composition playlist):
mkcpl --kind short --title DCPFULLNAME \
--annotation DCPFULLNAME --norating \
PROJ.video.mxf
PROJ.audio.mxf > PROJ.cpl.xml
Do check the output of command C and confirm that the durations of both video and audio are identical. The XML tag for this is "IntrinsicDuration."
Command D (create an XML packing list):

mkpkl --issuer BitFilms --annotation DCPFULLNAME \ PROJ.video.mxf PROJ.audio.mxf PROJ.cpl.xml > PROJ.pkl.xml
Command E (create the ASSETMAP and VOLINDEX XML files):
mkmap --issuer BitFilms \PROJ.video.mxf PROJ.audio.mxf PROJ.cpl.xml PROJ.pkl.xml
I used a bit of shorthand above since I did not identify enclosing folders. I suggest that if you make a DCP this way, you use temporary folders for all the inputs (and the results of steps 1-3), then create a finalDCP folder which you populate with only the files that will be part of the eventual DCP itself (namely, the 2 mxfs and the 4 XML files that come from step 4).

Step 5: get the DCP onto a Hard DriveTool: gparted
Version: 0.7.0-4 "live" CD image

I found the best guidance for this step at the Inter-Society Digital Cinema Forum website.

In short, you want an MBR partition table and an EXT3 file system. I booted gparted from the live CD and made a single partition on my portable USB hard drive. NOTE: I tried an HP SimpleSave drive and regretted it. This drive comes with an uneditable partition that mounts like a read-only CD-ROM in addition to its actual storage. My Lacie Rakiki worked great.

Once the disk is formatted, just copy over the 6 files that emerged from step 4 right to the root of the new disk. And it's done.

Some quick notes:
  • It is important that you check your XML files to make sure the file paths don't contain any incorrect information: if you aren't careful during step 4, your file paths in the XML may be incorrect! Here's what one of my entries looks like in my final ASSETMAP.xml file as an example: file:///tower37fullDCP.video.mxf
  • I don't know what happens if your audio and video durations are different, so I was careful to make sure mine were not. Check them in the CPL (the tag is ).
  • Work with a small movie file for starters, a minute or less, until you get the steps ironed out. Then move to your full film.
Good luck!

Thanks:
Wolfgang Woehl
John Hurst
Dave Samson
Bryan Dennis