Transcoding (MythTV)

From MattWiki
(Redirected from Transcoding)

Transcoding to avi via the user jobs

mencoder -really-quiet -vf scale=480:272 -oac mp3lame -lameopts mode=0:cbr:br=96 -af volnorm -srate 32000 \
-ovc xvid -xvidencopts bitrate=300 -o $VIDEODIR/pda/$TITLE-$STARTTIME.avi  $VIDEODIR/$FILENAME
  • Using a script to create an AVI file
#!/bin/bash

MENCODER=/usr/bin/mencoder
DEST=/mythtv/avi/

$MENCODER -passlogfile $1.log -quiet $1 -oac mp3lame -ovc xvid -xvidencopts pass=1:max_bframes=1:trellis:vhq=4:chroma_me:chroma_opt:hq_ac:bvhq=1 -vf kerndeint,scale=640:480 -o /dev/null
$MENCODER -passlogfile $1.log -quiet $1 -oac mp3lame -ovc xvid -xvidencopts pass=2:bitrate=920:max_bframes=1:trellis:vhq=4:chroma_me:chroma_opt:hq_ac:bvhq=1 -vf kerndeint,scale=640:480 -o $1.avi

mv $1.avi $DEST
rm -f $1.log

Using the pdatranscode.pl script

Also see Transcoding to a PDA on the Mythtv wiki.

Installing the pdatranscode.pl script

Installing pdatranscode.pl is as simple as copying it to your backend server, making the script executable, running a command like

 pdatranscode.pl --install-job-number 1

To update the MySQL database, and restarting mythbackend. Since all options can be overridden on the command line, the same script can be used for different behavior in different User Jobs. For instance, the following commands would set up MythTV for two different jobs with the same script

 pdatranscode.pl --install-job-number 1 --install-job-name "PDA Transcode (TV)" --scale 320:240
 pdatranscode.pl --install-job-number 2 --install-job-name "PDA Transcode (movie)" --filename-format "{title}.avi" --scale 480:360

Transcodeing with the pdatranscode.pl script

Run the script with no arguments to get usage and filename format string information.

PDATranscode with Store Groups

Insert a find statement into the script so that it can locate the true path to the recording:

# code for adding Find function to pdatranscode
#this goes near the beginning of the script with the other 'use'  statements
use File::Find;
#I place this section directly after the "normal command-line argument processing" section
print("Myth says the directory should be $config{dir}...\n");
print("finding file directory...\n");
find (\&wanted, '/mnt/mythtv/tv/', '/mnt/mythtv2/tv/', '/mnt/mythtv3/tv/');
print "The file was found in $config{dir}\n";
#this goes in the subroutine section
# Loop to find file path on multiple backends...
sub wanted {
    if ($_ eq "$config{file}") {
        $config{dir} = "$File::Find::dir";
    }
}

Riping from a DVD

DVD to Xvid

Run the following two commands to start ripping but be sure to change the "#" to the number of the dvd title that you want to rip (normally 1 but this can sometimes be the copyright notice or trailer). If you leave the # blank, it will rip the largest video track on the disc.

mencoder dvd://# -ovc xvid -xvidencopts pass=1 -alang en -oac copy -o /dev/null
mencoder dvd://# -ovc xvid -xvidencopts pass=2:bitrate=1000 -alang en -oac mp3lame -lameopts vbr=3 -o movie.avi