10

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

6

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!).

  • Nice. This seems like a very useful tool. – Steven D Oct 13 '10 at 23:20
  • 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
  • @ixtmixilix - For vbrfix atleast, the binaries they have compile on the link are for windowz as that it what many ppl sadly use. Versions for Linux are available elsewhere (and also appears to be included in Ubuntu 12.04+) - you can also try using the available source code. The mp3check link is dead though.... – Wilf Jun 29 '15 at 0:40
  • OK vbrfix works perfectly - as I use Fedora, I downloaded the sources for the Ubuntu version, used dpkg-source -x vbrfix_0.24-7.dsc to extract it, apply patches etc, then ./configure --prefix='/home/wilf/Downloads/fsbOPEN/vbrfix/makeinstall', make and make install to produce a standalone excitable that I could use on my files. I needed to parse the -always option to make it work. – Wilf Jun 29 '15 at 1:02
8

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.

  • 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
  • 1
    I have a similar issue, and already tried ffmpeg and it for the most part worked :D, but have a few files on which it exited citing Invalid data found when processing input.... – Wilf Jun 29 '15 at 0:47
3

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

See more conversion scripts I have writtten here: https://github.com/sid-the-sloth/conversion-scripts

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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