LumixMovieConversion

I take a lot of movies with my Panasonic DMC-FX3 camera. It produces good-quality 640x480 movies at 30fps (with sound). You can also take movies up to the size of the memory card which means a 2GB card gives you a 22 minute movie. Very nice.

Unfortunately, the file format is a pain. The camera produces very large files (approximately 60MB per minute). Also, while Apple's Quicktime player handles the audio correctly other players such as VLC and mplayer choke on the audio. The audio plays for a few moments but then it degenerates into static.

mplayer has this to say about the file format:

Quicktime/MOV file format detected.
VIDEO:  [jpeg]  640x480  24bpp  30.000 fps    0.0 kbps ( 0.0 kbyte/s)
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffmjpeg] vfm: ffmpeg (FFmpeg MJPEG decoder)
==========================================================================
==========================================================================
Opening audio decoder: [pcm] Uncompressed PCM audio decoder
AUDIO: 8000 Hz, 1 ch, u8, 64.0 kbit/100.00% (ratio: 8000->8000)
Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
==========================================================================
AO: [macosx] 8000Hz 1ch u8 (1 bytes per sample)
Starting playback...
VDec: vo config request - 640 x 480 (preferred colorspace: Planar YV12)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
VDec: using Planar YV12 as output csp (no 3)
Movie-Aspect is undefined - no prescaling applied.
SwScaler: using unscaled yuv420p -> yuyv422 special converter
VO: [macosx] 640x480 => 640x480 Packed YUY2

So it looks like the video is motion jpeg and the audio is mono raw PCM at 8000Hz.

I found that running these movies through ffmpegX fixes the problems and produces a much more compact file. There is a very slight reduction in image quality but it isn't very noticeable. Plus, the converted file is only about 9 megabytes per minute.

This is the ffmpegX config file that I use. According to ffmpegX the resulting file is 640x480 mpeg4 at 1516 kbps and the audio is AAC at 48000Hz and 96 kbps.

I have found that the converted file will play reliably on all players. I suspect you could duplicate this with mencoder on the command line. However, I have been unable to determine the correct settings to make mencoder create Quicktime MOV files instead of Microsoft AVI files. I think you may need to use an external program to do this as detailed here.

I convert these movies before uploading them to blip.tv as they then play correctly for everyone and the uploads are a lot quicker (since the movies are so much smaller than the originals).

Also here is what mplayer has to say about the resulting converted movie:

ISO: File Type Major Brand: Original QuickTime
Quicktime/MOV file format detected.
VIDEO:  [mp4v]  640x480  24bpp  29.970 fps    0.0 kbps ( 0.0 kbyte/s)
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
==========================================================================
==========================================================================
Opening audio decoder: [faad] AAC (MPEG2/4 Advanced Audio Coding)
FAAD: compressed input bitrate missing, assuming 128kbit/s!
AUDIO: 48000 Hz, 2 ch, s16be, 128.0 kbit/8.33% (ratio: 16000->192000)
Selected audio codec: [faad] afm: faad (FAAD AAC (MPEG-2/MPEG-4 Audio) decoder)
==========================================================================
AO: [macosx] 48000Hz 2ch s16be (2 bytes per sample)
Starting playback...
VDec: vo config request - 640 x 480 (preferred colorspace: Planar YV12)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
SwScaler: using unscaled yuv420p -> yuyv422 special converter
VO: [macosx] 640x480 => 640x480 Packed YUY2

It is possible to use mencoder to rotate original vertical movies into normal horizontal movies and then run the movie through ffmpegX to get the matching Quicktime file. It's easy to get a vertical movie if you are using a regular camera like a Lumix and accidentally rotate it to get something vertical in-frame. Try to avoid that as rotating movies is very annoying. Something like this can be used to rotate and scale the movie and convert it to mpeg-4:

mencoder -vop scale=640:480,expand=853:640,rotate=1 -oac mp3lame -lameopts cbr:mode=2:br=96 \
  -srate 44100 -af resample=44100 -ovc xvid -xvidencopts bitrate=2000:vhq=2:bvhq=1:chroma_opt:quant_type=mpeg -vf \
  -o test-movie-rotated.avi test-movie.avi

then take the resulting movie and run it through ffmpegX to get a Quicktime movie same as above. Try playing with the bitrate to see if a higher value produces a better looking movie. I'm happy with a bitrate of 2000.


CategoryGeekStuff

CategoryBlog



Our Founder
ToolboxClick to hide/show