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.

Tuesday, 3 July 2012

GH2 hacks

At the start of the year I was really excited that the GH2 got finally a firmware update which allows HD recording at 25P and high bitrates. I used this mode for my film NEDball. However some shots had horrible blocking artefacts:
Notice the area around the cheek (click on the image to enlarge). The bitrate of this shot is pretty low throughout:
It rarely goes above 12Mbit/sec.
I did a couple of test shoots and found the problem: the camera drops the bitrate if the foreground is dark. Remember what every consumer has been brainwashed into? Have the light behind you. Put the flash on the camera. Have the sun behind you. In more professional terms: keep the key behind the camera. Well, we all know how that looks: crap! Cinematic lighting is often with the key at very steep angles or from behind the subject. It looks best if the sun is behind the subject and we bounce light back into his/her face.
In the example above it's an HMI clamped on the door suggesting a practical light clamped there (and therefore deliberately not hiding the cable). INT daytime lighting is usually against a window so that the subject's face is often pretty dark.
There are numerous patches available for the GH2 from the site Personal View. It's an excellent site and I encourage to donate to the project. After having tried out most of the patches I can only recommend the so called "Sanity pach" from their page or it can be downloaded also here. This patch produces nearly constant bitrate no matter if the foreground is dark or not. Any other patches (flowmotion, aq4, vanilla, intra x, ...) perform well shooting grass, bushes and other detailed patterns but drop the bitrate drastically in underexposed areas and look exactly as the original HBR mode -- and I rarely shoot bushes in my films.
Some of the patches waste over 100Mbit/sec and still look terribly blocky. It feels a bit like these audio-philes who claim that only a cable with a diameter of 10cm (used to power a whole village) sounds perfect connecting the amp and the loudspeaker forgetting that the mechanics of the speaker introduces >1% distortion. Anyway. Coming back to the cinematic lighting:
Here we have a still from "Mirrorgod" (with Jamie Lee McPherson). It has a similar brightness profile as the shot above
but this time we have no compression artefacts at all (again click on the image to enlarge). This has been shot with the Sanity patch. It only drops the bitrate when it's completely pitch black but otherwise it always stays at about 30Mbit/secs.
Conclusion. Don't get fooled by people claiming that "inter" and/or 100Mbit/sec are absolutely necessary to produce great footage. It's rather crucial that we won't let the camera decide what's important but that we leave that to the viewer. I highly recommend the Sanity patch for that reason. It has sane bitrates, is ultra-reliable with class 10 SD cards and has outstanding quality.

Sunday, 20 November 2011

Fluorescent lighting


For many this means: Fluorescent lighting = "Kinoflo". Problem is that Kinoflo = $$$$$$$.
However, there are much cheaper alternatives available which use the same bulbs. Here are two examples. The light in the middle is a fluorescent photo light widely available on e-bay and also from other outlets. In Germany there are two companies which make reasonably priced fluorescent lights: Walimex and "Fotowerkstatt Mainz". There are also a couple of Chinese manufacturers on ebay. All in all there is not much in these lights except a transformer and that's it. These lights use special striplights from Osram which have a very high colour rendering index of over 90% and daylight balanced colour temperature (Dulux 954 55W tube). The quality of the light is exactly that of daylight and can be mixed with it. It looks very natural and soft. It's time for a lighting example:

Here, a small two-tube fluorescent light (2x55W) was placed underneath the candles the left. The second light source was an overhead fluorescent light fitted with a paper lantern and covered by a black bin-bag at the back to avoid light spill on the wall.
The light inside of the paper lantern is a fluorescent bulb produced in China and has a CRI of over 90%. It's 125W which is about the same light output as one redhead (without the heat of course!). Here is one shop on ebay which sells it but it's widely available now.
The bulb is also available in 150W. Important is that you buy the bulb with an actual power rating of 150W. It's basically a pretty large energy saving bulb with a special coating to achieve the CRI of over 90%. The boom arm is made of aluminium and I've mounted the plug directly on the aluminium with a earth connection to the aluminium. The counterweight is a bag filled with old books. I prefer books because in case the bag bursts it won't cause any damage to the floor. The stand is an Adam Hall loudspeaker stand which is very lightweight and is 3m tall. My second stand is a standard disco lighting stand where I have attached an aluminium arm. Same idea but a bit heavier.
Here is a test film using this overhead light as the only light source. Improvised by Tommy J Brennan and Shanta Roberts. The film WEBCAM CONNECTION uses the overhead light in the two first two scenes. In the first scene it's above Tommy and in the second scene it fakes the ceiling light.

Follow focus for Lumix GH1


