Advertisement
howtophil

movies2mp3s.sh

Jan 30th, 2022
1,193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.67 KB | None | 0 0
  1. #!/bin/bash
  2. # This script converts a movie file into mp3s of apx 10 minutes long
  3. # each to make listening to movies/shows on the go with mp3 players
  4. # easier. You can adjust the 10 minutes to a length that works for
  5. # you.
  6. #
  7. # ./movie2mp3s.sh "FILENAME"
  8. #
  9.  
  10. # Get the basename of the file passed to this script for later use
  11. fname=$(basename "$1")
  12.  
  13. # convert the movie into one big mp3
  14. ffmpeg -i "$1" -vn -acodec libmp3lame -ac 2 -ab 160k -ar 48000 "$fname.mp3"
  15.  
  16. # split the mp3 into smaller segments to make
  17. # skipping around easier
  18. mp3splt -a -t 10.00 "$fname.mp3"
  19.  
  20. # Remove the big mp3
  21. rm "$fname.mp3"
  22.  
  23. # Move the small mp3s into a folder
  24. mkdir "$fname-audio"
  25. mv *.mp3 "./$fname-audio"
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement