howtophil icon

movies2mp3s.sh

howtophil | PRO | 01/31/22 03:08:17 AM UTC | 0 ⭐ | 1571 👁️ | Never ⏰ | []
Bash |

670 B

|

None

|

0 👍

/

0 👎

#!/bin/bash
# This script converts a movie file into mp3s of apx 10 minutes long
# each to make listening to movies/shows on the go with mp3 players
# easier. You can adjust the 10 minutes to a length that works for 
# you.
#
# ./movie2mp3s.sh "FILENAME"
#
 
# Get the basename of the file passed to this script for later use
fname=$(basename "$1")
 
# convert the movie into one big mp3
ffmpeg -i "$1" -vn -acodec libmp3lame -ac 2 -ab 160k -ar 48000 "$fname.mp3"
 
# split the mp3 into smaller segments to make
# skipping around easier
mp3splt -a -t 10.00 "$fname.mp3"
 
# Remove the big mp3
rm "$fname.mp3"
 
# Move the small mp3s into a folder
mkdir "$fname-audio"
mv *.mp3 "./$fname-audio"
 

Comments