http://www.usa.canon.com/consumer/controller?act=ModelInfoAct&fcategoryid=139&modelid=17662
Amazon: Canon EOS 5D Mark II
I've acquired a bit of video over the first few days with the cam. Now let's make sure I can edit the bloody stuff in Cinelerra! :)
Update 1/14/2009
I've done a full edit session with the output of the 5D. Lovely!
*** end update ***
I've found the following process works pretty well.
1) Convert video to a Cinelerra-usable format
As I explained in one of my earlier posts, mjpeg seems a good format to convert the H264 output of the cam:
[mule@ogre 2008_12_26]$ ffmpeg -i MVI_0072.MOV -b 3000k -vcodec mjpeg -ab 256k -ar 44100 -acodec libfaac -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 mvi_0072.mov
Here's an image that compares the original, Canon saved H264 video to the MJPEG conversion:
Pretty close, eh? The MJPEG video seems a little lighter and you can see more detail, though the colors are a little washed out.
2) Import into Cinelerra
Unlike the H264 format the Canon saves, the MJPEG conversion imports cleanly into Cinelerra without error messages. Also, on my dual, quad core Dell running Fedora 10, I get about 18fps playing back the raw video. Nice.
3) Render to YUV4MPEG stream as H264 video
I do this step in two parts:
a. Render the audio
The Canon stores its audio in 44Khz, 16-bit PCM format. I rendered out an MPEGI, Layer2 audio file:
--------------------------------------------
Input File : 'stdin' 44.1 kHz
Output File: '/mnt/videos/projects/2008_12_26/audioTrack.m2a'
256 kbps MPEG-1 Layer II j-stereo Psy model 1
[De-emph:Off Copyright:No Original:No CRC:Off]
[Padding:Normal Byte-swap:Off Chanswap:Off DAB:Off]
ATH adjustment 0.000000
--------------------------------------------
encode_init: using tablenum 0 with sblimit 27
Hit end of audio data
Avg slots/frame = 768.000; b/smp = 5.33; bitrate = 256.000 kbps
Render::run: Session finished.
b. Render a YUV4MPEG stream. Using the following pipe, I combine the audio track that was output in the previous step with the video that is being rendered:
ffmpeg -f yuv4mpegpipe -y -i - -i /mnt/videos/projects/2008_12_26/audioTrack.m2a -b 3000k -vcodec libx264 -ab 256k -ar 44100 -acodec libfaac -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 %
Step B is very similar to the advanced rendering technique I showed you in the Beginner's Guide to Exporting Video from Cinelerra. Here's how the render looks in a terminal window:
Input #0, yuv4mpegpipe, from 'pipe:':
Duration: N/A, bitrate: N/A
Stream #0.0: Video: rawvideo, yuv420p, 1920x1080, 30.00 tb(r)
Input #1, mp3, from '/mnt/videos/projects/2008_12_26/audioTrack.m2a':
Duration: 00:00:28.42, start: 0.000000, bitrate: 255 kb/s
Stream #1.0: Audio: mp2, 44100 Hz, stereo, s16, 256 kb/s
Output #0, mp4, to '/mnt/videos/projects/2008_12_26/mvi_0072_h264.mp4':
Stream #0.0: Video: libx264, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], q=2-31, 3000 kb/s, 30.00 tb(c)
Stream #0.1: Audio: libfaac, 44100 Hz, stereo, s16, 256 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #1.0 -> #0.1
[libx264 @ 0x1ec6200]using SAR=1/1
[libx264 @ 0x1ec6200]using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
frame= 852 fps= 5 q=5.0 Lsize= 18223kB time=28.35 bitrate=5265.6kbits/s
video:17680kB audio:526kB global headers:0kB muxing overhead 0.092246%
[libx264 @ 0x1ec6200]slice I:4 Avg QP:27.33 size: 74266
[libx264 @ 0x1ec6200]slice P:848 Avg QP:28.42 size: 21000
[libx264 @ 0x1ec6200]mb I I16..4: 61.4% 0.0% 38.6%
[libx264 @ 0x1ec6200]mb P I16..4: 16.9% 0.0% 2.2% P16..4: 28.4% 8.9% 1.0% 0.0% 0.0% skip:42.6%
[libx264 @ 0x1ec6200]final ratefactor: 35.54
[libx264 @ 0x1ec6200]SSIM Mean Y:0.9495821
[libx264 @ 0x1ec6200]kb/s:5099.9
Render::run: Session finished.
The Result
Comparing the resulting video, the quality seems acceptable, though a bit dark and drained of color in comparison to the original. Notice the removal of the color bands in the sky:
That's a bit of a bummer. I am going to have to investigate how to improve the quality, especially the color.
However, you can't argue with the efficiency of the file size of the H264. Here's a comparison of all three files:
-rw-r--r-- 1 mule ogre 138M Jan 3 16:04 MVI_0072orig.MOV (ORIGINAL)
-rw-r--r-- 1 mule ogre 164M Jan 3 16:02 MVI_0072_convert.MOV (MJPEG CONVERSION)
-rw-r--r-- 1 mule ogre 17M Jan 3 20:02 mvi_0072_h264.mp4 (H264 FINAL)
All in all, its still pretty cool.
Here is the video on Vimeo:
http://vimeo.com/2711794
Since I'm on Fedora, the Vimeo uploader seems to hang. So for Fedora (and I'm sure other Linux distributions) uploads seem to work better using the Basic Uploader:
http://www.vimeo.com/upload/video/basic
Thanks Raffa!
Keep you posted,
The Mule
Maybe next time you should use ls -lh
ReplyDeleteGood idea Robert. I've swapped out the old long listing for ls -h.
ReplyDeletethanks!
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteHmm... Guess this is a bit old (maybe that's why I get problems, filter options and/or Cinelerra may have changed?!) but I have a problem here: The second rendering stage (video + audio from the produced file) fails with "int YUVStream::write_frame(uint8_t**): write_frame() failed: system error (failed read/write)"...
ReplyDelete*sigh*...
Jay,
ReplyDeleteYes, things have changed over the last year or so with the ffmpeg encoding parameters. I've taken to using MPEG-TS as my file format of choice for importing/exporting in/out of Cinelerra. Look at option #2 in this post for a more reliable method of getting Canon 5D content in and out of Cinelerra.
the mule
Ahh... it seems to work, after all... :-)
ReplyDeleteOk, haven't checked out that last piece of advice yet, but will...
I wonder if something else hasn't changed lately, for it seems to me that rendering video and audio directly (and simultaneously) from Cinelerra now works. (I got the impression that it did not, before, but maybe that was wrong.)
I selected 23.976 fps, 1920x1080, 2x48 kHz sound, no interlacing, as this matched my input (not from 5D but from 550D) and QT for linux.
Video rendering params: mpeg4, 5 Mbps, didn't change others.
Audio rendering params: 2's compl, 16 bit linear.
This produced a file which I could view both with mplayer and vlc on linux, it uploads to YouTube and I tested viewing it both on Linux and Windows with Firefox and standard plugins.
One peculiar thing: I get some (about 5-10?) pixel rows at the bottom with some random (not very disturbing) noise. This shows up on youtube and with mplayer, but not with vlc.
Second remark: I haven't yet tested with sound from the camera file, I ditched the audio track and inserted those (two for stereo) from a random mp3-file instead.
Both sound and picture is fine in the final product.
I will continue testing, both for sound and compression results later.
One thing I haven't figured out, is how to get Cinelerra to scale a video down. I have the 1080p raw material from the camera, but it would be nice to make a smaller version, say, 720 x something, to email friends etc... Of course, if using YouTube or Vimeo, this is not so important.