Conforming and converting video in to Digital Cinema Package format.

This might be quite a long read, make yourself comfy.

When I started using an action camera to record my biking, someone asked me if it was possible to play the video back at the local cinema. I will call this guy Dave, because that’s his name but it also has a degree of anonymity because it’s a popular name. At time I was working at a local cinema, which had recently changed all the film projectors for digital projectors. I doubt Dave was being completely serious about the idea, but it set me thinking about the possibilities.

I present a work-flow to convert the output of my camera (CamSports HD-S 720p). Reasonably you could use any digital video camera if you make the appropriate adjustments to the conforming instructions.

I use Ubuntu as my “mostly-used” operating system, this is tested on version 12.10. It should work on most, if not all, Debian-type distributions. An advantage of using linux for this task is that you don’t need to be worried about file-size or filename limitations, because you can save directly on to an EXT3 formatted disc, with an MBR type partition table.
You need lots of disk space, as you will be converting your video to a sequence of still frames, and doing conversions on that. The sound will grow in size too, because D-Cinema does not understand compressed sound (AC3, DTS and SDDS are so ‘old hat’). Consider having your OS installed on an SSD, with your workspace on a big “traditional” hard disk.

Installing the software, and general preparation.

Visit http://www.opendcp.org/ and download the corresponding package for your system. Install it manually:

sudo dpkg -i opendcp_0.27.1_xubuntu1210_i386.deb

If you get errors about other packages not being installed, they can usually be fixed with this command:

apt-get -f install

There are some other packages you will need:

sudo apt-get install openjpeg-tools
sudo apt-get install imagemagick
sudo apt-get install sox
sudo apt-get install ffmpeg

I am not sure if OpenDCP needs openjpeg-tools, but it’s useful to be able to sample check your JPEG2000 encoded frames.

Some other preparation, make yourself a work folder and some sub-folders within:

mkdir DCP_Project
cd DCP_Project
mkdir audio
mkdir tiff
mkdir j2k
mkdir mxf
mkdir dcp

Copy your video file in to the DCP_Project folder.

Conforming your source file.

This is where you will adjust your video and audio, to make it fit within the rigid formats D-Cinema uses. In this example I am using the file “20120624.mp4”. The first step is to use ffmpeg to convert the video in to a series of individual frames. Notice that I sneak in a frame-rate conversion here too:

ffmpeg -y -i 20120624.mp4 -an -r 24 -pix_fmt rgb24 -vcodec tiff tiff/%08d.tiff

These frames are all the wrong size, and need tiny black bars left and right. The target is a vanilla 2k, JPEG2000, 2D, 24fps DCP.

cd tiff
mogrify -resize 1920x1080 *.tiff
mogrify -border 39x0 -bordercolor Black *.tiff
cd ..

The frames should all be 1998×1080 pixels which corresponds to the “flat” DCI format.

The next job is the audio. My camera records one sound channel only, and it does that badly. For simplicity’s sake I will make that channel appear on the centre (screen) channel in the cinema, and supply silence for the other 5 channels:

ffmpeg -y -i 20120624.mp4 -acodec pcm_s24le -ar 48000 audio/audio.wav
cd audio
sox audio.wav left.wav remix 0
sox audio.wav right.wav remix 0
sox audio.wav center.wav remix 1
sox audio.wav sub.wav remix 0
sox audio.wav surrleft.wav remix 0
sox audio.wav surrright.wav remix 0
cd ..

Converting and creating the DCP.

Start the OpenDCP application and select the JPEG2000 tab. The default options should be correct (OpenJPEG, Cinema 2K, 24 frame rate, 125Mb/s bandwidth, sRGB source, X’Y’Z’ Transform, DPX Logarithmic does not matter for tiff input, DCI Resize: None).
Set the input directory to your “tiff” folder, and the output folder to your “j2k” folder. Click on Convert, and wait.

Optional: Check one or two sample images from the “j2k” folder, by opening them in GIMP.

In OpenDCP select the MXF tab next. Convert the sequence of JPEG2000 images (“j2k” folder) in to an MXF file. The options should be JPEG2000, SMPTE, frame rate 24. Leave Stereoscopic and Slideshow unselected. Set the picture input to your “j2k” folder, and the output should have filename “video.mxf” in the “mxf” folder.

