Advertisement
constantin-net

p2webm

Oct 2nd, 2018
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.84 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. height=""
  4.  
  5. if [[ -z "$1" ]]; then
  6.     echo "picture height music length start"
  7.     exit
  8. fi
  9.  
  10. if [[ -n "$2" ]]; then
  11. #    height="-vf scale -2:$2"
  12.     height="-vf scale=trunc(oh*a/2)*2:$2"
  13. else
  14.     height="";
  15. fi
  16.  
  17. if [[ -n "$5" ]]; then
  18.     start_time="-ss $3"
  19. else
  20.     start_time="-ss 0:00";
  21. fi
  22.  
  23. if [[ -n "$4" ]]; then
  24.     length="-t $4"
  25. else
  26.     length="";
  27. fi
  28.  
  29. if [[ "${1##*.}" == "gif" ]]; then
  30.     ffmpeg -ignore_loop 0 $start_time $length -i "$1" -i "$3" -map 0:v -map 1:a -acodec libvorbis -vcodec libvpx -b:v 200K -b:a 144k -pix_fmt yuv420p -shortest -metadata title="$3" "$3".webm
  31.     exit
  32. fi
  33.  
  34. ffmpeg -r 1 -loop 1 $start_time $length -i "$1" -i "$3" -map 0:v -map 1:a -acodec libvorbis -vcodec libvpx -b:v 0 -crf 16 -g 360 $height -pix_fmt yuv422p10le -shortest -metadata title="$3" "$3".webm
  35.  
  36. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement