Sade Guru


Joined: 22 Mar 2005 Posts: 406 Location: Netherlands - Eindhoven
|
Posted: Mon May 14, 2007 5:50 pm Post subject: Script for mass reencoding mp3's to a lower bitrate |
|
|
Intro
---------
Most of us have large collections of MP3's, but because the source of these files varies a lot so does the bitrate. This isn't a problem on your PC but when you have limited space on your MP3 player those 320kbps files are a bit unhandy. I wanted to create a copy of my whole music collection but then recoded to a different lower bitrate. Because i didn't want to do this manually i created a script to handle the work. I also wanted the script to handle changes in the original structure and update the spawns.
Why
---------
This script has now seen some remakes and has matured enough for me to share it with you. I'm guessing that some of you encounter the same problems. I'm not planning on maintaining the script to accommodate everyones wishes i just want to share this tool. I'm also giving it to the world so feel free to copy bits from it, or even the whole script.
What
----------
A little description of what the script actually is:
Warning: the script replaces [] brackets for () parenthesis in the filenames because these interfered with the script. This was a quick fix there might be a nicer solution.
The script reads all subdirectorys of a given path and scans every file in that path. It uses mp3info to obtain the bitrate of the file and then compares it with the bitrate of a file in the output path. It decides what action is necessary, either copy, process, clean, skip. It copies when the source file is in a lower bitrate then the wanted bitrate, because upping a file to a higher bitrate is shear silly. When done analyzing the music collection it will display a summary of things that it's going to do. The user then can decide to go for it or abort. All files that need processing are run through ffmpeg to reencode them. The result is a mirror directory structure with files that are all lower than the given bitrate.
The script is perfectly safe for your music collection except for the waring given above about the [].
It uses a tempfile to store the analyze actions in, you can read this before u give the go. It also stores every step it takes in a log file so you can retrace the steps if something goes wrong.
Script
------------
u need <media-sound/mp3info> and <media-video/ffmpeg> for this script to work.
reencode.0.1.3.tar (this url is from my home pc, with a very limited connection)
I don't consider myself responsible for all the damage to your system, that this script may cause.
Please test it first on a copy of your collection, or part of your collection. _________________ | 1.6Ghz atom N270 | adopt an unanswerd post | a nice way to post a config file | |
|