Staying with the MXF tab, change the type option to “WAV” and select input type “Mono” and output type “5.1”. There are now six input files required (in order):
Left
Right
Center
Sub
Left Surround
Right Surround
Match those up with the six files created with sox earlier. Set the output file to be “audio.mxf” to be saved in the “mxf” folder, and create the MXF file.

Optional: Check listen to the audio.mxf using VLC.

This project does not have subtitles, so skip over that step and go to the DCP tab.

Use the Title Generator, as the DCI specification has a tightly controlled title naming system. This project is a “short” so that would be a good type or kind for setting up the Composition Parameters.
Adding a XML Digital Signature is a good idea, it detects if your DCP has been corrupted in transit. You might find the process of creating that signature seems to hang at 99%. This is a known issue with OpenDCP right now.
As this project only has one “reel” just fill in the Picture source (“video.mxf”) and Sound source (“audio.mxf”). Leave the Subtitle source blank. You might notice that frame counts are not the same, reduce the largest to make it the same as the smallest. This depends on your source material, and may also depend on the phase of the moon.
Create your DCP, and you’re nearly finished.

As you are using linux, you can use gparted to create your distribution disc (MBR partition table, EXT3 format) and copy over your completed Digital Cinema Package. A good thing is to create a folder with the same name as the package, and put the six files in that folder. In my example I created a DCP called “20120624_SHR_F_EN-XX_UK-U_51_2K_20130324_OPE_2D_OV” so I put all the files in a folder of that name.

Unmount the drive, and send it to your cinema.

Optional verification step.

You could follow the instructions at
https://github.com/wolfgangw/digital_cinema_tools_distribution/wiki/Setup
to check what you have created.

The general form of the command is to point it at the folder containing your DCP. Using my example:

dcp_inspect dcp

This gives the following output:

 dcp_inspect v1.2013.03.22: ["dcp"]
 Found 1 Assetmap candidate: ["ASSETMAP.xml"]
 AM 118cd216-6685-4f58-98ec-12f8dfb89bb3: Schema check: OK: dcp/ASSETMAP.xml

 Found 1 Assetmap
 Assetmap 118cd216-6685-4f58-98ec-12f8dfb89bb3: ASSETMAP.xml
 Assetmap 118cd216-6685-4f58-98ec-12f8dfb89bb3 lists 4 assets:
 e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4: e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4_pkl.xml
 ea68ce2b-a73a-45d3-ba8b-3a6059de7351: ea68ce2b-a73a-45d3-ba8b-3a6059de7351_cpl.xml
 c07f1811-7c8b-4d79-8920-d465c967bf02: video.mxf
 f05fef5c-86d4-4283-b19e-8dfa54c6bf2e: audio.mxf
 Assetmap 118cd216-6685-4f58-98ec-12f8dfb89bb3 lists 1 PKL:
 PKL file present: e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4: dcp/e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4_pkl.xml

 Found 1 Package
 PKL file present: e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4: dcp/e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4_pkl.xml

 PKL e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4: dcp/e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4_pkl.xml
 PKL e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4: Schema check: OK
 PKL e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4: Signature check: OK
 Signer:        /O=opendcp.org/OU=OpenDCP/CN=CS.opendcp.certificate.0.DCP/dnQualifier=1FPyevRn3ByXjBQLxlW93CoVobs=
 Signer issuer: /O=opendcp.org/OU=OpenDCP/CN=.opendcp.certificate.1.INTERMEDIATE/dnQualifier=oTcukRMxC8VtoIFyCQO9IpB9tDY=
 PKL e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4 lists 3 assets
 c07f1811-7c8b-4d79-8920-d465c967bf02: application/mxf: video.mxf
 c07f1811-7c8b-4d79-8920-d465c967bf02: Checking hash value: OK                                                       
 f05fef5c-86d4-4283-b19e-8dfa54c6bf2e: application/mxf: audio.mxf
 f05fef5c-86d4-4283-b19e-8dfa54c6bf2e: Checking hash value: OK                                                       
 ea68ce2b-a73a-45d3-ba8b-3a6059de7351: text/xml: ea68ce2b-a73a-45d3-ba8b-3a6059de7351_cpl.xml
 ea68ce2b-a73a-45d3-ba8b-3a6059de7351: Checking hash value: OK                                                       
 PKL e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4: Package size: 551.6 MB
 PKL e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4 lists 1 composition
 CPL file present: ea68ce2b-a73a-45d3-ba8b-3a6059de7351: dcp/ea68ce2b-a73a-45d3-ba8b-3a6059de7351_cpl.xml

 Found 1 Composition
 CPL file present: ea68ce2b-a73a-45d3-ba8b-3a6059de7351: dcp/ea68ce2b-a73a-45d3-ba8b-3a6059de7351_cpl.xml

 CPL ea68ce2b-a73a-45d3-ba8b-3a6059de7351: Schema check: OK
 CPL ea68ce2b-a73a-45d3-ba8b-3a6059de7351: Signature check: OK
 Signer:           /O=opendcp.org/OU=OpenDCP/CN=CS.opendcp.certificate.0.DCP/dnQualifier=1FPyevRn3ByXjBQLxlW93CoVobs=
 Signer issuer:    /O=opendcp.org/OU=OpenDCP/CN=.opendcp.certificate.1.INTERMEDIATE/dnQualifier=oTcukRMxC8VtoIFyCQO9IpB9tDY=
 CPL Id:           ea68ce2b-a73a-45d3-ba8b-3a6059de7351
 CPL file:         dcp/ea68ce2b-a73a-45d3-ba8b-3a6059de7351_cpl.xml
 CPL type:         SMPTE (http://www.smpte-ra.org/schemas/429-7/2006/CPL)
 ContentTitleText: 20120624_SHR_F_EN-XX_UK-U_51_2K_20130324_OPE_2D_OV
     Language audio and subtitles: EN-XX
 AnnotationText:   20120624
 ContentKind:      short
 IssueDate:        2013-03-24T05:59:50+00:00 (Sunday Mar 24 2013 05:59)
 Issuer:           <Not present>
 Creator:          OpenDCP 0.27.1
 Number of Reels:  1
 Reel 1:
   1031  00:00:42+23 @ 24/1  c07f1811-7c8b-4d79-8920-d465c967bf02  MainPicture    (SMPTE, 00:00:43+01, unencrypted, 1998x1080, pictures)
   1031  00:00:42+23 @ 24/1  f05fef5c-86d4-4283-b19e-8dfa54c6bf2e  MainSound    (SMPTE, 00:00:42+23, unencrypted, 6 channels, 48 kHz, 24 bps, audio)
 Total duration:
   1031  00:00:42+23 @ 24/1
 Composition kind: 2D/Monoscopic
 Composition type: SMPTE
 Composition complete

 Hint: CPL ea68ce2b-a73a-45d3-ba8b-3a6059de7351: Naming convention: Expected number of parts present in "20120624_SHR_F_EN-XX_UK-U_51_2K_20130324_OPE_2D_OV"
 Hint: CPL ea68ce2b-a73a-45d3-ba8b-3a6059de7351: Naming convention: 11 parts matching: {:film_title=>"20120624", :content_type=>"SHR", :aspect_ratio=>"F", :language=>"EN-XX", :territory_rating=>"UK-U", :audio_type=>"51", :resolution=>"2K", :studio=>"OPE", :date=>"20130324", :facility=>"2D", :package_type=>"OV"}
 Hint: CPL ea68ce2b-a73a-45d3-ba8b-3a6059de7351: Naming convention: 0 parts missing: {}
 Info: Inspected: /home/alexander/Videos/dcptest/dcp
 Info: Found 1 Package with total size 551.6 MB
 Info: Found 1 Assetmap, 1 Package (1 signed/1 verified), 1 Composition (1 signed/1 verified)
 Info: 0 Errors, 3 Hints

The important thing is “0 Errors”.

Obviously I’m not in a position to actually test this on a real D-Cinema system…

There are people who have had success with these tools, some examples:

http://bitfilms.blogspot.co.uk/2010/11/making-dcp-entirely-with-open-source.html
http://www.thefilmbakery.com/blog/creating-a-feature-film-dcp-using-opendcp

Finally, a big thank-you to other people like Diane Edwards, Daniel Backhouse, Andrew Bailey and Andrew Smith. You all provided me with the necessary impetus to learn the DCI specification to a much deeper understanding compared to anyone else I met during my time with Apollo Cinemas.

Advertisements

Tags: ,

One Response to “Conforming and converting video in to Digital Cinema Package format.”

  1. Unpacking D-Cinema content. | Barrowbiker's Blog Says:

    […] This entry is intended to be read after my earlier entry on a similar subject: https://barrowbiker.wordpress.com/2013/03/29/conforming-and-converting-video-in-to-digital-cinema-pac&#8230; […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: