Monday, 30 July 2012

Creating a DCP with openDCP

Here I'm describing how to create a DCP master for digital cinema projection.
I'm using Vegas Pro as an editing program and Ubuntu Linux for the DCP creation.

Export from the editing program

Settings

  • 1998x1080: this is the size you want to have if your source material is 1920x1080. Note the black bars to the left/right in the preview window. Make sure that Vegas is not scaling the image up to fit the screen. This would results in a very uneven vertical spacing of the lines. Some would be doubled and some not.
  • 24FPS in the settings. Some DCP servers can also play at 25P but rather not risk it. In our case the source material is 25P and Vegas takes care of the conversion to 24P.
  • Brigthness levels: the whole range of values need to be used from 0..255. In other words black is at 0 and white at 255. The standard however is 16 for black and 234 for white. Luckily the "pro"-res was already in the wrong format clearly visible in the oscilloscope. For native projects one needs to apply a level conversion which is often called from studio RGB to computer RGB. Check with your software.
  • Sound: it's 48kHz sampling rate and 24 bits. This means that every frame gets 2000 samples of audio. Simple as that.
  • Average sound levels at -20bB. In the example I had to reduce everything by -15dB (was adjusted to -3dB!).
  • 3 secs black before / after. The projectionist can easily add more black before / after.

Export

You need to export the picture as individual TIFF images and the sound as WAV.

  • TIFF: luckily there is nothing to configure here. Just export the film as an image sequence and select TIFF. Vegas compresses the images with LZW so that at least there's a bit of relief in terms of space. Check with a program such as GIMP if the images have the correct black levels namely that black is really 0 and white 255. Add an underscore to the filename such as "a_mugs_game_.tiff" so that the image number is nicely separated from the filename.
  • WAV: The sound files are exported as WAV files. Here, you need to create your own template probably. Cruical is that you export the audio streams separately: 48kHz, 24bits and mono (multiple) which creates you files called "a_mugs_game_left.wav" and "a_mugs_game_right.wav". In case you have 5.1 surround you also get the other streams separately. Again, it's good to have an "_" after the name so that the "right/left" are nicely separated.

Creating a DCP compatible drive

Hardware

The DCP is shipped on a 500GB hard drive which is inside of a CRU DataPort DX115 or DX115DC. The right part shows the actual DX115 carrier which contains the hard drive. I used a pretty standard 500GB hard drive. As long as it's SATA it should be fine. The docking station is an adapter which allows a SATA connection and a USB connection. Beware: not an eSATA connection which is very annoying. For proper testing the SATA connection is required. Connect a SATA cable to one of the free SATA slots inside of you your computer and run it to the docking station.
Alternatively buy an internal docking station which fits into a standard DVD drive slot. This is actually the "proper" method because this internal docking station is used in the DCP servers and allows hot swapping. It is very elegant in that you can plug in the drive while the server is running and Linux can mount it automatically. Removal of the drive can also happen during operation.

Linux

Time to reboot to Ubuntu Linux. In my case Ubuntu 12.04 LTS (Precise Pangolin). This version is highly recommended. It contains all necessary libraries and connects without any problems with the drive and because it's LTS it will be supported for at least 2 years.

Formatting the drive

The drive needs to be formatted as EXT3. This is probably the most risky step because you need to format the external drive and not your operating system (!). Type dmesg and have a look which drive is associated with your external drive:
[  139.684652] sd 7:0:0:0: [sdd] 976773168 512-byte logical blocks: (500 GB/465 GiB)
[  139.684689] sd 7:0:0:0: Attached scsi generic sg4 type 0
[  139.684712] sd 7:0:0:0: [sdd] Write Protect is off
[  139.684716] sd 7:0:0:0: [sdd] Mode Sense: 00 3a 00 00
[  139.684746] sd 7:0:0:0: [sdd] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[  139.705147]  sdd: sdd1
[  139.705360] sd 7:0:0:0: [sdd] Attached SCSI disk
[  273.000188]  sdd: sdd1
[  429.766469]  sdd: sdd1
In this case plugging in the external drive gives you the device /dev/sdd. To be safe you should use fdisk with "fdisk /dev/sdd" and delete all particions and then create one primary Linux partition. It's menu guided so not very difficult.
Then you need to format this partition with:
sudo mkfs.ext2 -I 128 -j /dev/sdd1
This creates an EXT3 file system with an inode size of 128 bytes. Some people had difficulties with inode size of 256 on older servers but that was in 2008. Modern servers should all support the now default inode size of 256 but to be safe just force the formatter to use an inode size of 128. The option "-j" creates an EXT3 filesystem. However, also an EXT2 should do because it's downward compatible. Again, better to create an EXT3 even if that's not required by the DCP standard and a journal pretty useless in a read only filesystem.
Mount the newly created drive with:
sudo mount /dev/sdd1 /mnt
and then change permissions that you can write to it as a normal user:
sudo chmod a+rwx /mnt

Using openDCP

What I'm describing here has been done under Ubuntu precise pangolin with openDCP v0.0.26. Download the debian package opendcp-0.0.26-linux.i386.deb and install it with "sudo dpkg -i opendcp-0.0.26-linux.i386.deb". Then you are ready to go. If dpkg moans about missing packages just start your favourite package manager and install the missing packages and re-run dpkg.

Creating the JPEG2000 files

The TIFFs now need to be converted to JPEG2000 files and into the XYZ colour space. The can be done by the command line tools or by the openDCP gui. I used the GUI for it which shown here.
I just left the settings as they are. Important here is that the framerate is 24P and that the source colour space is sRGB and that there is a conversion to the XYZ colour space.
BTW, don't panic: the preview stays black. Also, there seems to be a problem with the progress bar. Check at the end that all images have been converted. If there are any problems then use the command line tool instead but in my case everything went fine. GIMP won't loads the JPEG2000 files but interestingly "eog" (eye of gnome) does. The images will look hazy and with wrong contrast. This is normal. If you want to check the images with GIMP you need to convert them to PNG with "convert".

Creating the MXF files

The actual files which are played on the DCP server are MXF files. There is one for audio and one for video. Again, I used the graphical tools to create the MXF files.

Picture

The MXF containing the picture is created again with the "opendcp" GUI. Select "MXF" and then JPEG2000, SMPTE and 24 frames per second. Specify the directory where all the JPEG2000 files reside and the output directory which should be on the EXT3 formatted external drive.
Both, the scanning of the directory and also the conversion will take a while so be patient. Alternatively you could use the command line tool:
opendcp_mxf -i . -o /mnt/a_mugs_game_video.mxf
assuming that the input images are in the current directory and the output MXF goes straight onto the external drive.

Sound

The sound is done in the same way but by selecting WAV in the uppermost drop down box. Then select if you have just stereo or 5.1 surround sound (6 channels). Barney, the projectionist at the GFT told me that he would prefer 5.1 because there is usually no time to switch to pro logic but in our case here we have just stereo.
The output MXF should be on the EXT3 formatted drive.
Just select all the separate wav files and then press Create MXF. This will probably just take a few minutes. As a curiosity there is no documentation how to create the sound MXF from the command line. You need to use the GUI.

Creating the XML files

The final step is to create the XML files which are the "glue" between the MXF files and contain the title and descriptions such as issuer and rating.
For the final step I switched to the command line tool because in the GUI version it's not clear what's happening to the actual files. The command line version won't move/delete any of the MXF files but just creates the XML files in the same directory. Run it in the directory of the external drive. In my case just called "/mnt" after "cd /mnt" (one line):

opendcp_xml --reel ./a_mugs_game_video.mxf ./a_mugs_game_sound.mxf --title A_Mugs_Game --annotation OpenDCP_CPL --issuer BratwurstAndHaggis --kind feature

Don't forget to properly un-mount the drive before unplugging or just shut down the computer. 

To test your DCP plug the HD back in. If you have USB connection then you should instantly see the files. If you have the internal SATA bay then it should show up in your dmesg when the drive is inserted into the computer. Mount it as described above and check that everything is there.

To test if it plays you can use the dcpPlayer for example. It plays the first 15 secs of your film or you could invest about £150 for a license. This is only available under Windows and you need to install a driver which can mount the EXT3 filesystem.

Finished!

Credits:
Matt Cameron's DCP tutorial
A big thanks to the GFT for letting me to try out the DCP and especially Barney who gave me valuable feedback especially about the sound.

1 comment:

  1. Hi,
    what kind of connector is behind the DX115

    ReplyDelete