
Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net
Mp3Fixer is an amaroK Script for repairing various defects in MP3 files, for instance files which display a bogus track length in your audio player.
For example, if you have a track that you know is really five minutes long, but amaroK shows the length as one hour, then this script is for you. Mp3Fixer calculates the real track length and adds the missing XING header to the file, and it also repairs broken MPEG headers.
It is recommended that you back up your MP3 file before using this script on it. Although the script is designed not to harm your file, the operation is not reversible and should therefore be used with caution.
Dependencies:
* amaroK 1.3.1
* Ruby 1.8
15 years ago
Version 0.9.4:
* Fixed potential runtime error with some files.
Version 0.9.3:
* Show detailed repair summary.
* Some mp3 encoders (e.g. lame) add a block of zeros as padding to the beginning of the file. This is now correctly handled.
* mp3fix.rb did not work with source != destination.
Version 0.9.2:
* Automatically update the collection after repairing files.
* Automatically refresh the playlist.
Version 0.9.1:
* Fixed a bug that could make the script crap out with a runtime error.
* Show current filename in the statusbar.
Version 0.9:
* mp3fix.rb can now repair broken MPEG frames.
* Batch processing of multiple selected files.
* Using amaroK's statusbar for feedback instead of kdialog. This means, KDE-base is no longer required.
* More reliable, better error checking.
15 years ago
Version 0.9.4:
* Fixed potential runtime error with some files.
Version 0.9.3:
* Show detailed repair summary.
* Some mp3 encoders (e.g. lame) add a block of zeros as padding to the beginning of the file. This is now correctly handled.
* mp3fix.rb did not work with source != destination.
Version 0.9.2:
* Automatically update the collection after repairing files.
* Automatically refresh the playlist.
Version 0.9.1:
* Fixed a bug that could make the script crap out with a runtime error.
* Show current filename in the statusbar.
Version 0.9:
* mp3fix.rb can now repair broken MPEG frames.
* Batch processing of multiple selected files.
* Using amaroK's statusbar for feedback instead of kdialog. This means, KDE-base is no longer required.
* More reliable, better error checking.
janet
10 years ago
Report
winch
13 years ago
Line 115
ChannelMode = data[offset + 3] & 0xc0 >> 6
Should be
ChannelMode = (data[offset + 3] & 0xc0) >> 6
As >> has higher precedence than &. Channel mode is the first two bits of the third byte of the frame header.
This causes the script to look for a xing header in the wrong place with mono files. When it doesn't find one it proceeds to write a new one in the wrong place.
This bug is further complicated by the fact there is a similar bug in the current 1.4 release of taglib (fixed in svn) that causes it to make the same mistake when looking for a xing header in a mono mp3. This makes it look like the script works as the track length will be correct in amarok but could cause problems with other software and when a newer version of taglib is released that looks for xing headers in the correct place.
Report
vitaly
14 years ago
I have MP3 which plays fine in Audacious, but not in iPod Nano. I try to fix it using mp3fix and now I can even upload MP3 to iPod. :(
Report
esa
13 years ago
The tags where often messed up even though Mp3Fixer did its job correctly.
I had to clear off every tags from the files, run Mp3Fixer on them and lastly put the tags back.
Report
Ekardnam
14 years ago
Report
ramvi
14 years ago
(Totem plays the end as the beginning as well)
Report
markey
14 years ago
If you still have one of the original files (before using the script), could you send me one? markey@web.de
Report
travise
14 years ago
mp3fix.rb 050710\ 1358\ SIM.mp3
ID3-V2 detected. Tag size: 664
Analyzing mpeg frames..
./mp3fix.rb:184:in `/': divided by 0 (ZeroDivisionError)
from ./mp3fix.rb:184
Line 184 looks like this:
AverageBitrate = bitrateCount / frameCount
All my files play fine. They were encoded with LAME. I tested both from the console and from within Amarok. The results were the same.
Report
markey
14 years ago
Report
sektion31
15 years ago
.kde/share/apps/amarok/scripts-data/mp3fixer/mp3fixer.rb:29: private method `chomp' called for nil:NilClass (NoMethodError)
from .kde/share/apps/amarok/scripts-data/mp3fixer/mp3fixer.rb:28
Report
markey
15 years ago
"ruby mp3fix.rb --help"
Report
sektion31
15 years ago
Now the script works, but can't fix my file :(
"Mp3Fix did not find any defects."
It's strange because amarok shows two lengths, once is correct one wrong.
Look here:
http://adrian.kicks-ass.net/stuff/mp3fixer.jpg
If you want I can send you the file. It's ok because its the band of my friend and its not the finished version of the song yet. :)
Amarok
Report
sektion31
15 years ago
Now the script works, but can't fix my file :(
"Mp3Fix did not find any defects."
It's strange because amarok shows two lengths, once is correct one wrong.
Look here:
http://adrian.kicks-ass.net/stuff/mp3fixer.jpg
If you want I can send you the file. It's ok because its the band of my friend and its not the finished version of the song yet. :)
Amarok
Report
markey
15 years ago
Report
sektion31
15 years ago
Thanks for looking into it.
Report
dirtbag666
15 years ago
Report
markey
15 years ago
Report
dirtbag666
15 years ago
Report
dirtbag666
15 years ago
Report
dirtbag666
15 years ago
Report
markey
15 years ago
Report
BorgQueen
15 years ago
/home/myuser/.kde/share/apps/amarok/scripts/mp3fixer/mp3fix.rb:79: undefined method `extname' for File:Class (NameError)
/home/myuser/.kde/share/apps/amarok/scripts/mp3fixer/mp3fixer.rb:57: undefined method `success?' for 256:Fixnum (NameError)
from /home/myuser/.kde/share/apps/amarok/scripts/mp3fixer/mp3fixer.rb:45:in `each'
How do I fix this?
My system is Debian 3.1 / KDE 3.3.2
Thanks :)
Report
markey
15 years ago
Let me know if upgrading helped.
Report
BorgQueen
15 years ago
I remember when I first started using amaroK. My goodness as it evolved. You and your team have taken this app to amazing levels.
Now if only I can convince you to add a mixing audio preview for DJing (for audio cards with hardware mixing).
You will comply.
Resistance is futile....
:)
Report
Skrot
15 years ago
Report