Guest User

Untitled

a guest
Jan 22nd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  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 -acodec copy -i "$target" "$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"
Add Comment
Please, Sign In to add comment