![]() ![]() |
Jul 10 2006, 08:56 PM
Post
#1
|
|
![]() Group: Members Posts: 21 Joined: 8-December 05 Member No.: 8,686 |
It's been a while since I posted my first encoding video for the Zaurus script, so here's an updated Version 2 of it. Enjoy.
CODE #!/bin/sh # Declare some variables INFILE=$1 OUTFILE=$2 WIDTH=640 HEIGHT=480 # Check for input video. if [ -z "$1" ] then echo "#########################" echo "# ERROR! NO INPUT FILE. #" echo "#########################" echo echo "Usage" echo -------------------- echo "$0 INPUT OUTPUT width_option height_option" echo echo "Example" echo -------------------- echo "$0 Funny_Clip.avi Funny_Clip_Resized.avi 320 240" exit fi # Check for output file name. if [ -z "$2" ] then echo "##########################" echo "# ERROR! NO OUTPUT FILE. #" echo "##########################" echo echo "Usage" echo -------------------- echo "$0 INPUT OUTPUT width height" echo echo "Example" echo -------------------- echo "$0 Funny_Clip.avi Funny_Clip_Resized.avi 320 240" exit fi # Change to custom height and width if [ -n "$3" ] then WIDTH=$3 fi if [ -n "$4" ] then HEIGHT=$4 fi # Print some information echo Video Encoding for Sharp Zaurus Playback echo By Vrejakti echo http://www.lan358.com echo echo echo "Default 640x480" echo "Full screen [4:3] use 640x480 [default]." echo "Wide screen [16:9] use 640x360." echo -------------------- echo " Input: $1" echo " Output: $2" echo " Width: $WIDTH" echo " Height: $HEIGHT" echo -------------------- # Check responce echo "Is this correct? [Yes/No] " read answer # VERY USEFUL CODE: This accepts "Yes", "yes", "Y", and "y". if [ $answer == "Yes" ] || [ $answer == "yes" ] || [ $answer == "Y" ] || [ $answer == "y" ] then # Start mencoder magic mencoder "$INFILE" -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=300:vpass=1 -lameopts cbr:br=64:mode=3 -vf scale=$WIDTH:$HEIGHT -oac mp3lame -o $OUTFILE mencoder "$INFILE" -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=300:vpass=2 -lameopts cbr:br=64:mode=3 -vf scale=$WIDTH:$HEIGHT -oac mp3lame -o $OUTFILE echo "Converted file is $OUTFILE" else echo "Encoding canceled!!!" fi Please post any suggestions for improvements. I'm still learning how to write bash scripts, so there's bound to be room for improvement. -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- Edit notes: *shudder* The above is version 2, that is more of a proof of concept. I'm posting version 4.0 below for a side by side comparison. i) Script is easier to run. Install it as vrecoder to /usr/local/bin then run `vrecoder -i AVI_File' ii) All options have been added as switches. See `vrecoder -h' for the details. iii) The `-a' switch attempts to resize your video keeping the correct aspect ratio. iv) `-s' uses an experimental smartcoder that will encode every AVI file in the current directory. CODE #!/bin/bash # Encoding Video for Zaurus Playback # Script version 4.5 # Attributions: # Vrejakti LAN358 Inc, http://lan358.com: Head Developer # XorA Open Zaurus Project: Produced original mpencoder code # Da_Blitz OESF Forums: additional mencoder code, and shell code # Xamindar OESF Forums: feature suggestions MAX_WIDTH="640" # Default max width WIDTH="640" # Default width HEIGHT="480" # Default height encoder="vrecoder" # Default encoder BITRATE="600" # Default quality / bit rate CODEC="mpeg4" # Default codec help () { cat << EOF vrecoder: Video Encoding for Sharp Zaurus Playback Usage: vrecoder [-h] [-a] [-s] [-i infile] [-o outfile] [-x size] [-y size] [-b bitrate] -h, Display this help menu -a, Auto calculate resized video resolution -s, Use smartcoder -i, Input File -o, Output File -x, Change width -b, Change bitrate. 300 default, 6000 would be smooth -y, Change height --quick No confirms, jump to encoding. :: Encoders :: vrecoder: Default encoder. Works on a signle input file. smartcoder: Experimental encoder. Atempts to encode every AVI file in the current directory. :: Notes :: [-a] depends on awk >= 3.1.5, file >= 4.3.0, grep >= 2.5.1. Use at your own risk. [-s] depends on file >= 4.18, find >= 4.3.0. Use at your own risk. EOF exit } if [ -z "$1" -o "$1" = "-h" ] then help fi for ARG in $@; do case $ARG in -x) WIDTH="$2"; shift;; -y) HEIGHT="$2"; shift;; -i) IN="$2"; shift;; -o) OUT="$2"; shift;; -a) autores="yes"; shift;; -b) BITRATE="$2"; shift;; -s) encoder="smartcoder"; shift;; --quick) rush="x"; shift;; *) shift;; esac done if [ "$encoder" == "vrecoder" ] then if [ -z "$IN" ] then printf "Whoops! No input found. Did you forget to input a file with -i file.avi?\n" exit fi fi if [ -z "$OUT" ] then OUT="Zaurus-"$IN"" # /* # * Why is this switch true when -i is a complex file name? # */ fi if [[ "$encoder" == "smartcoder" ]] then rush="x" fi if [[ "$rush" == "x" ]] then answer="yes" else #####calculate res############################# case "$autores" in "Yes" | "yes" | "Y" | "y" ) # /* # * Anyone have a suggestion # * how to better impliment this function? # */ printf "Enter screen width (ie. 640): " read MAX_WIDTH height=`file $IN | awk -F, '{print $3}' | awk -F" " '{print $1}'` width=`file $IN | awk -F, '{print $3}' | awk -F" " '{print $3}'` first="$[$width*100/$height]" # fake float second="$[$MAX_WIDTH*$first/100]" # restore int WIDTH="$MAX_WIDTH" HEIGHT="$second" ;; esac ############################################### echo echo "Please confirm:" echo "------------------------------" echo " Input: $IN" echo " Output: $OUT" echo " Width: $WIDTH" echo " Height: $HEIGHT" echo " Encoder: $encoder" echo " Bitrate: $BITRATE" echo "------------------------------" printf "Start encoding? [Yes/No] " read answer fi ####functions################################## function vrecoder () { mencoder "$IN" -ovc lavc -lavcopts vcodec=$CODEC:\ vbitrate=$BITRATE:vpass=1 -vf scale=$WIDTH:$HEIGHT -oac copy -o "$OUT" #-------------------- mencoder "$IN" -ovc lavc -lavcopts vcodec=$CODEC:\ vbitrate=$BITRATE:vpass=2 -vf scale=$WIDTH:$HEIGHT -oac copy -o "$OUT" } function smartcoder () { i=1 while read "F" do T=$(file -zibkp "$F") if [[ $T == 'video/x-msvideo' ]] then OUT="Zaurus-"$F"" # mencoder "$F" -ovc lavc -lavcopts vcodec=$CODEC:vbitrate=\ # $BITRATE:vpass=1 -vf scale=$WIDTH:$HEIGHT -oac copy -o "Output_"$F"" # mencoder "$F" -ovc lavc -lavcopts vcodec=$CODEC:vbitrate=\ # $BITRATE:vpass=2 -vf scale=$WIDTH:$HEIGHT -oac copy -o "Output_"$F"" mencoder "$F" -ovc lavc -lavcopts vcodec=$CODEC:\ vbitrate=$BITRATE:vpass=1 -vf scale=$WIDTH:$HEIGHT -oac copy -o "$OUT" #-------------------- mencoder "$F" -ovc lavc -lavcopts vcodec=$CODEC:\ vbitrate=$BITRATE:vpass=2 -vf scale=$WIDTH:$HEIGHT -oac copy -o "$OUT" # /* # * Can someone please tell me the difference between the commented lines # * and the uncommented lines? # */ i=$[$i+1] fi done < <(find -maxdepth 1 -printf "%f\n") } ####/functions################################# ####main####################################### case "$answer" in "Yes" | "yes" | "Y" | "y" ) $encoder printf "\nEncoding completed at `date`\n" exit;; "op" ) printf "Minutes: [hh:mm:ss] " read minutes mencoder "$IN" -ovc lavc -lavcopts vcodec=$CODEC:vbitrate=\ $BITRATE -vf scale=$WIDTH:$HEIGHT -oac copy -endpos \ $minutes -o "$OUT" exit;; esac ############################################### printf "\nEncoding has been cancled.\n" Todo: Fix script so everything will work on complex file names as well as normal file names. Have script work on each file on the command line, not just the one file included with the `-i' switch. Replace experimental code with real portable code. Rewrite the entire script in x86 ASM using mencoder shared libraries. (Yeah right. ;-) ) |
|
|
|
Jul 11 2006, 12:31 AM
Post
#2
|
|
![]() Group: Members Posts: 1,565 Joined: 7-April 05 From: Sydney, Australia Member No.: 6,806 |
have you tried making moives with org vorbis, i am thinking that it might be worth trying out the integer decoding on the Z and see how it compares to libmad
i havent been into the video encoding scene in awhile but i belive that some of the other formats may be more Z friendly. i hear one of the design goals of mkv was fast seeking just some sugestions. i dont have the time to fiddle with video encoding at the moment and i dont watch videos on my Z but i wonder if we can get some more performance out of these little things by changing somthing so slightly |
|
|
|
Jul 11 2006, 01:20 AM
Post
#3
|
|
![]() Group: Members Posts: 21 Joined: 8-December 05 Member No.: 8,686 |
QUOTE(Da_Blitz @ Jul 11 2006, 02:31 AM) have you tried making moives with org vorbis, i am thinking that it might be worth trying out the integer decoding on the Z and see how it compares to libmad i havent been into the video encoding scene in awhile but i belive that some of the other formats may be more Z friendly. i hear one of the design goals of mkv was fast seeking just some sugestions. i dont have the time to fiddle with video encoding at the moment and i dont watch videos on my Z but i wonder if we can get some more performance out of these little things by changing somthing so slightly Hmm, hmm... to be honest, I have very little knowledge on the actual mencoder settings. You are absolutely right, the mencoder settings I have can be tweaked for much better performance. I think MKV support under Linux is still in developing stages [It wasn't until four months ago mplayer with mkv support enabled would emerge under Gentoo], but if it can be done, I'll happily make it the default in my next update. I'm also thinking I'll add the option to customize most encoding settings as part of running the script. |
|
|
|
Jul 11 2006, 01:46 AM
Post
#4
|
|
![]() Group: Members Posts: 1,565 Joined: 7-April 05 From: Sydney, Australia Member No.: 6,806 |
i would say that mkv is bleeding edge in linux, i use it for most of the files i "aquire"
i might take a look in an hour or two as i have to do some video encoding soon and might be able to teweak it a bit but i think that some benchmarks at diffrent bitrates for payback of aac, mp3 and org are in oder, lets say 96, 128 and 192kbps, 2 channel 16 bit audio, with both abr (average bit rate, normally confused with varible bit rate) and cbr (constant bit rate) perhaps set up a script that encodes one file to all 3 formats at all 3 bit rates, then take it to the z and have another script run CODE #!/bin/bash then post the results as that will tell us what is happening cpu wise
TEMP=$(date) for I in *.[aac|mp3|ogg]; do time mplayer $I >| benchmark-$TIME ;done echo done |
|
|
|
Jul 11 2006, 12:16 PM
Post
#5
|
|
|
Group: Members Posts: 129 Joined: 29-May 04 Member No.: 3,485 |
QUOTE(Da_Blitz @ Jul 11 2006, 11:46 AM) [...] i think that some benchmarks at diffrent bitrates for payback of aac, mp3 and org are in oder, lets say 96, 128 and 192kbps, 2 channel 16 bit audio, with both abr (average bit rate, normally confused with varible bit rate) and cbr (constant bit rate) While it's over a year old and was originally in a different context, a posting I wrote lays down the basic observations I have made w/regard to A/V-encoding and playback in the many days I have tinkered with it. It should still hold true today, and while I haven't done any specific benchmarking for quite some time now, there is nothing that indicates otherwise. Maybe this can give you some idea of what to expect. Best regards, Chris. |
|
|
|
Jul 11 2006, 12:40 PM
Post
#6
|
|
![]() Group: Members Posts: 803 Joined: 30-March 04 From: California Member No.: 2,368 |
BTW, what's this "org" you guys are talking about? Is it some new variation of "ogg"?
I used to have ogg encoded videos run on my 5600 but when I tried those same videos on my 3100 with kino2 they would not play. Has ogg support been removed? |
|
|
|
Jul 11 2006, 09:19 PM
Post
#7
|
|
![]() Group: Members Posts: 1,565 Joined: 7-April 05 From: Sydney, Australia Member No.: 6,806 |
yeah we are talking about ogg
had a quick read and it probelly does still hold true today. i would still like to see a retest just to confirm everything (just in case they improved the code) you do have some good points there. i use to cut the framerate in half for animation as it would improve things alot. i did notice that setting up your processing filters and changing the order has a huge impact of performance the order i would do it in was deinterlace denoise crop shrink rotate that gives the best visual results but takes longer to do than other orders of post processing is there a guide around here to what the maximum video capabilities of each model are. could be handy and allow us to chose several diffirnt profile (ie c700 low, med, high and c3000 low medium high) i heard MKV has support for varible frame rates. for animation this could be handy due to the high amount of static images in some animaiton. in others the difrence between the frames is small enough that it should encode to be tiny anyway |
|
|
|
Jul 16 2006, 07:26 PM
Post
#8
|
|
![]() Group: Members Posts: 28 Joined: 10-December 05 Member No.: 8,697 |
QUOTE(vrejakti @ Jul 11 2006, 01:20 AM) I think MKV support under Linux is still in developing stages [It wasn't until four months ago mplayer with mkv support enabled would emerge under Gentoo], but if it can be done, I'll happily make it the default in my next update. Its funny that mkv is still perceived as the bleeding edge. Someone else mentioned AAC audio, which is considerably newer than the mkv project. That format just been pushed everywhere and implemented in many things, so it seems less bleeding edge. About the video encoding this, I would be interested if anyone has comments about the ogg media container (OGM) and vorbis audio in their videos for the Zaurus series. That script looks rather handy. I will probably write a similar script that can use Avidemux to encode videos.... |
|
|
|
Jul 16 2006, 11:07 PM
Post
#9
|
|
![]() Group: Members Posts: 1,565 Joined: 7-April 05 From: Sydney, Australia Member No.: 6,806 |
i have been getting alot of stuff with subtitles and multitrack audio in the mkv format. the reason i say its bleeding edge is because they are still extening (or mabey not. havent looked at it scince i went from winCE to lin and left betaplayer behind)
i have used OGM on windows and found the ffmpeg stuff rather poorley intergrated (sits next to the clock) however its good under linux. i think we will probelly end up with ogg audio, must do some testing tomorrow |
|
|
|
Jul 17 2006, 01:01 PM
Post
#10
|
|
![]() Group: Members Posts: 803 Joined: 30-March 04 From: California Member No.: 2,368 |
Great script vrejakti! Thanks. It makes videos that play the best I have seen on my zaurus.
I have an idea. Is it possible to just specify the width, for example 640, and then have the height automaticly set according to the aspect ratio of the input video? It seems a few of my videos have strange aspect so I have to open them up in xine, check the aspect, then calculate it myself. And sense I am never interested in streching the video this would be very usefull. You know what I mean? W/640=H/h where: W= original width 640= new width H= Original height h= new height |
|
|
|
Sep 10 2006, 11:24 PM
Post
#11
|
|
![]() Group: Members Posts: 21 Joined: 8-December 05 Member No.: 8,686 |
Hey everyone, I have some free time, so I'll be re-writing this script to add the option of custimizing the video and audio formate easily. I was going to post an updated script... a couple months ago
If anyone can explain how mencoder chooses the video codex and/or audio codex, I'd be happy to write a script that includes all the options you can provide me. Well, I'd like to keep my development code secret, but here's what we're looking at for the next script: CODE # Declare some variables INFILE=$1 OUTFILE=$2 WIDTH=640 HEIGHT=480 AUDIO=mp2 VIDEO=lavc VIDEO_CODEC=mpeg4 echo Choose an audio codec echo "[mp2] // MPEG Layer 2" echo "[ac3] // AC3, AKA Dolby Digital" echo "[adpcm_ima_wav] // IMA adaptive PCM (4 bits per sample, 4:1 compression)" echo "[sonic] // experimental lossy/lossless codec" # Start mencoder magic #mencoder "$INFILE" -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=300:vpass=1 -lameopts cbr:br=64:mode=3 -vf scale=$WIDTH:$HEIGHT -oac copy -o $OUTFILE #mencoder "$INFILE" -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=300:vpass=2 -lameopts cbr:br=64:mode=3 -vf scale=$WIDTH:$HEIGHT -oac mp3lame -o $OUTFILE mencoder "$INFILE" -ovc $VIDEO -lavcopts vcodec=$VIDEO_CODEC:vbitrate=300:vpass=1 -lameopts cbr:br=64:mode=3 -vf scale=$WIDTH:$HEIGHT -oac lavc -lavcopts acodec=$AUDIO -o $OUTFILE mencoder "$INFILE" -ovc $VIDEO -lavcopts vcodec=$VIDEO_CODEC:vbitrate=300:vpass=2 -lameopts cbr:br=64:mode=3 -vf scale=$WIDTH:$HEIGHT -oac lavc -lavcopts acodec=$AUDIO -o $OUTFILE All I need is some options to code in for $VIDEO_CODEC and $AUDIO. I wish it was as simple as VIDEO_CODEC=mkv AUDIO=ogg - it seems a fair bit more complicated. |
|
|
|
Sep 10 2006, 11:34 PM
Post
#12
|
|
![]() Group: Members Posts: 21 Joined: 8-December 05 Member No.: 8,686 |
QUOTE(xamindar @ Jul 17 2006, 03:01 PM) Great script vrejakti! Thanks. It makes videos that play the best I have seen on my zaurus. I have an idea. Is it possible to just specify the width, for example 640, and then have the height automaticly set according to the aspect ratio of the input video? It seems a few of my videos have strange aspect so I have to open them up in xine, check the aspect, then calculate it myself. And sense I am never interested in streching the video this would be very usefull. You know what I mean? W/640=H/h where: W= original width 640= new width H= Original height h= new height Thanks xamindar. I have the formual A/B = C, B*C=A written on my wall so I always remember how to calculate the right ratio. *laughs* Might as well code that math into the next script. I'll see what I can do. ^^ |
|
|
|
Sep 10 2006, 11:43 PM
Post
#13
|
|
![]() Group: Members Posts: 1,565 Joined: 7-April 05 From: Sydney, Australia Member No.: 6,806 |
i belive that mencoder has settings to adjust it automajically, but i have had problems when applying it to DVDs
if you want some help, email me and i will see what i can do |
|
|
|
Sep 11 2006, 04:26 PM
Post
#14
|
|
![]() Group: Members Posts: 21 Joined: 8-December 05 Member No.: 8,686 |
If you guys liked my first scripts, you're going to LOVE this one! I simplified the heck out of it, and the auto resolution calculation works so nicely.
All you have to do is type ./script video.avi Yes Yes And it does the rest. :-D CODE #!/bin/sh
# Encoding Video for Zaurus Playback # Script version 3 # Attributions: # # Vrejakti of LAN358 Inc (http://lan358.com): Main contributor of Bash code # XorA of the Open Zaurus Project: Produced original mencoder code # Da_Blitz from OESF Forums: Provided additional mencoder code # Xamindar from OESF Forums: Provided feature suggestions # Declare some variables INFILE=$1 OUTFILE=Zaurus-$1 WIDTH=640 HEIGHT=480 AUDIO=mp2 VIDEO=lavc VIDEO_CODEC=mpeg4 #-------------------- ERROR1="######################### # ERROR! NO INPUT FILE. # ######################### (Usage) $0 INPUT OUTPUT width_option height_option -------------------- (Ex) $0 Funny_Clip.avi 320 240\n" #-------------------- # Check for input video. if [ -z "$1" ] then printf "$ERROR1" exit fi # Change to custom height and width if [ -n "$2" ] then WIDTH=$2 fi if [ -n "$3" ] then HEIGHT=$3 fi # Print some information printf "Video Encoding for Sharp Zaurus Playback\n\n" printf "Would you like to use experimental auto resolution calculation? [Yes/No] " read custom case "$custom" in "Yes" | "yes" | "Y" | "y" ) height=`file $INFILE | gawk -F, '{print $3}' | gawk -F" " '{print $1}'` width=`file $INFILE | gawk -F, '{print $3}' | gawk -F" " '{print $3}'` first="$[$width*100/$height]" second="$[640*$first/100]" WIDTH=640 HEIGHT=$second ;; esac #-------------------- #-------------------- MAGIC1="mencoder "$INFILE" -ovc $VIDEO -lavcopts vcodec=$VIDEO_CODEC:vbitrate=300:vpass=1 -lameopts cbr:br=64:mode=3 -vf scale=$WIDTH:$HEIGHT -oac lavc -lavcopts acodec=$AUDIO -o $OUTFILE" #-------------------- MAGIC2="mencoder "$INFILE" -ovc $VIDEO -lavcopts vcodec=$VIDEO_CODEC:vbitrate=300:vpass=2 -lameopts cbr:br=64:mode=3 -vf scale=$WIDTH:$HEIGHT -oac lavc -lavcopts acodec=$AUDIO -o $OUTFILE" #-------------------- #-------------------- echo "Full screen [4:3] use 640x480 [default]." echo "Wide screen [16:9] use 640x360." echo -------------------- echo " Input: $INFILE" echo " Output: $OUTFILE" echo " Width: $WIDTH" echo " Height: $HEIGHT" echo " Audio Codec: $AUDIO" echo " Video Codec: $VIDEO_CODEC" echo -------------------- echo " First mendoder command: $MAGIC1" echo -------------------- echo " Second mencoder command: $MAGIC2" # One last chance to bail out printf "\nStart encoding? [Yes/No] " read answer # Start mencoder magic case "$answer" in "Yes" | "yes" | "Y" | "y" ) $MAGIC1 $MAGIC2 printf "\n\nConverted file is $OUTFILE" exit;; esac printf "\nEncoding has been cancled.\n" |
|
|
|
Sep 12 2006, 05:35 AM
Post
#15
|
|
![]() Group: Members Posts: 1,565 Joined: 7-April 05 From: Sydney, Australia Member No.: 6,806 |
got your email and am looking into the mkv stuff
however i dont mean to cast your work in a bad light but here is some code i whipped up quickly (still needs to be debugged and finnished). at the moment its just the setup code however it might be handy to you as it is Featuers: Easy to maintian command line parsing built in help profile support to quickly encode diffrent files in diffrent ways (for example decimate the framrate by 2 and apply the xvid cartoon settings for anime) ability to override built in varibles from the command line to assist in testing and activate advanced features (-o <somthing>=<val>) supports config files (user and system) rotation support (any angle) Multiple file support (even when only one file is specified, this is so there are no special hacks for multipass files and so that they can be treated in the same manner as single pass) planned features: accept files as command line args or as part of a pipe (INFILE="-") CODE # Copyright: Jay Coles 2006 # Licsence: GPL v2 # Version 0.9 # ######## Cut and paste from here into config file ########## # ***** File Vars ******* ENCODER=mencoder # File to be converted INFILE="" # Save file as OUTFILE="" # ****** Encoding Vars ****** # nice easy policys for encoding diffrent media # added because it was easy to hack together :) # note that you might want to add a policy_ to the # front of your funtions to avoid clobbering # the internal code POLICY=policy_anime policy_anime() { V_CODEC="xvid" A_CODEC="mp3" V_BITRATE="300" A_BITRATE="96" #Diffrent encoding policies (ie cbc abr vbr multipass) V_POLICY="multipass" A_POLICY="cbr" # allow recording at diffrent rates/fps # this really helps with anime by decimating the fps # by 2, allows for huge reductions in size with a small # loss in percived quality (ie motion is slightly more # jagged) V_RATE="0.5" A_RATE="22050" # Allow overiding of ratio blank for keep original RATIO="" KEEP_RATIO="y" # Note that these are max vals that will never be exceeded # while still maintiaining asspect ratio X_RES="640" Y_RES="480" #Amount of degrees to rotate video (helps increse performance) ROTATION=90 } ################ End cut and paste ################ if [ -f /etc/zencoder.conf ]; then . /etc/zencoder.conf fi if [ -f ~/zencoder.conf ]; then . ~/zencoder.conf fi # Auto sources Policy $POLICY help () { cat << EOF zencoder: encodes moives for small media players Usage: zencoder [-h | --help] [-o <VAR NAVE>=<VAL>] [-a <audio codec>] [-v <video codec>] [-b <video bitrate] [-d <audio bitrate>] [-x <res>] [-y <res>] [-r <rotation>] INFILE [-f OUTFILE] -h --help This menu -o Allows you to overide built in varibles Mainly for testing -a <audio codec> The audio codec used to encode the audio use help for an abreaveated listing -v <video codec> The video cadec used to encode the video use help for an abreaveated listing -b <video bitrate> The bitrate used to encode the video -d <audio bitrate> the bitrate used to encode the audio -x <res> The max X resolution -y <res> The max Y resolution -r <rotation> The angle to rotate the video output INFILE The file to be processed -f <OUTFILE> The name to call the compleated file, Note that if not specified then it is Automatically detirmined from the video codec EOF exit } if [ "$1" = "-h" -o "$1" = "--help" ]; then help fi for ARG in $@; do case $ARG in -o) $ARG; shift;; -a) A_CODEC=$ARG; shift;; -v) V_CODEC=$ARG; shift;; -b) V_BITRATE=$ARG; shift;; -d) A_BITRATE=$ARG; shift;; -x) X_RES=$ARG; shift;; -y) Y_RES=$ARG; shift;; -r) ROTATION=$ARG; shift;; -f) OUTFILE=$ARG; shift;; *) FILES="$FILES $ARG"; shift;; esac done for I in $FILES; do test -f $I || echo "File: $I dosent exist, bailing out" && exit 1 done # note that we pass FILES in a loop to the var INFILE and process in # the loop locally as INFILE enjoy, hopefull i should be about 80% compleate tommorrow on it (and actually have files encoding with it), also wont be that hard to get it to just do audio encoding (ie audio CD to mp3 aka ripping, specify INFILE as cdda://1) *** edit added file as the CODE statement on the fourms clobbers the formatting ***** edit this fourm dosent like files with no extension or the .sh extension, sorry about the tar.gz'ing, i relise the tar is unnecsarry (blame gnome
Attached File(s)
|
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 25th May 2013 - 12:57 PM |