Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a fair number of mp3 files which I created using audiohijack pro on a mac. Now I no longer have a mac and am using them on my linux systems. Unfortunately the program I use (rhythmbox) to listen to these files cannot figure out how long the files are. These files are up to 5 hours long, and when the program cannot figure out how long it is I can't scroll through the file. Any unix/linux programs that can reencode these files? I do not know enough about either audio on linux or the mp3 file format to know what would be involved in this.

Best, Bart

share|improve this question

4 Answers 4

up vote 3 down vote accepted

It does not answer the question in your title, but maybe there's a chance to fix the files without reencoding. For example, one common issue with incorrect lengths of MP3 files are files with variable bit rate that are not properly marked as having a variable bit rate (and programs like rhythmbox treating them as if they had a constant one). The tool vbrfix can fix those files. Another useful tool to check the MP3 file is mp3check, it also has options like --fix-headers that might repair the files (make backups of the files first!).

share|improve this answer
    
Nice. This seems like a very useful tool. –  Steven D Oct 13 '10 at 23:20
    
vbrfix did the job on my files. Thanks. –  kasterma Oct 24 '10 at 22:15
1  
"for i in 1 2 3 4 5; do vbrfix -always -log EndersGame$i.mp3 EG$i.mp3; done" was the command I used to save on some typing. –  kasterma Oct 24 '10 at 22:18
    
i really don't understand why linking to a crappy program developed on windows and only later ported to linux (hence not even scriptable, tsk tsk) made this the accepted answer! (so i downvoted the answer) –  ixtmixilix Mar 21 '11 at 21:03

While I do not know specifically whether additional options would be needed to fix the issue you mention, ffmpeg is

a complete, cross-platform solution to record, convert and stream audio and video.

It is the swiss-army knife for audio and video. Re-encoding your files should be as easy as

$ ffmpeg -i oldfile.mp3 newfile.mp3

ffmpeg is in the repositories of most major distributions or it can be downloaded from their website.

share|improve this answer
    
this seems like a more sane answer to me. obviously the OP has a lot of files and probably knows how to open a command line, though one worries these days, and as a matter of fact this answer actually answered the question i was about to ask. so i upvoted it. you acquire good SE karma, @Steven D, though your answer got no votes until i saw it. –  ixtmixilix Mar 21 '11 at 21:03

Try LAME I should warn you that re-encoding may (probably) result in quality loss.

share|improve this answer

It is possible to do it with lame and carry over the id3 tags (found it here).

find . -type f -iname "*.mp3" | while read file 
do
    mv "$file" "${file}.old" && \
    lame --mp3input -q 0 -b 192 --resample 44.1 "${file}.old" "$file" && \
    id3cp "${file}.old" "$file"
done
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.