Digital Video

From Eugene Eric Kim

I'm starting to deal with Digital Video much more, what with video from my camera, MythTV, my DVD collection, and my Cowon D2. Here are my notes on codecs, conversions, and the like.

Concatenating Video

In theory, ffmpeg concat mode should be the easiest way to do this, but it hasn't worked for me. I use the demuxer. Create a file mylist.txt:

# this is a comment
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'

Then run:

ffmpeg -f concat -i mylist.txt -c copy output

For different codecs:

 ffmpeg -i -i -filter_complex '[0:v] [0:a:0] [1:v] [1:a:0] concat=n=2:v=1:a=1 [v] [a]' -map '[v]' -map '[a]' -strict -2 output.mp4

Timelapse Cameras

Motorola Droid

You can use Handbrake to encode videos for Droid playback. Use the iPhone preset, then click on Picture Settings and adjust the size to 848x480 (or as close to that as possible).

Cowon D2

The D2 plays the following video format:

  - [[Xvi D]]
  - 320x240
  - 30 fps
  - VBR 50

  - 128 kbps

Windows Media Player does not have the XviD codec by default, so you need to install it separately.

ffmpeg settings:

Example 1:

ffmpeg -i INPUT -s 320x240 -vcodec mpeg4 -vtag XVID -b 500kb -mbd rd
       -flags +4mv+trell+aic -cmp 2 -subcmp 2 -g 300 -r 29.97 -acodec mp3
       -ab 128 -ac 2 -async 1 OUTPUT.avi

Example 2:

ffmpeg -i INPUT -pass 1 -s 320x240 -vcodec mpeg4 -vtag XVID -b 500kb -mbd rd
       -flags +4mv+trell+aic -cmp 2 -subcmp 2 -g 300 -acodec copy null.avi
       -threads 2

ffmpeg -i INPUT -pass 2 -s 320x240 -vcodec mpeg4 -vtag XVID -b 500kb -mbd rd
       -flags +4mv+trell+aic -cmp 2 -subcmp 2 -g 300 -acodec mp3 -ab 128
       -ac 2 -async 1 OUTPUT.avi -threads 2

(You can use 320x180 plus -padtop 30 and -padbottom 30 for 16:9 aspect ratio content. For mid-quality bitrates, use 350; for low-quality, use 250.)


I use a Handbrake script to rip movies directly to Cowon format. I'm considering playing with other parameters.


You can use VLC to rip video.

Panasonic Lumix DMC-ZS3

VLC plays AVCHD (.MTS files) just fine. To convert it to AVI, I use ffmpeg. First, I figure out the bitrate of the original file:

 ffmpeg -i file.mts

Then I convert using the bitrate information. It's important to do this; otherwise, the converted file will be pixelated:

 ffmpeg -i file.mts -b BBBBBk file.avi

where BBBBB is the bitrate in kbits/sec.


Considering Toshiba DVR670 or (less likely) the Magnavox ZV457MG9 for Mom and Dad.

See Also