After weeks of experimenting with different follow focus systems I've settled for this one.
The problem with cheap follow focus systems is backlash. With most of them the backlash is so large that it's impossible to do precise focussing. The main reason for the backlash is the 90 degree gear between the white knob and the lens gear. The follow focus system I have found uses a worm gear which has virtually no backlash at all.
The follow focus can be obtained from ebay, for example here. There is also a nice review on YouTube (thanks, Alan). However, the gears coming with this follow focus are pretty horrible because they are very hard to tighten. Better are the gears which are shown in the picture and are also widely available on e-bay.
In terms of the rod support: I have modified the rail system to allow hand camera operation. For this purpose I bought a flash adapter for a medium format camera. It has a nice large mounting plate, a large grip and it is very easy to attach it to the camera. I could have screwed the quick release plate directly on the flash adapter but that was not very stable so I used a bracket from B&Q and added a standard camera thread. All in all a weekend of plumbing. Bottomline: having a good rod support system saves loads of time. A warning: don't buy the Indian rod support systems. They are pretty horrendous and you need to buy expensive extras to have a complete system.
The lens I'm using on the camera is a 28-70mm f/2.8 Olympus OM with m4/3 adapter. For shallower depth of field I have a Canon FD f/1.4 with m4/3 adapter. For wide angle shots I'm using a Samyang 14mm F/2.8 EOS with m4/3 adapter. Because of the adapters you can buy all these high quality FD/OM/... lenses which are much more robust than the plasticky Panasonic lenses and they are just mechanical with no electronic parts. These lenses also cost a fraction of the auto focus lenses. This gives also a very long battery lifetime for the GH1 of about 4 hours.
Films made with this camera setup:

Simple Steadicam for DSLR

For a shoot (where I was running backwards through the woods) I made a simple steadicam which works very well.
A steadicam is basically a pendulum which adds inertia to the camera movement. It's suspended directly underneath the camera, here just with my hand and arm. The two exercise weights at the bottom add the inertia. The longer the boom and the heavier the weights the smoother is the movement. Because the DSLR is pretty light the weights at the bottom need not to be that heavy to pull the camera in a vertical position. What is trickier is the rotational movement of the camera which is prevented by having two weights sideways on a metal bar. Ideally, the rotation could be even more dampened by a soft suspension. It's not that optimal to hold the pendulum directly with your hands. It would have been better to have a handle sideways but I never managed to build that. As long as the camera is held pretty loose in your hand also the rotational movement is pretty smooth.
I use 1kg of exercise weights but could add a second set (after more time in the gym!). These are from a set of exercise weights I got from Argos. The aluminium sheet at the bottom and the screws are from B&Q. The tripod was just a cheap still camera tripod which conveniently had this quick release mechanism attached to it which lies quite nicely on my hand and acts as a bearing:

How to merge MPEG4 with AC3 audio

Sony Vegas 11 has an annoying bug, namely that the Sony AVC encoder won't export audio. Solution: render out AVC without audio and then render out a separate AC3 audio file and merge them using MP4Box.
  1. Download GPAC and install it on your computer.
  2. Extract the H264 from the MPEG4 file:
    MP4Box -raw 1 attr_2_resiliance03_sonyavc.mp4
    assuming that stream 1 contains your H264.
  3. Merge with AC3 audio:
    MP4Box -add attr_2_resiliance03_sonyavc_track1.h264 -add attr_2_resiliance03.ac3 merged.mp4
That's it. And it's even streamable for flash.
Update: this bug only shows up if the audio rate is higher than 192kbit/sec.

Saturday, 17 September 2011

Colour rendering index

The colour rendering index is a percentage measure of the quality of a light source in terms of colour reproduction. For example, a sodium lamp has a colour rendering index of 0 because when you shine it onto an object you cannot reproduce its colours. It's just yellow, isn't it? Tungsten bulbs or daylight have a colour rendering index of 100 and serve as a reference to other light sources. More strictly the black body radiation is the reference but tungsten light is a good approximation (a more nerdy definition is here). Note that the colour rendering index is not identical to the colour temperature! The colour temperature defines the temperature of the radiator. So, roughly a light bulb with 3200K colour temperature has that temperature!
So, why don't we just use tungsten light? Because it's terribly inefficient. Most of it's output is in the invisible range which is basically heat (think of the 3200K). Anybody who has blown up fuses with red-heads or burnt him/herself knows what I mean.
What are the alternatives? There are quite lot. The only problem is that most other sources have CRI of <100%. For filming a CRI of 90% or higher is required.
The oldest alternative are the so called HMI lights which have roughly 90% CRI. These are gas discharge lights. In the old days these were really just the HMI lights but now you have a large range of discharge lamps with a CRI of well over 90%. They are often called metal halide lamps, for example, the Osram Powerstar D. See my post about HMI style lights. Lights of this type are often used in fashion shops because they need to reproduce colour faithfully.
Three phosphor fluorescent striplights also have a colour rendering index of over 90%. People associate them usually with Kino flos. However, many companies make them now -- and much cheaper. For example, Fotowerkstatt Mainz or Walimex. All fluorescent lights use basically the Osram Dulux 954 55W tube. The rest is just a box with barn doors.
On the left there are fluorescent lights from the Fotowerkstatt with the Osram Dulux tubes in it, mixed with HMIs to create a sunny daytime atmosphere. Here for the film BIG BOOTS. When you watch the film, the lights are on the right of the window which was covered with ND filters to reduce the incoming light by 2 stops. The room was basically lit by the fluorescent lights and the HMI while the ND reduced the incoming light so that the windows won't burn out.
The colour rendering index of both light sources is above 90%. The colour temperatures are actually slightly different but add a bit of texture to it.

Much worse are LED lights. They have often a colour rendering of less than 80%. This is because they have strong blue component which is not very flattering on faces. I've used LED lights in documentary making but I wouldn't use it in fiction, certainly not on faces. It is well known from theatre that blue light brings out blood vessles and makes faces look ugly. Actors will hate them.