[mythtv-users] replacement for mythtranscode --mpeg2 -l using ProjectX

Tino Keitel tino.keitel at gmx.de
Tue Jul 18 16:04:52 UTC 2006


Hi,

there was a typo in the previous script. This one should work.

Regards,
Tino
-------------- next part --------------
#!/bin/sh -e

# Copyright (C) 2006, Tino Keitel <tino.keitel+mythcutprojectx at tikei.de>

# Usage: mythcutprojectx <recording>
# <recording> is a file recorded by MythTV with a valid DB entry.

# This script will pass the MythTV cutlist to ProjectX.
# The file will be re-multiplexed to be usable as a dvdauthor input file,
# so you can burn it on a DVD.
# If not cutlist is present, the file will just be converted to DVD format.

# Limitations:
# - all audio tracks except the first will be lost
#   (as long as I can't figure out how to replace the mencoder run by something
#   that preserves all audio tracks)

# You might want to customize these two variables
TEMP=please_fill_in_your_the_path_for_the_temporary_files_here
PROJECTX=/path/to/ProjectX.jar

PASSWD=`grep "^DBPassword" /etc/mythtv/mysql.txt | cut -d '=' -f 2-`

if test "$1" 	echo "Usage: mythcutprojectx <recording>"
	echo "<recording> is a file recorded by MythTV with a valid DB entry."
	echo "This file will be replaced with the edited file."
	exit 0
fi

# database schema >53 saves keyframe markers in a separate table
dbver=`echo "select data from settings where value='DBSchemaVer'" |
	mysql -N -u mythtv -p$PASSWD mythconverg`
if test $dbver !	keyframetable="recordedseek"
else
	keyframetable="recordedmarkup"
fi

# chanid and starttime identify the recording in the DB
chanid=`echo "select chanid from recorded where basename=\"$1\";" |
	mysql -N -u mythtv -p$PASSWD mythconverg`

starttime=`echo "select starttime from recorded where basename=\"$1\";" |
	mysql -N -u mythtv -p$PASSWD mythconverg`

# get cutlist (mark type 0 and 1)
list=`echo "select mark from recordedmarkup
	where chanid=$chanid and starttime='$starttime' and type in (0,1) order by mark;" |
	mysql -N -u mythtv -p$PASSWD mythconverg |
	tail -n +2 |
	head -n -1`

echo "CollectionPanel.CutMode=0" > cutlist$$

# find the key frame (mark type 9) right before each cut mark,
# extract the byte offset, write it into the ProjectX cutlist
for i in $list ;
	do echo "select offset from $keyframetable
	where chanid=$chanid and starttime='$starttime' and type=9 and mark >	order by offset;" |
	mysql -N -u mythtv -p$PASSWD mythconverg |
	head -1
done >> cutlist$$

# de-multiplex with the created cutlist
java -jar "$PROJECTX" -name tempcut$$ -out $TEMP -cut cutlisti$$ "$1" || :

# re-multiplex, pipe it through mencoder so that we get a file that
# can be processed by dvdauthor
mplex -o /dev/stdout -V -f 8 $TEMP/tempcut${$}.m2v $TEMP/tempcut${$}*.mp2 |
mencoder -oac copy -ovc copy -of mpeg -mpegopts format=dvd:vbitrate00 -o "$1.cut" /dev/stdin

rm -f "$1"
mv "$1.cut" "$1"

mythcommflag --rebuild -f "$1"
rm -f $TEMP/tempcut${$}*
rm -f cutlist$$



More information about the mythtv-users mailing list