MP3 repacker |
![]() ![]() |
MP3 repacker |
Mar 15 2005, 02:33
Post
#1
|
|
![]() Group: Developer Posts: 432 Joined: 22-February 04 From: San Diego, CA Member No.: 12180 |
What it does:
Attempts to save space by storing frame data in the smallest possible frame. Usually MP3s are already stored in the most efficient way possible. However, for high-bitrate CBR files (like --preset insane) there can be a lot of wasted space psyllium has made a great Windows GUI for this program. The GUI thread is here. Many people will find it easier to use than the CLI, and it has a few more features too (recursive directory support, 2-pass CBR). How to use: Download this 7Z file (version 2.04) (mirror) Extract to a directory that makes sense. Type "mp3packer in.mp3 out.mp3" to repack the in.mp3 file OR see mp3packer.html included in the package (or available here) for more options. The source can be downloaded here (mirror). Features: * Can make --preset insane files up to 10% smaller LOSSLESSLY (depending on the LAME version used) * Squeezes out all the padding it can from any MP3 (Will not produce a larger file, unless you use the -b switch or something goes wrong) * Writes valid LAME/XING header for proper VBR seeking * Many people also use this backwards, to losslessly turn VBR into larger CBR files to humor players which can't handle VBR * Includes a brute-force compression optimization option as of 1.10 to further compress files * Now supports Unicode file names and paths * Support for encoding an entire directory of files * Works on Windows, Linux, 64-bit Linux, Linux through WINE, and should work perfectly on any other platform with an OCaml port * GPL, so anybody can tweak it as long as it stays GPL A few caveats: * The program will always output an MP3 that doesn't use CRCs, even if the input file uses CRC. This is primarily laziness on my part, but nobody really needs them, and it saves 600 bits per second... (it's a feature, not a bug!) * The 32-bit version will not process files larger than 1GB. The 64-bit version has a much higher limitation (4EB) which is unlikely to be encountered. * There seems to be an incompatibility with the multi-threaded repacking code and 32-bit Windows XP. If you run across an error, try adding "--workers 0" to the command line. Changelog (click here!) This post has been edited by Omion: Sep 1 2012, 04:34 -------------------- "We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel, H2G2
|
|
|
|
Mar 15 2005, 02:44
Post
#2
|
|
![]() Group: Members Posts: 3353 Joined: 6-July 03 From: Sachsen (DE) Member No.: 7609 |
what about gapless playback? Will anything in the headers which is required for gapless playback be damaged?
- Lyx -------------------- I am arrogant and I can afford it because I deliver.
|
|
|
|
Mar 15 2005, 04:02
Post
#3
|
|
![]() Group: Developer Posts: 432 Joined: 22-February 04 From: San Diego, CA Member No.: 12180 |
QUOTE (Lyx @ Mar 14 2005, 06:44 PM) what about gapless playback? Will anything in the headers which is required for gapless playback be damaged? - Lyx Nope. Gapless settings are in the LAME tag, which is saved to the new file. The only LAME tag settings which I change are the ones that actually change (file length, etc.) Everything else is saved. -------------------- "We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel, H2G2
|
|
|
|
Mar 15 2005, 19:18
Post
#4
|
|
|
Group: Members Posts: 1361 Joined: 25-November 02 Member No.: 3873 |
that's some pretty pimp stuff...does it handle files other than LAME as well?
-------------------- --alt-presets are there for a reason! These other switches DO NOT work better than it, trust me on this.
LAME + Joint Stereo doesn't destroy 'Stereo' |
|
|
|
Mar 15 2005, 20:29
Post
#5
|
|
![]() Group: Developer Posts: 432 Joined: 22-February 04 From: San Diego, CA Member No.: 12180 |
QUOTE (Jojo @ Mar 15 2005, 11:18 AM) Yup. If it's an MP3, it's supported. LAME is just extra-supported as the program handles LAME/XING headers properly. I just noticed that MPEG2 and 2.5 files are having some sort of problem. I'll see if I can fix it sometime today. [Edit: MPEG2 / 2.5 files are working correctly as of version 0.02.] This post has been edited by Omion: Mar 20 2005, 08:54 -------------------- "We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel, H2G2
|
|
|
|
Mar 15 2005, 21:05
Post
#6
|
|
|
Group: Members Posts: 109 Joined: 1-February 04 Member No.: 11678 |
Sounds pretty cool. I wouldn't have thought there'd be that much to squeeze out (I don't know much about mp3's), but if it works as well as you say it does (I'm'a have to see for my self
Thank you for all your hard work |
|
|
|
Mar 15 2005, 21:14
Post
#7
|
|
|
Group: Developer Posts: 1289 Joined: 17-March 03 From: Calgary, AB Member No.: 5541 |
So, basically this program turns a CBR file into a VBR file, correct? Pointing newbies who don't understand/trust VBR might be interested in reading this!
|
|
|
|
Mar 15 2005, 21:54
Post
#8
|
|
![]() Group: Members Posts: 742 Joined: 27-May 02 From: Oslo, Norway Member No.: 2133 |
Seems to work fine.
I just tested it on some random MP3 files and it shaved of a few kb of everyone of them. |
|
|
|
Mar 15 2005, 21:59
Post
#9
|
|
![]() Group: Developer Posts: 432 Joined: 22-February 04 From: San Diego, CA Member No.: 12180 |
QUOTE (Qest @ Mar 15 2005, 01:05 PM) Sounds pretty cool. I wouldn't have thought there'd be that much to squeeze out (I don't know much about mp3's), but if it works as well as you say it does (I'm'a have to see for my self Thank you for all your hard work Well, most of the time there isn't anything to squeeze out. But on some files, most notably high-bitrate CBR files, there can be quite a bit of dead space. @solaris: Do you know which encoder/settings were used for your test files? -------------------- "We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel, H2G2
|
|
|
|
Mar 15 2005, 22:04
Post
#10
|
|
![]() Group: Developer Posts: 432 Joined: 22-February 04 From: San Diego, CA Member No.: 12180 |
QUOTE (Jebus @ Mar 15 2005, 01:14 PM) So, basically this program turns a CBR file into a VBR file, correct? Pointing newbies who don't understand/trust VBR might be interested in reading this! Yes, although it would be slightly more accurate to say that it turns any MP3 into a VBR file. ... actually, there's still a possibility that the resultant file is CBR, but that's extremely unlikely. It would indicate that the input file didn't use the bit reservoir, which is quite bad for an encoder to do. Hmm... I guess the most accurate way to characterize the program is: * At every frame, it picks the smallest frame size which can hold all the data or perhaps simply: * In the resultant file, dependancy on the bit reservoir is minimized Although both of these definitions can be invalidated if you use some of the command line options. It looks like my little Perl script is pretty hard to define -------------------- "We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel, H2G2
|
|
|
|
Mar 15 2005, 23:32
Post
#11
|
|
![]() Group: Members Posts: 347 Joined: 22-September 04 From: Moscow Member No.: 17192 |
Binary, anyone?
-------------------- Infrasonic Quartet + Sennheiser HD650 + Microlab Solo 2 mk3.
|
|
|
|
Mar 16 2005, 00:31
Post
#12
|
|
![]() Group: Members (Donating) Posts: 352 Joined: 10-July 04 From: Albany NY USA Member No.: 15259 |
QUOTE (Mo0zOoH @ Mar 15 2005, 06:32 PM) Binary, anyone? Perl = script language = no binaries. Someone who knows both perl and something like C can translate, but bla why bother. Here is the perl to get for windows. Install it, and then: Run "perl mp3packer.pl in.mp3 out.mp3" to repack OR run "perl mp3packer.pl -h" to see other options |
|
|
|
Mar 16 2005, 00:43
Post
#13
|
|
|
Group: Members Posts: 39 Joined: 27-January 04 Member No.: 11565 |
QUOTE (Klyith @ Mar 15 2005, 03:31 PM) QUOTE (Mo0zOoH @ Mar 15 2005, 06:32 PM) Binary, anyone? Perl = script language = no binaries. Someone who knows both perl and something like C can translate, but bla why bother. Here is the perl to get for windows. Install it, and then: Run "perl mp3packer.pl in.mp3 out.mp3" to repack OR run "perl mp3packer.pl -h" to see other options Well, you could use perlcc. Won't be as easy in this case because of the module that needs to be included. So you'd need to build the shared library first. CODE perlcc -o mp3packer.so mp3.pm Then convert the mp3packer.pl to C CODE perlcc -c mp3packer.pl Then you can use gcc to compile the C code and statically link the library into it. CODE gcc mp3packer.C -O2 -o mp3packer -static -lmp3packer.so I think... I'm a bit rusty Not sure if this would even result in usable output either. This post has been edited by 2thumbs: Mar 16 2005, 00:56 |
|
|
|
Mar 16 2005, 09:05
Post
#14
|
|
![]() Group: Members Posts: 742 Joined: 27-May 02 From: Oslo, Norway Member No.: 2133 |
QUOTE (Omion @ Mar 15 2005, 09:59 PM) They are lame --alt-preset standard. But there are some times since I encoded them, so I`m a bit unsure what lame version I used (probably 3.90.2/3 and/or 3.96.1). I have no cbr files to test it on. |
|
|
|
Mar 18 2005, 07:28
Post
#15
|
|
![]() Group: Members Posts: 347 Joined: 22-September 04 From: Moscow Member No.: 17192 |
CODE C:\Files\progs\Lame stuff\mp3packer>perl mp3packer.pl 1.mp3 2.mp3 Constant name 'HASH(0x1832adc)' has invalid characters at mp3.pm line 16 BEGIN failed--compilation aborted at mp3.pm line 19. Compilation failed in require at mp3packer.pl line 25. C:\Files\progs\Lame stuff\mp3packer>perl mp3packer.pl -h Constant name 'HASH(0x1832ae0)' has invalid characters at mp3.pm line 16 BEGIN failed--compilation aborted at mp3.pm line 19. Compilation failed in require at mp3packer.pl line 25. C:\Files\progs\Lame stuff\mp3packer> Wtf. I'm using ActivePerl as recommended by Klyith, what am I doing wrong? -------------------- Infrasonic Quartet + Sennheiser HD650 + Microlab Solo 2 mk3.
|
|
|
|
Mar 18 2005, 07:35
Post
#16
|
|
|
Group: Members Posts: 684 Joined: 15-December 01 From: Denmark Member No.: 655 |
couldn't this funktion be put into lame ? some thing like -repack
-------------------- Sven Bent - Denmark
|
|
|
|
Mar 18 2005, 07:59
Post
#17
|
|
|
Group: Members Posts: 684 Joined: 15-December 01 From: Denmark Member No.: 655 |
just tried this. Saved a couple of bytes.
However the output is NOT the same I used winamp diskwrite plugin. Ran crc32 and md5 check on the files and they did not match, also the size of the 2 decoded wavs where not identical either. and id3v2 tags are removed from the file. This post has been edited by sven_Bent: Mar 18 2005, 08:01 -------------------- Sven Bent - Denmark
|
|
|
|
Mar 18 2005, 08:03
Post
#18
|
|
![]() Group: Members (Donating) Posts: 552 Joined: 9-June 04 From: A place long since forgotten... Member No.: 14572 |
The way I'd describe the output of the songs I tried this with is almost constand 320k stream with the occasional flicker which is a 256k frame. Still pretty fun to play around with.
-------------------- Nero AAC 1.5.1.0: -q0.45
|
|
|
|
Mar 18 2005, 08:56
Post
#19
|
|
|
Group: Members Posts: 180 Joined: 16-January 02 Member No.: 1046 |
@Omion
Thanks for the great tool! QUOTE (sven_Bent @ Mar 18 2005, 07:59 AM) I used winamp diskwrite plugin. Ran crc32 and md5 check on the files and they did not match, also the size of the 2 decoded wavs where not identical either. Is the wav from mp3packer shorter than the original? If so, it might be related to the last frame of the mp3 being truncated because of the removal of padding. (just speculating, haven't tested mp3packer for myself, yet) Omion, any idea? QUOTE (sven_Bent @ Mar 18 2005, 07:59 AM) and id3v2 tags are removed from the file. Which saves another few bytes! Great feature for a packer, isn't it? |
|
|
|
Mar 18 2005, 09:25
Post
#20
|
|
![]() Group: Members Posts: 2525 Joined: 25-July 02 From: South Korea Member No.: 2782 |
QUOTE (sven_Bent @ Mar 18 2005, 03:59 PM) just tried this. Saved a couple of bytes. However the output is NOT the same I used winamp diskwrite plugin. Ran crc32 and md5 check on the files and they did not match, also the size of the 2 decoded wavs where not identical either. and id3v2 tags are removed from the file. If you were using LAME-encoded MP3s, did you use a gapless decoder? -------------------- http://blacksun.ivyro.net/vorbis/vorbisfaq.htm
|
|
|
|
Mar 18 2005, 11:04
Post
#21
|
|
![]() Group: Developer Posts: 432 Joined: 22-February 04 From: San Diego, CA Member No.: 12180 |
QUOTE (smack @ Mar 18 2005, 12:56 AM) @Omion Thanks for the great tool! QUOTE (sven_Bent @ Mar 18 2005, 07:59 AM) I used winamp diskwrite plugin. Ran crc32 and md5 check on the files and they did not match, also the size of the 2 decoded wavs where not identical either. Is the wav from mp3packer shorter than the original? If so, it might be related to the last frame of the mp3 being truncated because of the removal of padding. (just speculating, haven't tested mp3packer for myself, yet) Omion, any idea? QUOTE (sven_Bent @ Mar 18 2005, 07:59 AM) and id3v2 tags are removed from the file. Which saves another few bytes! Great feature for a packer, isn't it? The file should have the exact same number of frames, with the same data in them, and the same gapless settings. If they're not, either the program's wrong or the decoder's not producing identical output. This may be the case if the decoder is using dithering, which will add random (not reproducible) noise. @ sven_Bent: If you have Foobar, run the "bit-compare tracks" function on the two files. If you don't have Foobar, then could you run the SAME mp3 through the Winamp diskwriter plugin twice, and see if they match up. (If they don't, then your output is dithering) About the ID3V2 tags, the repacker doesn't save anything before the first valid MP3 frame. It only saves the non-MP3 data after the end. This means that some versions of the ID3v2 tag will not be stored. (I think 2.4 is stored at the end... ID3 tags are a mess... -------------------- "We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel, H2G2
|
|
|
|
Mar 18 2005, 11:22
Post
#22
|
|
![]() Group: Developer Posts: 432 Joined: 22-February 04 From: San Diego, CA Member No.: 12180 |
QUOTE (Mo0zOoH @ Mar 17 2005, 11:28 PM) CODE C:\Files\progs\Lame stuff\mp3packer>perl mp3packer.pl 1.mp3 2.mp3 Constant name 'HASH(0x1832adc)' has invalid characters at mp3.pm line 16 BEGIN failed--compilation aborted at mp3.pm line 19. Compilation failed in require at mp3packer.pl line 25. C:\Files\progs\Lame stuff\mp3packer>perl mp3packer.pl -h Constant name 'HASH(0x1832ae0)' has invalid characters at mp3.pm line 16 BEGIN failed--compilation aborted at mp3.pm line 19. Compilation failed in require at mp3packer.pl line 25. C:\Files\progs\Lame stuff\mp3packer> Wtf. I'm using ActivePerl as recommended by Klyith, what am I doing wrong? What version of Perl are you using? Run "perl -v" and it should say something like "This is perl, v5.8.5 built for MSWin32-x86-multi-thread" Line 16 is where the first constant is defined. Try saving and running the following: CODE use constant { FOO => 'something', BAR => 3, BAZ => [1,2,3], }; print "FOO: ", FOO, "\nBAR: ", BAR, "\nBAZ: ", BAZ, "\n"; The result should be something like: CODE FOO: something (The array might have a different value)BAR: 3 BAZ: ARRAY(0x182bc58) If that doesn't run, then it looks like your "constant" library is screwed up... If it does run, then I'll have to try it out with ActivePerl, and see why my it doesn't like mp3packer. I'm going to my parent's house tomorrow for a week, so I might not be as responsive as I should be, but I'll work on this as soon as I get things set up there. -------------------- "We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel, H2G2
|
|
|
|
Mar 18 2005, 22:29
Post
#23
|
|
|
Group: Members Posts: 684 Joined: 15-December 01 From: Denmark Member No.: 655 |
@ominion
i dont have fobar her but i did two diskwrites of the same mp3 as before (the original and not the repackwd) and they came out bit identical MD5 b526274595bd1b40fa744673c8b25f08 *first.wav b526274595bd1b40fa744673c8b25f08 *Second.wav CRC32 first.wav 75FDC377 Second.wav 75FDC377 So it definatly seems like the repack stuff is NOT lossless to the decoded stream -------------------- Sven Bent - Denmark
|
|
|
|
Mar 18 2005, 22:40
Post
#24
|
|
![]() Group: Members Posts: 3353 Joined: 6-July 03 From: Sachsen (DE) Member No.: 7609 |
edit: nevermind - i misunderstood something.
This post has been edited by Lyx: Mar 18 2005, 22:41 -------------------- I am arrogant and I can afford it because I deliver.
|
|
|
|
Mar 19 2005, 05:10
Post
#25
|
|
![]() Group: Developer Posts: 432 Joined: 22-February 04 From: San Diego, CA Member No.: 12180 |
QUOTE (Mo0zOoH @ Mar 17 2005, 11:28 PM) CODE C:\Files\progs\Lame stuff\mp3packer>perl mp3packer.pl 1.mp3 2.mp3 Constant name 'HASH(0x1832adc)' has invalid characters at mp3.pm line 16 BEGIN failed--compilation aborted at mp3.pm line 19. Compilation failed in require at mp3packer.pl line 25. C:\Files\progs\Lame stuff\mp3packer>perl mp3packer.pl -h Constant name 'HASH(0x1832ae0)' has invalid characters at mp3.pm line 16 BEGIN failed--compilation aborted at mp3.pm line 19. Compilation failed in require at mp3packer.pl line 25. C:\Files\progs\Lame stuff\mp3packer> Wtf. I'm using ActivePerl as recommended by Klyith, what am I doing wrong? I think I know the problem. Some versions of Perl don't allow multiple constants to be defined at the same time. It should be fairly easy to fix... I'll do it as soon as I can. [Edit: Should be fixed now. Download version 0.02 and try it out.] This post has been edited by Omion: Mar 20 2005, 08:56 -------------------- "We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel, H2G2
|
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 19th May 2013 - 23:07 |