π
2008-10-28 01:01
in Public
I've been sitting on 4 old VHS tapes I filmed in 1992-1993 when I was an exchange student in Missouri. It was about 14-15 hours of footage in PAL, which was a problem since I had nothing to read those tapes here.
I ended up asking coworkers if someone had a tri-standard VCR lying around, and sure enough someone did and nicely offered to lend it to me (those things used to cost $500, considering that they were triple head VCRs with built in digitizers and digital converters, something that is trivial to do today, but cost a lot of CPU and money back then).
As a result, I've been spending the last 10 days or so trying to re-read those old tapes and encode them to mpeg2 and then divx. It's been a painful process because the tapes are obviously not in pristine condition and each time the picture skipped, the encoder on my mpeg2 card in my mythtv got out of sync and the rest of the recording was crap. As a result, I've had to watch the recordings, stop when bad, rewind and digitize in a new file until I got to the end, and do this again until I was done with all the tapes (I ended up with around 35 chunks that I had to hand paste together).
If you are curious, the magic incantations are:
- To capture an mpeg2 file
v4l2-ctl --set-input 2 # composite
v4l2-ctl -s 2 # switch card input to 625 line PAL-I (not 525 line NTSC-M)
v4l2-ctl --set-ctrl=video_peak_bitrate=8000000
v4l2-ctl --set-ctrl=video_bitrate=6000000
- Look at each piece with mplayer, find out which sub-piece to cut, and cut it like so:
mencoder -ss 0:10:20 -endpos 0:0:13 -oac copy -ovc copy -of mpeg yfu6.mpeg -o YFU6.mpeg
- When all the pieces are ready, paste them all together like so
mencoder -oac copy -ovc copy -of mpeg YFU?.mpeg -o YFU-all.mpeg
- And if the output is good, you can then encode it (I use a script that effectively runs this):
# $1 => infile, $2 => outfile
br=800
vf='-vf scale=540:405,crop=512:384'
pass="$2".pass
for i in 1 2
do
echo "DOING PASS $i"
echo "-------------"
# Trellis searched quantization
nice -19 mencoder -passlogfile "$pass" $demux -oac mp3lame -lameopts mode=3:abr:br=128 $time $aspect $vf -ovc lavc -lavcopts vcodec=mpeg4:vhq:trell=yes:v4mv=yes:vbitrate=$br:vpass=$i -ffourcc DX50 -o "$2" "$1" || die "multipass failed on pass $i"
done
/bin/rm $pass &>/dev/null
- or if mencoder mpeg merge doesn't work (sometimes, merging mpegs failed for me):
avimerge -o big.avi -i my_file1.avi my_file2.avi my_file3.avi