Advertisement
Guest User

Untitled

a guest
Dec 9th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. #!/usr/bin/zsh
  2. # x265 encoding, two pass encoding makes quality better compared to single pass
  3. if ( [ "$1" = "-f" ] && [ "$2" = "x265" ] ) ; then
  4. # encode a video file
  5. if [ "$3" = "-i" ] ; then
  6. /usr/bin/ffmpeg -y -i "$4" -x265-params pass=1 -c:v libx265 -b:v 1900k -c:a libmp3lame -b:a 128k -f matroska /dev/null
  7. /usr/bin/ffmpeg -y -i "$4" -x265-params pass=2 -c:v libx265 -b:v 1900k -c:a libmp3lame -b:a 128k "${4:r}.mkv"
  8. # encode multiple *.VOB files
  9. else
  10. cat *.VOB | /usr/bin/ffmpeg -y -i - -c:v libx265 -b:v 2500k -c:a flac "{$4:r}.mkv"
  11. fi
  12. # theora encoding, q:v sets the constant video quality.
  13. elif ( [ "$1" = "-f" ] && [ "$2" = "theora" ] ) ; then
  14. # encode a video file
  15. if [ "$3" = "-i" ] ; then
  16. /usr/bin/ffmpeg -y -i "$4" -c:v libtheora -q:v 5 -c:a libvorbis -q:a 4 "${4:r}.mkv"
  17. # encode multiple *.VOB files
  18. else
  19. cat *.VOB | /usr/bin/ffmpeg -y -i - -c:v libtheora -q:v 7 -c:a flac "$(basename $(dirname $PWD)).mkv"
  20. fi
  21. # output a message error if no output codec was given
  22. elif ( [ "$1" != "-f" ] || [ "$2" != "x265" ] || [ "$2" != "theora" ] ) ; then
  23. echo "please specify codec and optional source."
  24. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement