Conversion from mpg to mkv.


This post is a follow up on:
Conversions.

I am bit of on a deadline now! So come back later for a more detailed explanation.

#!/bin/bash
# Modified: Today by E.l.f
#
## This program is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free Software
## Foundation; either version 2 of the License, or (at your option) any later
## version.
#
## This program is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
## details.
#
## You should have received a copy of the GNU General Public License along with
## this program; if not, write to the Free Software Foundation, Inc., 51
## Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
## http://www.gnu.org/copyleft/gpl.html
#
## Script-name - mpg2mkv.sh
#
## Source (inspired on): http://ffmpeg.org/ffmpeg-doc.html
## And: http://ubuntuforums.org/showthread.php?t=1037517
RED="\033[0;31m"
BLUE="\033[1;34m"
CYAN="\033[1;36m"
YELLOW="\033[1;33m"
NC="\033[0m"
if [ $USER = root ]; then
  echo -e $RED"Are you Insane!"
  echo -e $CYAN"Error: In order to use this script, one must NOT be $USER"
  echo -e $YELLOW"Exiting..."$NC
  exit 0
else
  echo ""
  echo -e $BLUE"    $USER may proceed."  
  echo -e $CYAN"    May peace be with you."$NC
fi
ls *.mpg
echo -n "Enter filename: "
read INPUT
INPUT=$INPUT
if [ ! -f $INPUT ]; then
  echo ""
  echo -e $RED"Error: File doesn't exist!"
  echo -e $YELLOW"Exiting..."$ENDCOLOR
  echo ""
  exit 0
fi
OUTPUT=${INPUT%.*g}
TITLE=${INPUT%.*g}
OUTPUT+=".mkv"
OPTIONS=$(echo "--forced-track 0:no --forced-track 1:no -a 1 -d 0 -S -T --no-global-tags --no-chapters --track-order 0:0,0:1")
mkvmerge -o $OUTPUT $OPTIONS $INPUT
exit 0
# find -iname '*.ext' -exec someScript "{}" \;
# Depends on sudo apt-get install libdvdcss2 k9copy ffmpeg2theora mkvtoolnix-gui avidemux mencoder ffmpeg

PS: These new posts of mine will be in line with the notes I post on facebook.com. 😉 Though the formatting won’t be garbled this time. *Say demoronize* >-)

5 thoughts on “Conversion from mpg to mkv.

  1. Pingback: Batch processing by means of using any script of your choosing. « Bohemian Wildebeest's Blog

  2. Hi, i think that i saw you visited my blog so here i am!.I am looking for ways to add things to my website!I suppose its ok to use some of your ideas!!

    Like

    • One thought leads to another like the sparkles one witnesses when one bashes pieces of pyrite against each other. You’re so NOT in control of your *thoughts* >;-)

      Like

Comments are closed.