KVET.CH

about    AMA   

You know me, I don't like to complain.

January 6, 2012 at 9:04pm

Home

videomerge.sh

In the process of encoding my LaserDiscs of the theatrical releases of the original Star Wars trilogy, I’ve ended up with multiple files for each film. This is because back in my day, there was no BluRay or DVD and a LaserDisc can only accommodate 30-45 minutes each side.

For my co-host and those under the age of 30: Yes, we flipped a movie over periodically to continue watching it. The 1% had their “auto flip” LD players that had a laser that could play both sides without such vulgar measures, but most of us flipped.

In the case of the Holy Trinity, this is really ugly because there are three “sides” for each of the original releases, so you’ll end up with three files that you’ve encoded. Now how to gracefully get them all into one file without using really stupid workarounds?

You’ll need a script (below) and mencoder, which you can build from source or get binaries for at the mencoder download page. Ensure mencoder is in your $PATH, make this script executable, and merge your treasured videos into a single file.

 #!/bin/zsh

 usage ()
 {
      echo "do not taunt videomerge.sh"
      echo " "
      echo "usage: videomerge.sh 'newfile.avi' 'video-part1.avi' 'video-part2.avi' 'video-part2.avi'"
      echo " "
      echo "the third file is optional, and you can hack the script to support more if you want." 
      echo " " 
      echo $errmsg
 }

 # test if we have at least three arguments on the command line
 # otherwise, what are you here for?
 #

 # if [ $# != 3 ]
 if test $# -lt 3
 then
     usage
     exit
 fi

 # test if file one exists and send an additional error message
 # to usage if not found

 if [ ! -f $2 ]
 then
     errmsg=${2}":File Not Found"
     usage
     exit
 fi

 # same for file two

 if [ ! -f $3 ]
 then
     errmsg=${3}":File Not Found"
     usage
     exit
 fi

 #
 # You can get binaries for mencoder from Sourceforge or build your own, out of scope
 # for this script.
 #
 # mencoder will actually let you merge more than two files.
 #

 mencoder -oac copy -ovc copy -idx -o $1 $2 $3 $4

Notes

  1. emory posted this