A Python program that splits mp3 files from YouTube albums into individual songs.
- Python 2.7+
- ffmpeg
You need to have Python 2.7+ and ffmpeg installed.
Useful links:
-
Install Python and ffmpeg.
-
Download the album from Youtube as mp3.
(You could use YouTube-dl or any online service).
youtube-dl --extract-audio --audio-format mp3 --audio-quality 0 <Video-URL>
-
Download application.py
-
Run
python application.py <music file.mp3> <tracklist file.txt>
-
Enjoy!
Thank you for supplying this script.
I would like to make 2 modifications.
I would like to manually/explicitly specify the 'end time' to the nearest millisecond (as well as start time), e.g.: 00:04:32.549
The reason for this, to get rid of 'extended pauses' to more quickly transition to the next song.
I use a GUI program to visually analyze where the end pause first occurs, and manually write down said time, rather than using my hearing.
The 2nd modification I'd like to do, is use ogg vorbis for output method
I presume for the function def GenerateSplitCommand(start, end, filename), could have it's return statement changed to:
return ['ffmpeg', '-i', inputfile, '-ss', start, '-to', end, '-c' , 'copy', ________________ filename+'.mp3', '-v', 'error']
return ['ffmpeg', '-i', inputfile, '-ss', start, '-to', end, '-c:a', 'libvorbis', 'b:a', '128k', filename+'.ogg', '-v', 'error']
I'm concerned this may be in conflict with the statement, codec = '-acodec'
According to the ffmpeg document, that refers to the Ac-3 decoder