nix, shell, perl, php, mysql and mac os x tips and tricks

Saturday, May 29, 2004

Process an AVI output file from capture_video (MJPEG) into a DVD compatable MPEG file

#!/bin/bash
# Inputs:
# 1. Input file basename (input will be filename.avi, output will be filename.mpeg)

lav2wav +p $1.avi | mp2enc -r 48000 -b 384 -o $1.mp2

lav2yuv +p $1.avi | mpeg2enc -b 3800 -q 1 -n n -f 8 -s -r 16 -v 0 -o $1.m1v

mplex -f 8 $1.mp2 $1.m1v -o $1.mpeg

rm $1.m1v
rm $1.mp2

Burn a DVD from a set of MPEG files

#!/bin/bash
# Input:
# 1-255: MPEG files to be chapters of DVD
#

dvddirgen -o tmp_dvd -r
dvdauthor -o tmp_dvd $argv
dvdauthor -o tmp_dvd -T

dvd+rw-format -force /dev/cdrom
dvd+rw-booktype -dvd-rom-spec -unit+rw /dev/cdrom

growisofs -speed=1 -dvd-compat -overburn -Z /dev/cdrom -R -udf -dvd-video tmp_dvd

rm -rf tmp_dvd

Capture X minutes of video into file Y from /dev/video0 for DVD creation

# Arguments:
# 1. Minutes of video to burn
# 2. Base filename output will be filename.avi

system("streamer -n ntsc -t " . ($ARGV[0] * 30 * 60) . " -s 720x480 -r 30 -o $ARGV[1].avi -f mjpeg -R 48000 -F stereo -c /dev/video0");

print $ARGV[0] . " minutes captured into $ARGV[1].avi\n";