Advertisement
Guest User

Soundpost Conversion (By Pankophile)

a guest
Apr 16th, 2025
30
0
361 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. echo -e "Usage: this-script.sh <soundpost>"
  4.  
  5. soundpost=$1
  6. soundpostfilename=${soundpost##*'/'}
  7. afterdot=${soundpostfilename##*'.'}
  8. name=${soundpostfilename%%'['*}
  9. beforebracket=${soundpostfilename%%']'*}
  10. soundsource=${beforebracket##*'['}
  11. link=$(echo "$soundsource" | tail -c +7 | sed 's|%2F|/|g')
  12. sourceafterdot=${link##*'.'}
  13. soundfile="/tmp/soundsource.$sourceafterdot"
  14.  
  15. echo "Sound source located as $link"
  16.  
  17. wget "$link" -O "$soundfile"
  18.  
  19. if [ "$afterdot" == "gif" ]; then
  20. ffmpeg -stream_loop -1 -i "$soundpost" -i "$soundfile" -shortest -c:v libvpx-vp9 -c:a libopus "$name.webm"
  21. elif [ "$afterdot" == "png" ] || [ "$afterdot" == "jpeg" ] || [ "$afterdot" == "jpg" ]; then
  22. ffmpeg -i "$soundpost" -i "$soundfile" -c:a libopus "$name.webm"
  23. else
  24. ffmpeg -i "$soundpost" -i "$soundfile" -c:v copy -c:a libopus "$name.$afterdot"
  25. fi
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement