Friday, November 04, 2005

Transcoding Fun And Games

Alright so you have created a ton of video content with your ATI All In Wonder or other capture card. You have all of this live television recorded for you viewing posterity. There are a few problems however, commercials and it is in MPEG2 which is a complete pig. There are a few tools that can come to your rescue. Let's start with commercials.

Everyone hates commercials. Even if you can fastforward through them why would you want them to be in your archival video. They just take up uncessary space. Luckily there are tools out there to automagically get rid of them. The best of these is called comskip.exe. This program takes MPEG2 programs and automatically discovers where the commercial points are.

The next problem is the transcoding part. This is easily solved with mencoder.exe which can be downloaded for Windows and Linux from the MPlayer site. Let's say you wanted to turn your MPEG2 file to a XVID with the commercials skipped. That could be accomplished with a series of commands such as (This was ripped off of the GB-PVR site at the following link):

1. edit postprocessing.bat to run

comskip.exe on %1 and echo %1 >> \pvr\transcode.txt

2a. edit \pvr\transcode.cmd to something like that:

f=`cat \pvr\transcode.txt`
for t in $f; do
\pvr\mencoder -oac mp3lame -ovc xvid -xvidencopts fixed_quant=4 $t -o $
if [ %errorlevel% == 0]; do
del $t
ren $ $t
egrep -e $t \pvr\transcode.txt >\pvr\transcode

2b. or in batch syntax (from NormanR)

copy \pvr\transcode.txt \pvr\transcode.tmp
for /f %%a in (\pvr\transcode.tmp) do call :process %%a
del \pvr\transcode.tmp
goto :eof
\pvr\mencoder -oac mp3lame -ovc xvid -xvidencopts fixed_quant=4 %1 -o
if errorlevel 1 goto :failed
del %1
move %1
find /v "%1" < \pvr\transcode.txt > \pvr\
del \pvr\transcode.txt
move \pvr\ \pvr\transcode.txt
goto :eof

3. schedule a new task to be run on weekdays (Mo-Fr) at 9:00 \pvr\transcode.cmd and enable maximum run for 8h.

The UNIX tools (like cat) can be downloaded from the following link. Happy transcoding!

No comments: