Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
My video converter script
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
cheater1034
Veteran
Veteran


Joined: 09 Sep 2004
Posts: 1558

PostPosted: Sun Nov 16, 2008 4:46 am    Post subject: My video converter script Reply with quote

I made a little bash script that will convert video files 18 different ways using ffmpeg, mencoder, or transcode.

I'll put it on zen-sources.org when it's back up, but anyway here's what the initial execution looks like:
Code:
cc Desktop # ./converter.sh
* CC's Video Converter Script v1.0
* Convert video files 18 different ways with FFMPEG/MENCODER/TRANSCODE

* You can perform conversions with ffmpeg

* You can perform conversions with mencoder

* You can perform conversions with transcode

* Sexy Time!

* Choose the conversion you wish to perform
* -----------------------------------------
* '*' = Any Format

* FFMPEG Conversions

*  1) '*' to 'MPEG'
*  2) '*' to 'VCD' (PAL)
*  3) '*' to 'VCD' (NTSC)
*  4) '*' to 'DVD' (PAL)
*  5) '*' to 'DVD' (NTSC)
*  6) '*' to 'SVCD' (PAL)
*  7) '*' to 'SVCD' (NTSC)
*  8) '*' to 'FLV' (Audio Bitrate = 256, Audio Sampling Freq. = 44100)
*  9) '*' to 'FLV' (Audio Bitrate = 256, Audio Sampling Freq. = 22050)
*  10) '*' to 'FLV' (Audio Bitrate = 256, Audio Sampling Freq. = 11025)
*  11) '*' to 'FLV' (Same as 8, but also sets -sameq, about double file size)
*  12) '*' to 'FLV' (-ab 56, -ar 22050, -b 500, 320x240) - FLV standards?
*  13) 'FLV' to 'MPEG' (Same as 12, except convert a FLV to MPG)

* Mencoder Conversions

*  14) '*' to 'MPEG'
*  15) 'OGG' to 'MPEG' (Passes -lavcopts abitrate=160, makes OGG conversion work)
*  16) '*' to 'AVI' (250-bit XVID) (same as 6, but -ofps=23.976 - better if converting from WMV)
*  17) '*' to 'AVI' (250-bit XVID) (same as 5, but -ofps=29.97)

* Transcode conversions

*  18) '*' to 'AVI' (XVID)

* Input the number of desired conversion and then press <ENTER>
?


The conversion list is there, 1-18, it error checks and everything. Just a pretty nifty tool for video conversions ;)

Here's the actual code:
Code:
#!/usr/bin/env bash

VERSION="1.0"
WAYS=18
LOG_ERR=/var/errorlog
ROOT_UID=0 

# Sanity Check
[[ -e /etc/profile ]] && . /etc/profile

eerror() {
   echo -e "\033[0m\033[31m!!! \033[0m$*"
}

ewarn() {
   echo -e "\033[0m\033[1;33m* \033[0m$*"
}

einfo() {
   echo -e "\033[0m\033[32m* \033[0m$*"
}

# Welcome the personz
einfo "CC's Video Converter Script v${VERSION}"
einfo "Convert video files ${WAYS} different ways with FFMPEG/MENCODER/TRANSCODE"
echo ""

# For error checking
# If value is 0, then fail
error()
{
if [[ $? -ne 0 ]]; then
   eerror "$1" | tee -a $LOG_ERR
   exit $?
fi
}

# Check if user is root
if [ "$UID" -ne "$ROOT_UID" ]
then
   eerror "Must be root to run this script."
   exit $ROOT_UID
fi 

# SPINNAZ
spinna() {
        PROC=$1
   einfo "Working"
   einfo "(This may take awhile)"
        while [ -d /proc/$PROC ] ; do
      echo -en '\033[0m\033[90m.' ; sleep 1
      echo -en '\033[0m\033[91m.' ; sleep 1
                echo -en '\033[0m\033[92m.' ; sleep 1
                echo -en '\033[0m\033[93m.' ; sleep 1
                echo -en '\033[0m\033[94m.' ; sleep 1
                echo -en '\033[0m\033[95m.' ; sleep 1
                echo -en '\033[0m\033[96m.' ; sleep 1
                echo -en '\033[0m\033[97m.' ; sleep 1
        done
   echo -e "...Done!\033[0m"
   echo ""
}

# Test for ffmpeg/mencoder/transcode, require atleast one
if ( [[ -e /usr/bin/ffmpeg ]] || [[ -e /usr/sbin/ffmpeg ]] || [[ -e /bin/ffmpeg ]] || [[ -e /sbin/ffmpeg ]] ) ; then
   FFMPEG=1
   einfo "You can perform conversions with ffmpeg"
   echo ""
else
   FFMPEG=0
   ewarn "WARNING: ffmpeg executable not found!"
   ewarn "You CAN NOT perform conversions with ffmpeg!"
   echo ""
fi

if ( [[ -e /usr/bin/mencoder ]] || [[ -e /usr/sbin/mencoder ]] || [[ -e /bin/mencoder ]] || [[ -e /sbin/mencoder ]] ) ; then
   MENCODER=1
        einfo "You can perform conversions with mencoder"
        echo ""
else
   MENCODER=0
        ewarn "WARNING: mencoder executable not found!"
        ewarn "You CAN NOT perform conversions with mencoder!"
   ewarn "Compile mplayer with encode support for mencoder!"
        echo ""
fi

if ( [[ -e /usr/bin/transcode ]] || [[ -e /usr/sbin/transcode ]] || [[ -e /bin/transcode ]] || [[ -e /sbin/transcode ]] ) ; then
        TRANSCODE=1
        einfo "You can perform conversions with transcode"
        echo ""
else
        TRANSCODE=0
        ewarn "WARNING: transcode executable not found!"
        ewarn "You CAN NOT perform conversions with transcode!"
        echo ""
fi

if ( [[ -e /usr/bin/ffmpeg ]] || [[ -e /usr/sbin/ffmpeg ]] || [[ -e /bin/ffmpeg ]] || [[ -e /sbin/ffmpeg ]] ) || ( [[ -e /usr/bin/mencoder ]] || [[ -e /usr/sbin/mencoder ]] || [[ -e /bin/mencoder ]] || [[ -e /sbin/mencoder ]] ) || ( [[ -e /usr/bin/transcode ]] || [[ -e /usr/sbin/transcode ]] || [[ -e /bin/transcode ]] || [[ -e /sbin/transcode ]] ) ; then
   einfo "Sexy Time!"
else
   eerror "You silly! This app requires ffmpeg, mencoder, transcode or all three"
   eerror "You have neither!"
   exit 1   
fi

   echo ""
   einfo "Choose the conversion you wish to perform"
   einfo "-----------------------------------------"
   einfo "'*' = Any Format"
   echo ""
   einfo "FFMPEG Conversions"
   echo ""
   einfo " 1) '*' to 'MPEG'"
   einfo " 2) '*' to 'VCD' (PAL)"
   einfo " 3) '*' to 'VCD' (NTSC)"
   einfo " 4) '*' to 'DVD' (PAL)"
   einfo " 5) '*' to 'DVD' (NTSC)"
   einfo " 6) '*' to 'SVCD' (PAL)"
   einfo " 7) '*' to 'SVCD' (NTSC)"
   einfo " 8) '*' to 'FLV' (Audio Bitrate = 256, Audio Sampling Freq. = 44100)"
   einfo " 9) '*' to 'FLV' (Audio Bitrate = 256, Audio Sampling Freq. = 22050)"
   einfo " 10) '*' to 'FLV' (Audio Bitrate = 256, Audio Sampling Freq. = 11025)"
   einfo " 11) '*' to 'FLV' (Same as 8, but also sets -sameq, about double file size)"
   einfo " 12) '*' to 'FLV' (-ab 56, -ar 22050, -b 500, 320x240) - FLV standards?"
   einfo " 13) 'FLV' to 'MPEG' (Same as 12, except convert a FLV to MPG)"
   echo ""
   einfo "Mencoder Conversions"
   echo ""
   einfo " 14) '*' to 'MPEG'"
   einfo " 15) 'OGG' to 'MPEG' (Passes -lavcopts abitrate=160, makes OGG conversion work)"
   einfo " 16) '*' to 'AVI' (250-bit XVID) (same as 6, but -ofps=23.976 - better if converting from WMV)"
   einfo " 17) '*' to 'AVI' (250-bit XVID) (same as 5, but -ofps=29.97)"
   echo ""
   einfo "Transcode conversions"
   echo ""
   einfo " 18) '*' to 'AVI' (XVID)"
   echo ""
   einfo "Input the number of desired conversion and then press <ENTER>"
   echo -n "? "
   read conversion
   echo ""

case $conversion in
   1)
if [[ "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "1" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "1" ]] ; then
      #*** Enter the target file
      einfo "Enter the location and file you wish to convert:"
      echo "(Example: /home/user/movie.wmv)"
      echo -n "? "
      read lfile
      echo ""

                #*** Check if file exists, if not fail
      cat $lfile > /dev/null 2>&1
      error "File does not exist!"

                #*** Enter output destination
      einfo "Enter the output destination of the file you wish to convert:"
      echo "(Example: /home/user/movie.mpeg)"
      echo -n "? "
      read output
      echo ""

      #*** Conversion
      ffmpeg -i ${lfile} -f mpeg -qscale 15 ${output} > /dev/null 2>&1 &
      spinna $!
                cat $output > /dev/null 2>&1
      error "ffmpeg failed"
else
      eerror "What the fuck? You don't have ffmpeg!"
fi
        ;;
        2)
if [[ "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "1" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "1" ]] ; then
                #*** Enter the target file
                einfo "Enter the location and file you wish to convert:"
                echo "(Example: /home/user/movie.avi)"
                echo -n "? "
                read lfile
                echo ""

                #*** Check if file exists, if not fail
                cat $lfile > /dev/null 2>&1
                error "File does not exist!"

                #*** Enter output destination
                einfo "Enter the output destination of the file you wish to convert:"
                echo "(Example: /home/user/movie.mpeg)"
                echo -n "? "
                read output
                echo ""

                #*** Conversion
                ffmpeg -i ${lfile} -sameq -target vcd ${output} > /dev/null 2>&1 &
                spinna $!
                cat $output > /dev/null 2>&1
                error "ffmpeg failed"
else
                eerror "What the fuck? You don't have ffmpeg!"
fi
   ;;
        3)
if [[ "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "1" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "1" ]] ; then
                #*** Enter the target file
                einfo "Enter the location and file you wish to convert:"
                echo "(Example: /home/user/movie.avi)"
                echo -n "? "
                read lfile
                echo ""

                #*** Check if file exists, if not fail
                cat $lfile > /dev/null 2>&1
                error "File does not exist!"

                #*** Enter output destination
                einfo "Enter the output destination of the file you wish to convert:"
                echo "(Example: /home/user/movie.mpeg)"
                echo -n "? "
                read output
                echo ""

                #*** Conversion
                ffmpeg -i ${lfile} -sameq -target ntsc-vcd ${output} > /dev/null 2>&1 &
                spinna $!
                cat $output > /dev/null 2>&1
                error "ffmpeg failed"
else
                eerror "What the fuck? You don't have ffmpeg!"
fi
        ;;
   4)
if [[ "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "1" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "1" ]] ; then
                #*** Enter the target file
                einfo "Enter the location and file you wish to convert:"
                echo "(Example: /home/user/movie.avi)"
                echo -n "? "
                read lfile
                echo ""

                #*** Check if file exists, if not fail
                cat $lfile > /dev/null 2>&1
                error "File does not exist!"

                #*** Enter output destination
                einfo "Enter the output destination of the file you wish to convert:"
                echo "(Example: /home/user/movie.mpg)"
                echo -n "? "
                read output
                echo ""

                #*** Conversion
                ffmpeg -i ${lfile} -sameq -target dvd ${output} > /dev/null 2>&1 &
                spinna $!
                cat $output > /dev/null 2>&1
                error "ffmpeg failed"
else
                eerror "What the fuck? You don't have ffmpeg!"
fi
        ;;
        5)
if [[ "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "1" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "1" ]] ; then
                #*** Enter the target file
                einfo "Enter the location and file you wish to convert:"
                echo "(Example: /home/user/movie.avi)"
                echo -n "? "
                read lfile
                echo ""

                #*** Check if file exists, if not fail
                cat $lfile > /dev/null 2>&1
                error "File does not exist!"

                #*** Enter output destination
                einfo "Enter the output destination of the file you wish to convert:"
                echo "(Example: /home/user/movie.mpg)"
                echo -n "? "
                read output
                echo ""

                #*** Conversion
                ffmpeg -i ${lfile} -sameq -target ntsc-dvd ${output} > /dev/null 2>&1 &
                spinna $!
                cat $output > /dev/null 2>&1
                error "ffmpeg failed"
else
                eerror "What the fuck? You don't have ffmpeg!"
fi
        ;;
        6)
if [[ "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "1" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "1" ]] ; then
                #*** Enter the target file
                einfo "Enter the location and file you wish to convert:"
                echo "(Example: /home/user/movie.avi)"
                echo -n "? "
                read lfile
                echo ""

                #*** Check if file exists, if not fail
                cat $lfile > /dev/null 2>&1
                error "File does not exist!"

                #*** Enter output destination
                einfo "Enter the output destination of the file you wish to convert:"
                echo "(Example: /home/user/movie.mpg)"
                echo -n "? "
                read output
                echo ""

                #*** Conversion
                ffmpeg -i ${lfile} -sameq -target svcd ${output} > /dev/null 2>&1 &
                spinna $!
                cat $output > /dev/null 2>&1
                error "ffmpeg failed"
else
                eerror "What the fuck? You don't have ffmpeg!"
fi
        ;;
        7)
if [[ "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "1" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "1" ]] ; then
                #*** Enter the target file
                einfo "Enter the location and file you wish to convert:"
                echo "(Example: /home/user/movie.avi)"
                echo -n "? "
                read lfile
                echo ""

                #*** Check if file exists, if not fail
                cat $lfile > /dev/null 2>&1
                error "File does not exist!"

                #*** Enter output destination
                einfo "Enter the output destination of the file you wish to convert:"
                echo "(Example: /home/user/movie.mpg)"
                echo -n "? "
                read output
                echo ""

                #*** Conversion
                ffmpeg -i ${lfile} -sameq -target ntsc-svcd ${output} > /dev/null 2>&1 &
                spinna $!
                cat $output > /dev/null 2>&1
                error "ffmpeg failed"
else
                eerror "What the fuck? You don't have ffmpeg!"
fi
        ;;
        8)
if [[ "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "1" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "1" ]] ; then
      #*** Enter the target file
                einfo "Enter the location and file you wish to convert:"
                echo "(Example: /home/user/movie.avi)"
                echo -n "? "
                read lfile
                echo ""

                #*** Check if file exists, if not fail
                cat $lfile > /dev/null 2>&1
                error "File does not exist!"

                #*** Enter output destination
                einfo "Enter the output destination of the file you wish to convert:"
                echo "(Example: /home/user/movie.flv)"
                echo -n "? "
                read output
                echo ""

                #*** Conversion
                ffmpeg -i ${lfile} -ab 262144 -ar 44100 ${output} > /dev/null 2>&1 &
                spinna $!
                cat $output > /dev/null 2>&1
                error "ffmpeg failed"
else
                eerror "What the fuck? You don't have ffmpeg!"
fi
   ;;
   9)
if [[ "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "1" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "1" ]] ; then
                #*** Enter the target file
                einfo "Enter the location and file you wish to convert:"
                echo "(Example: /home/user/movie.avi)"
                echo -n "? "
                read lfile
                echo ""

                #*** Check if file exists, if not fail
                cat $lfile > /dev/null 2>&1
                error "File does not exist!"

                #*** Enter output destination
                einfo "Enter the output destination of the file you wish to convert:"
                echo "(Example: /home/user/movie.flv)"
                echo -n "? "
                read output
                echo ""

                #*** Conversion
                ffmpeg -i ${lfile} -ab 262144 -ar 22050 ${output} > /dev/null 2>&1 &
                spinna $!
                cat $output > /dev/null 2>&1
                error "ffmpeg failed"
else
                eerror "What the fuck? You don't have ffmpeg!"
fi
        ;;
        10)
if [[ "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "1" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "1" ]] ; then
                #*** Enter the target file
                einfo "Enter the location and file you wish to convert:"
                echo "(Example: /home/user/movie.avi)"
                echo -n "? "
                read lfile
                echo ""

                #*** Check if file exists, if not fail
                cat $lfile > /dev/null 2>&1
                error "File does not exist!"

                #*** Enter output destination
                einfo "Enter the output destination of the file you wish to convert:"
                echo "(Example: /home/user/movie.flv)"
                echo -n "? "
                read output
                echo ""

                #*** Conversion
                ffmpeg -i ${lfile} -ab 262144 -ar 11025 ${output} > /dev/null 2>&1 &
                spinna $!
                cat $output > /dev/null 2>&1
                error "ffmpeg failed"
else
                eerror "What the fuck? You don't have ffmpeg!"
fi
        ;;
        11)
if [[ "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "1" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "1" ]] ; then
                #*** Enter the target file
                einfo "Enter the location and file you wish to convert:"
                echo "(Example: /home/user/movie.avi)"
                echo -n "? "
                read lfile
                echo ""

                #*** Check if file exists, if not fail
                cat $lfile > /dev/null 2>&1
                error "File does not exist!"

                #*** Enter output destination
                einfo "Enter the output destination of the file you wish to convert:"
                echo "(Example: /home/user/movie.flv)"
                echo -n "? "
                read output
                echo ""

                #*** Conversion
                ffmpeg -i ${lfile} -sameq -ab 262144 -ar 44100 ${output} > /dev/null 2>&1 &
                spinna $!
                cat $output > /dev/null 2>&1
                error "ffmpeg failed"
else
                eerror "What the fuck? You don't have ffmpeg!"
fi
        ;;
   12)
if [[ "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "1" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "1" ]] ; then
                #*** Enter the target file
                einfo "Enter the location and file you wish to convert:"
                echo "(Example: /home/user/movie.mpg)"
                echo -n "? "
                read lfile
                echo ""

                #*** Check if file exists, if not fail
                cat $lfile > /dev/null 2>&1
                error "File does not exist!"

                #*** Enter output destination
                einfo "Enter the output destination of the file you wish to convert:"
                echo "(Example: /home/user/movie.flv)"
                echo -n "? "
                read output
                echo ""

                #*** Conversion
      ffmpeg -i ${lfile} -ab 57344 -ar 22050 -b 512000 -s 320×240 ${output} > /dev/null 2>&1 &
                spinna $!
                cat $output > /dev/null 2>&1
                error "ffmpeg failed"
else
                eerror "What the fuck? You don't have ffmpeg!"
fi
        ;;
        13)
if [[ "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "1" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "1" ]] ; then
                #*** Enter the target file
                einfo "Enter the location and file you wish to convert:"
                echo "(Example: /home/user/movie.flv)"
                echo -n "? "
                read lfile
                echo ""

                #*** Check if file exists, if not fail
                cat $lfile > /dev/null 2>&1
                error "File does not exist!"

                #*** Enter output destination
                einfo "Enter the output destination of the file you wish to convert:"
                echo "(Example: /home/user/movie.mpg)"
                echo -n "? "
                read output
                echo ""

                #*** Conversion
                ffmpeg -i ${lfile} -ab 57344 -ar 22050 -b 512000 -s 320×240 ${output} > /dev/null 2>&1 &
                spinna $!
                cat $output > /dev/null 2>&1
                error "ffmpeg failed"
else
                eerror "What the fuck? You don't have ffmpeg!"
fi
        ;;
        14)
if [[ "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "1" || "${FFMPEG}" == "0" && "${MENCODER}" == "1" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "0" && "${MENCODER}" == "1" && "${TRANSCODE}" == "1" ]] ; then
                #*** Enter the target file
                einfo "Enter the location and file you wish to convert:"
                echo "(Example: /home/user/movie.avi)"
                echo -n "? "
                read lfile
                echo ""

                #*** Check if file exists, if not fail
                cat $lfile > /dev/null 2>&1
                error "File does not exist!"

                #*** Enter output destination
                einfo "Enter the output destination of the file you wish to convert:"
                echo "(Example: /home/user/movie.mpeg)"
                echo -n "? "
                read output
                echo ""

                #*** Conversion
                mencoder ${lfile} -oac lavc -ovc lavc -o ${output} > /dev/null 2>&1 &
                spinna $!
                cat $output > /dev/null 2>&1
                error "mencoder failed"
else
                eerror "What the fuck? You don't have mencoder!"
fi
        ;;
   15)
if [[ "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "1" || "${FFMPEG}" == "0" && "${MENCODER}" == "1" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "0" && "${MENCODER}" == "1" && "${TRANSCODE}" == "1" ]] ; then
                #*** Enter the target file
                einfo "Enter the location and file you wish to convert:"
                echo "(Example: /home/user/movie.ogg)"
                echo -n "? "
                read lfile
                echo ""

                #*** Check if file exists, if not fail
                cat $lfile > /dev/null 2>&1
                error "File does not exist!"

                #*** Enter output destination
                einfo "Enter the output destination of the file you wish to convert:"
                echo "(Example: /home/user/movie.mpeg)"
                echo -n "? "
                read output
                echo ""

                #*** Conversion
      mencoder ${lfile} -oac lavc -ovc lavc -lavcopts abitrate=160 -o ${output} > /dev/null 2>&1 &
                spinna $!
                cat $output > /dev/null 2>&1
                error "mencoder failed"
else
      eerror "What the fuck? You don't have mencoder!"
fi
        ;;
   16)
if [[ "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "1" || "${FFMPEG}" == "0" && "${MENCODER}" == "1" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "0" && "${MENCODER}" == "1" && "${TRANSCODE}" == "1" ]] ; then
      #*** Enter the target file
      einfo "Enter the location and file you wish to convert:"
      echo "(Example: /home/user/movie.wmv)"
           echo -n "? "
           read lfile
      echo ""

           #*** Check if file exists, if not fail
           cat $lfile > /dev/null 2>&1
           error "File does not exist!"

           #*** Enter output destination
           einfo "Enter the output destination of the file you wish to convert:"
           echo "(Example: /home/user/movie.avi)"
           echo -n "? "
           read output
      echo ""

      #*** conversion
           mencoder ${lfile} \
            -ofps 23.976 \
            -oac mp3lame \
            -lameopts abr:br=64 \
             -ovc xvid \
            -xvidencopts pass=2:bitrate=250 \
            -o ${output} > /dev/null 2>&1 &
      spinna $!
                cat $output > /dev/null 2>&1
      error "mencoder failed (possibly no xvid support?)"
else
      eerror "What the fuck? You don't have mencoder!"
fi
   ;;
   17)
if [[ "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "1" || "${FFMPEG}" == "0" && "${MENCODER}" == "1" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "0" || "${FFMPEG}" == "0" && "${MENCODER}" == "1" && "${TRANSCODE}" == "1" ]] ; then
                #*** Enter the target file
                einfo "Enter the location and file you wish to convert:"
                echo "(Example: /home/user/movie.wmv)"
                echo -n "? "
                read lfile
                echo ""

                #*** Check if file exists, if not fail
                cat $lfile > /dev/null 2>&1
                error "File does not exist!"

                #*** Enter output destination
                einfo "Enter the output destination of the file you wish to convert:"
                echo "(Example: /home/user/movie.avi)"
                echo -n "? "
                read output
                echo ""

                #*** conversion
                mencoder ${lfile} \
                 -ofps 29.97 \
                 -oac mp3lame \
                 -lameopts abr:br=64 \
                 -ovc xvid \
                 -xvidencopts pass=2:bitrate=250 \
                 -o ${output} > /dev/null 2>&1 &
                spinna $!
                cat $output > /dev/null 2>&1
                error "mencoder failed (possibly no xvid support?)"
else
                eerror "What the fuck? You don't have mencoder!"
fi
   ;;
   18)
if [[ "${FFMPEG}" == "1" && "${MENCODER}" == "1" && "${TRANSCODE}" == "1" || "${FFMPEG}" == "0" && "${MENCODER}" == "0" && "${TRANSCODE}" == "1" || "${FFMPEG}" == "0" && "${MENCODER}" == "1" && "${TRANSCODE}" == "1" || "${FFMPEG}" == "1" && "${MENCODER}" == "0" && "${TRANSCODE}" == "1" ]] ; then
                #*** Enter the target file
                einfo "Enter the location and file you wish to convert:"
                echo "(Example: /home/user/movie.mpg)"
                echo -n "? "
                read lfile
                echo ""

                #*** Check if file exists, if not fail
                cat $lfile > /dev/null 2>&1
                error "File does not exist!"

                #*** Enter output destination
                einfo "Enter the output destination of the file you wish to convert:"
                echo "(Example: /home/user/movie.avi)"
                echo -n "? "
                read output
                echo ""

                #*** conversion
      transcode -i ${lfile} -o ${output} -y xvid > /dev/null 2>&1 &
                spinna $!
                cat $output > /dev/null 2>&1
                error "transcode failed (possibly no xvid support?)"
else
                eerror "What the fuck? You don't have transcode!"
fi
        ;;
   *)
      #*** Invalid number entered
      eerror Invalid Selection: \"$conversion\"
   ;;
esac


or: http://rafb.net/p/DwMOU563.html
_________________
IRC!: #zen-sources on irc.rizon.net
zen-kernel.org
--
Lost in android development land.
Back to top
View user's profile Send private message
jkomar
Apprentice
Apprentice


Joined: 24 Sep 2004
Posts: 192
Location: Calgary, Canada

PostPosted: Sun Nov 16, 2008 6:58 am    Post subject: Reply with quote

That looks really great. I'm going to have to give this a try.

Jason
_________________
www.jbox.ca
www.flashinthepan.ca
stormfront Portage/Paludis overlay
Back to top
View user's profile Send private message
Vorlon
Apprentice
Apprentice


Joined: 16 May 2003
Posts: 229
Location: West Grove, PA

PostPosted: Sat Oct 03, 2009 8:50 am    Post subject: Reply with quote

This script is great! Thanks!
_________________
Casey Bralla
Chief Nerd in Residence
The NerdWorld Organisation
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum