Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env sh
- # main.command
- # AutomatorFFmpeg
- # Created by Laas Toom on 17.03.10.
- # Copyright (c) 2010 Laas Toom, All Rights Reserved.
- mypath=$(dirname $0)
- if [[ -z "$ffmpeg_bin" ]]; then ffmpeg_bin=$(which ffmpeg); fi
- if [[ -z "$growl" ]]; then growl=$(which growlnotify); fi
- if [[ -z "$vcodec" ]]; then vcodec="copy"; fi
- if [[ -z "$acodec" ]]; then acodec="copy"; fi
- if [[ -z "$ofmt" ]]; then ofmt="mov"; fi
- if [[ -z "$output_dir" ]]; then output_dir=~/Desktop; fi
- while read movie
- do
- if [[ -f "$movie" ]]
- then
- (
- base=$(basename "$movie")
- base="${base%.*}"
- ofile="$output_dir/$base".$ofmt
- $growl -H localhost --image "$mypath/ffmpeg.png" -s -d "$base" -m "AutomatorFFmpeg: Transcoding: $movie to $ofmt ..."
- ls -la "$movie"
- # somehow ffmpeg steals the input of this shell and so we have to fake input to ffmpeg
- echo "" | $ffmpeg_bin -i "$movie" -vcodec $vcodec -acodec $acodec "$ofile"
- # Touch the new file to preserve dates
- touch -r "$movie" "$ofile"
- test -f $growl && $growl -H localhost --image "$mypath/ffmpeg.png" -d "$base" -m "AutomatorFFmpeg: Transcoding: $movie ... Done"
- echo "$ofile"
- ) > /dev/null 2>&1
- fi
- done
- test -f $growl && $growl -H localhost --image "$mypath/ffmpeg.png" -m "AutomatorFFmpeg: All Done"
Add Comment
Please, Sign In to add comment