Friday, February 29, 2008

Putting Panasonic SDR-H200 video on the web with ffmpeg

I recently got a Panasonic SDR-H200 camcorder.  It's got excellent quality video, fits perfectly in the palm of my hand and packs a ton of features.


I'm a total video newbie so when I tried transferring the video from the embedded hard drive to my computer so that I could post the video to the web I was very much dismayed to find that the files were stored in an unfamiliar format (.MOD).


Transferring digital video involves determining 3 things; the file format, the video encoding and the audio encoding.  The file format, sometimes called the container format, specifies how the data is organizing inside the file (e.g., the video encoding, audio encoding, chunk size, etc..)


While I'm not sure what the .MOD format is, video recorded from the SDR-H200 is encoded in mpeg2.  Audio is encoded in AC3.


Ultimately I wanted to put the video on a website so that family members can watch it.  So I wanted to choose the file format, video encoding and audio encoding that were most widely available.  The following microsoft links helped greatly in this regard:

First download download ffmpeg.  There is no installer so just extract it to a directory.

In case you don't have mpeg2 codecs installed, download and install the klite codec pack.

ffmpeg is a command-line utility.  To use it, open a command prompt and change to the ffmpeg\bin directory.

To convert from .MOD to .wmv:

ffmpeg -i mov001.MOD -f asf -vcodec wmv1 -acodec wmav1 mov001.wmv

This will convert using default settings for bitrate; ffmpeg tries to convert in a way that preserves as much video and audio quality as possible.  However, you may find the quality less than stellar.  In this case, you'll want to increase the bitrate.  One way to do this is

ffmpeg -i mov001.MOD -f asf -vcodec wmv1 -acodec wmav1 -sameq mov001.wmv

This file will be pretty big since it forces ffmpeg to use the same quality as the input.

To determine which file formats, video codecs and audio codecs are installed on your machine:

ffmpeg -formats > formats.txt

This will dump all the formats into a file called formats.txt.  In the doc directory the General documentation has descriptions of each of the formats and codecs.  The names in the General documentation are not the same as the values passed to ffmpeg on the command line.  To get those values you'll need to look at the formats.txt file.

ffmpeg has a bunch of other features, all of which are accessed from command line switches.  See the ffmpeg docs in the doc directory.

No comments :

Post a Comment