Ok, here's a couple of scripts I have been using very successfully. Make sure you have run ProjectX once and have the X.ini file.

This first one was mostly another's work, I forget who! (THANK YOU). I added a command-line option which I use exclusively (-m) because I want just a mpg file that I can use in DVDStyler later.

-------------nuv2dvd.sh--------------
#!/bin/bash

# Just a sample script.  Use at your own risk!
#
# Usage: nuv2dvd [-m] [-d] [-r<N>] <file1> [<file2> <file3>...]
#
#   -d       Only make a dvd directory structure: do not burn.  Resulting
#            file structure can be found in ./dvd.tempdir/dvd
#   -r<N>    Requantize video only using tcrequant with requantization
#            factor N.  This will reduce the space taken for video by a
#            factor of N.  E.g. -r2.0 will result in video that takes
#            about half the original space.  Does not affect audio.
#
#   -m       mplex only - do not create the DVD structure

DEVICE="/dev/sr0"    # DVD burner device.  Make sure it's umounted!
STREAM_BASE="stream"
PROJECTX_BIN="/myth/burn/ProjectX.jar"   # Compiled ProjectX.jar
PROJECTX_INI="/myth/burn/X.ini"    # Use an unchanged default X.ini!
TEMP_DIR="/myth/burn/temp"
FINAL_DIR="/myth/video" # only for just mplexing

function Error ()
{
   echo "ERROR: $1"
   exit 1
}

mkdir $TEMP_DIR || Error "Could not make tempdir: $TEMP_DIR"

COUNT=0; RVAL=""; BURN="yes"; JUSTMPLEX="no" for ARG in $*
do
   echo "Argument: $ARG"
   case $ARG in
       -r*)    # Requantize
           RVAL=${ARG##*-r}
           echo "Requantization factor: $RVAL"
       ;;
       -d)     # Just write dvd file structure
           BURN="no"
           echo "Burn: $BURN"
       ;;
       -m)     # Just mplex
           BURN="no"
           JUSTMPLEX="yes"
           echo "Just mplex: $JUSTMPLEX"
;; *) # Process the file ./getcutlist.sh $ARG if [ -s $ARG ]; then
               echo "Demultiplexing file: $ARG"
               let "COUNT=$COUNT+1"
java -jar $PROJECTX_BIN -c $PROJECTX_INI -p cutlist2.txt -n "$STREAM_BASE$COUNT" -o $TEMP_DIR $ARG
               BNAME="$TEMP_DIR/$STREAM_BASE$COUNT"
               if [ ! -z $RVAL ]; then
                   mv "$BNAME.mpv" "$BNAME.tmp.mpv"
                   mkfifo "$BNAME.mpv"
                   echo "Starting requantization at factor $RVAL"
tcrequant -i "$BNAME.tmp.mpv" -o "$BNAME.mpv" -d2 -f $RVAL &
               fi

               echo "Remultiplexing file: $ARG"
if [ $JUSTMPLEX = "no" ]; then mkfifo "$BNAME.mpg"
                   outname="$BNAME.mpg"
                   mplex -f 8 -V -o "$outname" "$BNAME.mpa" "$BNAME.m2v" &
               else
                   outname="$TEMP_DIR/$(basename $ARG).mpg"
                   mplex -f 8 -V -o "$outname" "$BNAME.mpa" "$BNAME.m2v"
               fi
else Error "Not a good file: $ARG"
           fi
       ;;
esac done

if [ $JUSTMPLEX = "no" ]; then
  echo "Creating dvd file structure with dvdauthor..."
  dvdauthor -o "$TEMP_DIR/dvd" -f "$TEMP_DIR/$STREAM_BASE"*.mpg
  dvdauthor -o "$TEMP_DIR/dvd" -T

  if [ $BURN = "yes" ]; then
      echo "Burning file structure to dvd device: $DEVICE"
      growisofs -Z $DEVICE -dvd-video "$TEMP_DIR/dvd"
  fi

  echo "Cleaning up temporary files..."
  rm -v "./$TEMP_DIR/$STREAM_BASE"*

  if [ $BURN = "yes" ]; then
      rm -rv "$TEMP_DIR/dvd"
rmdir -r "$TEMP_DIR" fi
else
  echo "$outname"
  mv "$outname" "$FINAL_DIR"
  rm -r "$TEMP_DIR"
fi
--------------------------------

This next one is called by the above. It gets the cutlist. It could theoretically be inline...

---------getcutlist.sh---------

#!/bin/sh

infile=$1
mysqluser='mythtv'
mysqlpass='mythtv'

# I definitely want to use pretty links, so...
if [ -L $infile ]; then
       infile=$( basename $( readlink $1 ))
fi

# Strip stuff out of the filename
channel=$( echo $infile | cut --delimiter="_" -f 1 )
starttime=$( echo $infile | cut --delimiter="_" -f 2 )
endtime=$( echo $infile | cut --delimiter="_" -f 3 | cut --delimiter="_" -f 1 | cut --delimiter="." -f 1 )

echo "(2) use Frame number for cuts" > cutlist.txt
mysql -u$mysqluser -p$mysqlpass mythconverg -s -B --exec \
"select IFNULL(recorded.cutlist,'') from recorded where recorded.chanid=$channel and recorded.starttime=$starttime and recorded.endtime=$endtime;" >> cutlist.txt
sed -e "s/\\\n/\n/g; s/ - /\n/g; s/^0\n//g" cutlist.txt > cutlist2.txt

--------------------------------

I wonder if the MythBurn invertcutlist.pl file would be a better solution than using the ^0\n edit as above... I haven't investigated.

Comments? Improvements?





_______________________________________________
mythtv-users mailing list
[email protected]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users

Reply via email to