[mythtv-users] Removing commercials

Mike Holden mythtv at mikeholden.org
Sat Apr 11 12:32:37 UTC 2009


P.J. Trudell wrote:
> Thanks for your help.  Here are my results.  I am having the same issues.

This is the script I use, which correctly cuts the commercials out of the
program. I run it from outside of mythtv, direct from the commandline.

Note that a couple of the lines have wrapped due to email formatting,
especially the actual mythtranscode lines.

It's still a work in progress, so could probably do with more error
checking etc. At the moment, I manually copy the original file to another
name as a backup, and keep it until I am happy with the results.

[root at puzzle bin]# cat myth_mpeg_cut
#!/bin/bash

if [ $# -ne 2 ]
then echo Usage: $0 CHANID STARTTIME; exit 1
fi

LOG=/var/log/mythtv/mpeg_cut.log

CHANID=$1
STARTTIME=$2

date >> $LOG
echo CHANID $CHANID >> $LOG
echo STARTTIME $STARTTIME >> $LOG

ls -l /myth/*/storage*/video/${CHANID}_${STARTTIME}.mpg >> $LOG
ORIGFILE=$(ls /myth/*/storage*/video/${CHANID}_${STARTTIME}.mpg)
BAKFILE=$ORIGFILE.bak
NEWFILE=$ORIGFILE.tmp

echo "Transcoding $ORIGFILE" >> $LOG
echo "         to $NEWFILE" >> $LOG
echo "  backup is $BAKFILE" >> $LOG

echo
echo Cutting to cutlist
mythtranscode --chanid $CHANID --starttime $STARTTIME --mpeg2
--honorcutlist --verbose commflag; STATUS=$?
echo STATUS $STATUS

if [ -f $NEWFILE ]
then
    echo
    echo Clearing old cutlist
    mythcommflag --chanid $CHANID --starttime $STARTTIME --clearcutlist

    echo Swapping files
    mv $ORIGFILE $BAKFILE
    mv $NEWFILE $ORIGFILE
    mythtranscode --chanid $CHANID --starttime $STARTTIME --mpeg2
--buildindex --allkeys --verbose commflag; STATUS=$?
fi

-- 
Mike Holden

http://www.by-ang.com - the place to shop for all manner of hand crafted
items, including Jewellery, Greetings Cards and Gifts




More information about the mythtv-users mailing list