Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 17th, 2012  |  syntax: None  |  size: 0.45 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/sh
  2.  
  3. if [ $# != 1 ]
  4. then
  5.     echo 'syntax)' `basename $0` '<movie>'
  6.     exit
  7. fi
  8.  
  9. target=$1
  10. base=`echo $target | sed -e 's@\.[a-z0-9]*$@@g'`
  11. fmt=`ffprobe -i "$target" 2>&1| grep Audio: | sed -e 's@.*Audio: \([a-z0-9]*\) .*@\1@g'`
  12.  
  13. ffmpeg -i "$target" -map 0:1 -codec copy "$target.$fmt"
  14. cname="$target.$fmt"
  15.  
  16. if [ "$fmt" == "aac" ]
  17. then
  18.     MP4Box -add "$cname" "$target.m4a"
  19.     rm "$cname"
  20.     cname="$target.m4a"
  21.     fmt="m4a"
  22. fi
  23.  
  24. mv "$cname" "$base.$fmt"