I recently got a Canon 5D Mark II, partly to shoot video. Since Linux is my system of choice and since I couldn’t find much about 5Dmk2+Linux I did a quick test of the two most popular editors, OpenShot and KDEnlive.
First, to clear up some confusion: The 5Dmk2 does not use AVCHD, although it does use H.264. It stores video in a QuickTime MOV container with the H.264 codec for video and PCM for audio. You shoot in 1080p (1920x1080). Thanks to firmware updates it’s possible to shoot in 24p (24 fps - the traditional frame rate for cinema).
My test system is a AMD Phenom II X6 1055T with 8 GB RAM and a Radeon HD 4350 running Ubuntu 10.10 (Maverick) 64-bit. I will update this post as I go along. Input appreciated!
The version of OpenShot available in the official Ubuntu repository for Lucid was old (1.1.x), so I instead installed it from OpenShot’s PPA:
sudo add-apt-repository ppa:jonoomph/openshot-edge sudo apt-get update sudo apt-get install openshot openshot-doc
After starting OpenShot I imported three video files from the 5D. They were 2.8 GB, 4 GB and 1.4 GB.
I put one of them on the timeline and played it in the preview window. The picture had some strange artifacts around the corners (white dots and lines), playback was a little too slow, sound bad (crackling, popping, laggy). After a lot of trial and error, including transcoding to various formats, the problems went away after upgrading to Ubuntu 10.10. Also, after playing around with KDEnlive I didn’t bother returning to OpenShot. While OpenShot is nice and promising, I felt KDEnlive was more mature.
Just like with OpenShot, the version of KDEnlive that you find in the official Ubuntu repository is probably outdated. The KDEnlive project recommends that you get the latest from a PPA by running the following:
sudo add-apt-repository ppa:sunab/kdenlive-release sudo apt-get update sudo apt-get install kdenlive
And just like in OpenShot, when dragging a 5Dmk2 .mov to the timeline, the sound was bad: crackling, popping, lagging. Turned out this wasn’t KDEnlive’s fault - see below; after fixing this issue, I can edit the files just fine.
KDEnlive has the ability to transcode (convert) your video files to a more editing-friendly format by either right-clicking on the clip and choosing Transcode, or via File -> Transcode Clips.
DNxHD is often a good choice. The only trouble is that there’s no transcode profile for 24p footage - only 25p, 30p etc. (The frame rate is actually 23.98 in my file.) No problem - under FFmpeg parameters, just change -r 25 (or whatever it is) to -r 23.98. Transcoding went fine. However, the sound problems persisted, which lead me to believe that PulseAudio might be the real culprit. Indeed it was! See below.
Fixing sound issues
To fix the issue with crackling/lagging sound on Ubuntu with PulseAudio (PulseAudio is the default sound server these days), I finally fixed it by upgrading Ubuntu from Ubuntu 10.04 (Lucid) to 10.10 (Maverick) in the end. I use normal PulseAudio, all default settings. The cause must have been one of the underlying libraries. Before that, I tried to following, which might still be helpful for someone:
Several people - and the KDEnlive manual - suggested removing PulseAudio. I did this:
sudo apt-get autoremove pulseaudio
After doing that, however, the sound no longer worked in KDEnlive (but it did work in other programs): “SDL failed to open audio: no available audio device”. Thanks to this post, I installed libsdl1.2debian-alsa:
sudo apt-get install libsdl1.2debian-alsa
…which brought back the sound. (Make sure the settings are correct under Settings -> Configure KDEnlive -> Playback -> Audio driver.)
This fixed it for good - or so I thought! Turns out it’s fine for a while when, for example, previewing a clip for the first time. But when I pause and then play again, the popping noises begin. Also, the first second of playback is often repeated once. This happens in both OpenShot and KDEnlive. Fixed it by upgrading to 10.10. Phew!
H.264 isn’t particularly suited for editing, so typically an intermediate format should be used. But which one? Final Cut Pro users often recommend transcoding to ProRes 422. Many recommend DNxHD, which ProRes is derived from. Some like CineForm. Etc. Confusing? You bet. It seems like the ideal choice depends on platform and software, and whether or not you need to edit the footage on different platforms.
For me, DNxHD seems to be the best choice. I can use it in KDEnlive, Final Cut Pro, Premiere, etc.
You can use ffmpeg to convert to DNxHD. ffmpeg says this about one of the original files:
Seems stream 0 codec frame rate differs from container frame rate: 47.95 (48000/1001) -> 23.98 (24000/1001) Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'MVI_0909.MOV': Duration: 00:08:17.74, start: 0.000000, bitrate: 47802 kb/s Stream #0.0(eng): Video: h264, yuv420p, 1920x1080, 23.98 tbr, 23.98 tbn, 47.95 tbc Stream #0.1(eng): Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
To transcode/convert to DNxHD, try the following: Note that you can do this from within KDEnlive by right-clicking on a clip; see above.
ffmpeg -i sourcefile.mov -s 1920x1080 -r 23.98 -b 120000k -threads 2 -vcodec dnxhd -acodec copy foobar.mov
The converts the video to DNxHD (
-vcodec dnxhd) while the audio remains unchanged (
-acodec copy). Note that this is for a 1920x1080 24 fps video; if you shot with different settings, change the
-s options accordingly. Also try playing around with bit rate.
I haven’t had time to check it out yet, but many people recommend using EKD for transcoding.