Jeremy Sands

Res publica non dominetur

A few nifty Linux video tricks with cat

Have a webcam or a TV tuner? Need to test it to make sure it’s working? Have some video files you want to combine? You’d be surprised what the command line tool cat can do.

Test a webcam or TV Tuner:
# cat /dev/v4l/video0 > /tmp/vidtest.mpg
(Note, your device may be video1 or similar.) Wait a few seconds. Then hit Ctrl+C.

Now run:
# mplayer /tmp/vidtest.mpg

Need to merge pesky split wmv files? The ones ending in .wmv.001 and .wmv.002?
$ cat part1.wmv.001 part2.wmv.002 part3.wmv.003 > mergedfile.wmv

Need to merge AVI files? Even ones encoded in DivX or XviD?
$ cat file1.avi file2.avi file3.avi > mergedfile.avi
$ mencoder -forceidx -oac copy -ovc copy mergedfile.avi -o finalmergedfile.avi