Posted By

Affix on 01/08/11


Tagged

ffmpeg


Versions (?)

AVI Converter


 / Published in: Bash
 

URL: http://affix.me

convert a directory of AVI files into mpegs

  1. #!/bin/bash
  2. #
  3. # run FFMPeg to convert a directory of AVI into mpeg
  4. #
  5.  
  6. args=("$@")
  7.  
  8. if [ -d ${args[0]} ]; then
  9. echo "Directory to be Converted : ${args[0]}"
  10. else
  11. echo "Directory ${args[0]} does not exist"
  12. exit;
  13. fi
  14.  
  15. if [ -d ${args[0]}/out ]; then
  16. echo "Output Directory : ${args[0]}/out"
  17. else
  18. echo "Creating output directory!"
  19. mkdir ${args[0]}/out
  20. echo "Output Directory : ${args[0]}/out"
  21. fi
  22.  
  23. for f in ${args[0]}/*
  24. do
  25.  
  26. if [ -d $f ]; then
  27. echo "Will not recurse into directory"
  28. else
  29. if [ "$f" == "*.avi" ]; then
  30. echo "Processing $f file..."
  31. ffmpeg -i $f -target pal-dvd -ps 2000000000 -aspect 16:9 ${args[0]}/out/$f.mpeg > /dev/null 2>&1
  32. else
  33. echo "$f is of invalid type!"
  34. fi
  35. fi
  36.  
  37. done

Report this snippet  

You need to login to post a comment.