Guest User

Untitled

a guest
Jun 21st, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. #!/usr/bin/env sh
  2.  
  3. # main.command
  4. # AutomatorFFmpeg
  5.  
  6. # Created by Laas Toom on 17.03.10.
  7. # Copyright (c) 2010 Laas Toom, All Rights Reserved.
  8. mypath=$(dirname $0)
  9.  
  10. if [[ -z "$ffmpeg_bin" ]]; then ffmpeg_bin=$(which ffmpeg); fi
  11. if [[ -z "$growl" ]]; then growl=$(which growlnotify); fi
  12. if [[ -z "$vcodec" ]]; then vcodec="copy"; fi
  13. if [[ -z "$acodec" ]]; then acodec="copy"; fi
  14. if [[ -z "$ofmt" ]]; then ofmt="mov"; fi
  15. if [[ -z "$output_dir" ]]; then output_dir=~/Desktop; fi
  16.  
  17. while read movie
  18. do
  19. if [[ -f "$movie" ]]
  20. then
  21. (
  22. base=$(basename "$movie")
  23. base="${base%.*}"
  24. ofile="$output_dir/$base".$ofmt
  25. $growl -H localhost --image "$mypath/ffmpeg.png" -s -d "$base" -m "AutomatorFFmpeg: Transcoding: $movie to $ofmt ..."
  26. ls -la "$movie"
  27. # somehow ffmpeg steals the input of this shell and so we have to fake input to ffmpeg
  28. echo "" | $ffmpeg_bin -i "$movie" -vcodec $vcodec -acodec $acodec "$ofile"
  29. # Touch the new file to preserve dates
  30. touch -r "$movie" "$ofile"
  31. test -f $growl && $growl -H localhost --image "$mypath/ffmpeg.png" -d "$base" -m "AutomatorFFmpeg: Transcoding: $movie ... Done"
  32. echo "$ofile"
  33. ) > /dev/null 2>&1
  34. fi
  35. done
  36. test -f $growl && $growl -H localhost --image "$mypath/ffmpeg.png" -m "AutomatorFFmpeg: All Done"
Add Comment
Please, Sign In to add comment