Guest User

Untitled

a guest
Dec 17th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. ##!/bin/bash
  2. set -u
  3. #
  4. # <input VOB directory> <output filename>
  5. #
  6. #-----------------------------------------------------------------
  7. # get a list of all the VOBS, exluding the menu - VTS_xx_0.VOB
  8. vobs_list=$(find "${1}" -type f -name 'VTS_[0-9][0-9]_[1-9].VOB' | sort)
  9.  
  10. # check if any VOB files found
  11. if [[ -z ${vobs_list} ]]
  12. then
  13. echo "${movie_path} : No VOB files found"
  14. return 1
  15. fi
  16.  
  17. #-----------------------------------------------------------------
  18. # set the file separator to newline to for the list of vobs
  19. oIFS="${IFS}"
  20. IFS=$'\n'
  21.  
  22. #--------------------------FFMPEG---------------------------------------
  23. # -map 0 // to capture all streams
  24. # -map -dn // ignore all data channels (used for dvd menus?), (prevents ffmpeg error)
  25. # -c:v libx264 // video encoding to h264
  26. # -crf 18 // video, almost loss-less
  27. # -c:a copy // copy audio stream as is
  28. # -c:s copy // copy subtitle stream as is
  29. # -preset fast // best output file size (compression ratio) in reasonable
  30. # -analyzeduration 50M -probesize 50M // to make sure subtitle is found correctly
  31.  
  32. TIMEFORMAT='Elapsed time %R seconds'
  33. time {
  34. cat ${vobs_list} | \
  35. ffmpeg \
  36. -y \
  37. -analyzeduration 50M \
  38. -probesize 50M \
  39. -i - \
  40. -map 0 \
  41. -map -dn \
  42. -c:v libx264 \
  43. -c:a copy \
  44. -c:s copy \
  45. -preset fast \
  46. -crf 18 \
  47. "${2}"
  48. exit_status=$?
  49. }
  50.  
  51. #-----------------------------------------------------------------
  52. # reset the file separator to original
  53. IFS="${oIFS}"
Add Comment
Please, Sign In to add comment