Skip to main content

Topic: MP3 repacker (Read 463499 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • benski
  • [*][*][*][*][*]
  • Developer
MP3 repacker
Reply #475
It looks like the problem stems from the data inside the LAME tag. The file was encoded with ABR, so that was what was in the initial LAME tag. mp3packer treats the LAME tag as information about how the file was encoded, so keeps it the same as the input file. What probably happened is that Winamp saw the ABR in the LAME header and reported that information.

I have no idea why Winamp would say that the number of frames would change so drastically on deleting the first frame. MP3s do not store their length or bitrate anywhere (except in the non-standard XING/LAME header) so it's possible that Winamp had to guess. Oddly enough, what it guessed is exactly 1/8 the actual number of frames (well, rounded to the nearest whole number). It sort of looks like Winamp mistook bits for bytes somewhere in the process.

In conclusion, it looks like Winamp is correctly reporting the encoding setting as opposed to actually checking the frames of the file. (technically CBR is a subset of ABR, so calling it ABR is true, but that's splitting hairs). So in the end, nothing's wrong


Thanks for the report.  I fixed the issue with the frame approximation. 

When there is no Xing, LAME or VBRI header present, it's totally a guess, as you had suspected.  Luckily, VBR mp3 files without one of these headers is relatively rare.

And, yes, it's reporting ABR because that's how it was defined in the LAME info tag.  Ideally MP3 repacker could change the encoding type bits in the LAME header to reflect the changes.  I assume it already rebuilds the seektable.

Also, yes for clarification, the LAME header isn't counted in the frame count nor does it count in the "Header found at" reporting.

  • mjb2006
  • [*][*][*][*][*]
MP3 repacker
Reply #476
File is broken.


Ugh, sorry. It showed the right size on zShare, but when I tried downloading it, only half of it transferred. I have removed the file. I assume the .zip posted by Martin F. is OK?

  • а.п.т.
  • [*]
MP3 repacker
Reply #477
...If anyone knows the right way to make this context menu item only show up for mp3 files, let me know. I tried changing the '*' to '.mp3' or 'mp3file' or 'mpegfile', but none of those seemed to work.
Probably mp3file is not registered on your system.
I've checked mine, it seems that wmplayer has registered that type, so I've just added a new shell extension, see below:

Code: [Select]
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\mp3file]
"PreferExecuteOnMismatch"=dword:00000001
"EditFlags"=hex:00,00,01,00
@="MP3 Format Sound"
"FriendlyTypeName"="@C:\\WINDOWS\\inf\\unregmp2.exe,-9925"

[HKEY_CLASSES_ROOT\mp3file\DefaultIcon]
@="C:\\PROGRA~1\\WINDOW~2\\wmplayer.exe,-120"

[HKEY_CLASSES_ROOT\mp3file\shell]
@="play"

[HKEY_CLASSES_ROOT\mp3file\shell\&Repack_with_mp3packer]
@="&Repack with mp3packer"

[HKEY_CLASSES_ROOT\mp3file\shell\&Repack_with_mp3packer\command]
@="D:\\Util\\mp3repacker\\mp3packer.exe -z -u --nice 1 -a \"-old\" \"%1\""

[HKEY_CLASSES_ROOT\mp3file\shell\&Repack_with_mp3packer\ddeexec]

[HKEY_CLASSES_ROOT\mp3file\shell\&Repack_with_mp3packer\ddeexec\Application]
@="mp3packer"

[HKEY_CLASSES_ROOT\mp3file\shell\&Repack_with_mp3packer\ddeexec\Topic]
@="System"

[HKEY_CLASSES_ROOT\mp3file\shell\open]
@="&Open"
"LegacyDisable"=""

[HKEY_CLASSES_ROOT\mp3file\shell\open\command]
@="\"C:\\Program Files\\Windows Media Player\\wmplayer.exe\" /prefetch:6 /Open \"%L\""

[HKEY_CLASSES_ROOT\mp3file\shell\open\DropTarget]
"CLSID"="{CE3FB1D1-02AE-4a5f-A6E9-D9F1B4073E6C}"

[HKEY_CLASSES_ROOT\mp3file\shell\play]
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,69,00,6e,00,66,00,5c,00,75,00,6e,00,72,00,65,00,67,\
  00,6d,00,70,00,32,00,2e,00,65,00,78,00,65,00,2c,00,2d,00,39,00,39,00,39,00,\
  31,00,00,00
@="&Play"
"LegacyDisable"=""

[HKEY_CLASSES_ROOT\mp3file\shell\play\command]
@="\"C:\\Program Files\\Windows Media Player\\wmplayer.exe\" /prefetch:6 /Play \"%L\""

Hope this helps...

  • Code
  • [*]
MP3 repacker
Reply #478
Hey, here's a unixy binary of 1.20, compiled on osx 10.4.11 (intel)
I'll whip up a gui and post that in a bit.
http://alexyule.com/softwares/mp3packer.gz

EDIT: Gui is now up, use it via drag-n-drop (multiple files supported). Each file will be processed, and the resulting output will go to the same folder with -vbr added to the song name.
i.e. 22 Acacia Ave.mp3 --> 22 Acacia Ave-vbr.mp3

Self-contained GUI is here: http://alexyule.com/softwares/mp3packerX_v1.20.zip

Automator action to rename the vbr files (overwriting the originals) via drag-n-drop (you can just drag all the files and it will only rename the -vbr ones) is here: http://alexyule.com/softwares/mp3packer_renamer.zip



Hey Apoc_Metal (or anyone else who can help!)

I have been trying to get version 1.2 of the mp3packer program to run on my Mac but haven't had any luck so far.

I've been using Terminal to try to launch it - but it gave me a message saying "no application knows how to open Desktop/mp3packer"

after that I tried adding the extention .app to the filename, but then I got a error code in the Terminal window after I tried to open it again.

I'm not very knowledgeable about working with the Terminal window... any suggestions would be appreciated.
Would be especially interested in learning how to get the GUI working, once the mp3packer itself is running of course !


My Mac is a Duo core Intel running OS X 10.5.8 by the way...


  • Last Edit: 05 April, 2011, 06:13:06 PM by Code

  • stereotype
  • [*]
MP3 repacker
Reply #479
Forgive me if this has been discussed before in this thread as I didn't feel like going through 20 pages to find out...

I was running mp3repacker on the mp3 soundtrack of a TV series, and I just found out by accident that apparently mp3packer writes a header like "mp3packer1.21-229" several times into the packed mp3.
Sorry if this sounds stingy but, isn't this wasted space?
I mean, I thought the whole point of mp3packer was to try to reduce the stream by every byte possible... Or am I missing something?
Presuming it writes that for every frame, that's 17 bytes per frame.
The soundtrack in question had 106,000 frames, and doing the math, that's like 1.8 MBs
It might not sound like much, but the soundtrack is a low bitrate mono mp3 weighing only 10MB.
Which means 18% are wasted bits...

Now I'm not sure mp3packer really writes that for every frame, but if it does, it seems like a lot of wasted bits...
Is this correct, or did I get it wrong somewhere?

MP3 repacker
Reply #480
Hey, here's a unixy binary of 1.20, compiled on osx 10.4.11 (intel)
I'll whip up a gui and post that in a bit.
http://alexyule.com/softwares/mp3packer.gz

EDIT: Gui is now up, use it via drag-n-drop (multiple files supported). Each file will be processed, and the resulting output will go to the same folder with -vbr added to the song name.
i.e. 22 Acacia Ave.mp3 --> 22 Acacia Ave-vbr.mp3

Self-contained GUI is here: http://alexyule.com/softwares/mp3packerX_v1.20.zip

Automator action to rename the vbr files (overwriting the originals) via drag-n-drop (you can just drag all the files and it will only rename the -vbr ones) is here: http://alexyule.com/softwares/mp3packer_renamer.zip



Hey Apoc_Metal (or anyone else who can help!)

I have been trying to get version 1.2 of the mp3packer program to run on my Mac but haven't had any luck so far.

I've been using Terminal to try to launch it - but it gave me a message saying "no application knows how to open Desktop/mp3packer"

after that I tried adding the extention .app to the filename, but then I got a error code in the Terminal window after I tried to open it again.

I'm not very knowledgeable about working with the Terminal window... any suggestions would be appreciated.
Would be especially interested in learning how to get the GUI working, once the mp3packer itself is running of course !


My Mac is a Duo core Intel running OS X 10.5.8 by the way...

Hm, seems that gzipped version of the binary is messed up... but the osx front-end has a working version stored inside the application package, so it should work just fine! Anyone who wants the binaries can grab them here http://omion.dyndns.org/mp3packer/ there's an updated version 1.21 that I haven't tried since I can't get it to compile (I have no idea what I'm doing ) -- anyone know how to modify the makefile to get it to compile on OSX? Seems it gets tripped up by c_part? EDIT: Nevermind, got it to work!
  • Last Edit: 16 May, 2011, 05:29:30 AM by apoc_metal

MP3 repacker
Reply #481
Alrighty, I've updated my rudimentary OSX GUI with a 1.21 binary.
USAGE: Drag a bunch of mp3's onto the app, then wait. Then run the automator action to rename the files or do it by hand...
Currently the app does NOT handle pathnames with single quotes in them.
All files can be found here: http://alexyule.com/softwares
I've also posted the binary itself, compiled on an intel mac running OSX, not sure what other platforms it'll run on...

  • alexeysp
  • [*][*][*]
MP3 repacker
Reply #482
I was running mp3repacker on the mp3 soundtrack of a TV series, and I just found out by accident that apparently mp3packer writes a header like "mp3packer1.21-229" several times into the packed mp3.
Sorry if this sounds stingy but, isn't this wasted space?


A late reply is better than no reply.

This is not a "header", but the "filler". The mp3 standard defines fixed set of allowed bitrates on a per-frame basis. Particularly, the minimum allowed bitrate is 32 kilobits per second - even if the stream can be compressed further, the relevant frame still has to be padded with extra bits to fulfill the minimum allowed bitrate requirement. This requirement of the standard imposes the minimum (as well as maximum) allowed frame size restriction depending on the encoding process history and current state. In other words, some frames can not get smaller than certain size, even when there is no audio data to encode into that space. The payload in such frames can be filled with arbitrary bits; mp3repacker fills it with the version info string. So there is no waste of space, mp3repacker always produces the most compact specification-compliant stream possible.

  • skexu
  • [*]
MP3 repacker
Reply #483
Quote
Particularly, the minimum allowed bitrate is 32 kilobits per second - even if the stream can be compressed further, the relevant frame still has to be padded with extra bits to fulfill the minimum allowed bitrate requirement.


Actually mpeg-2 layer 3 defines minimal bitrate of 8 kbps and IIRC 8kbps files are smaller than 32 kbps, am I wrong?

  • lvqcl
  • [*][*][*][*][*]
  • Developer
MP3 repacker
Reply #484
It's not possible to losslessly convert MPEG-1 layer 3 to MPEG-2 layer 3.

  • moozooh
  • [*][*][*][*]
MP3 repacker
Reply #485
Can those bits be used for bit reservoir, or is it not possible?
Infrasonic Quartet + Sennheiser HD650 + Microlab Solo 2 mk3. 

  • alexeysp
  • [*][*][*]
MP3 repacker
Reply #486
Can those bits be used for bit reservoir, or is it not possible?


They are used when possible. The filler is inserted only when encoder (or repacker) runs out of useful bits, e.g. with the long sequences of silent frames.

  • Omion
  • [*][*][*][*]
  • Developer
MP3 repacker
Reply #487
I'm not quite dead! 

Someone traversed the internet to send me some problem files, so in response I came out with version 1.22.
I also decided to post a mirror on my Dropbox account, in case my home server gives up the ghost again. The source is here (mirror).

The biggest problem was that one of my string-initialization routines would cause an out-of-bounds access with a very specific type of corrupted frame. I also discovered a case when the -z switch would not process the input properly, causing a small number of corrupted frames to not be processed.

The program now shows the number of decompression errors in the bitstream that the -z switch has encountered. I had the code in there for years, but for some reason I never did anything with it.


The processing of corrupted frames by the -z switch means that there may be some changes to the audio on those frames. In my experience, the changes are limited to the 1 or 2 highest-frequency samples encoded. These changes will ONLY ever occur on corrupted or otherwise invalid frames, not valid ones. They will be accompanied by a "decompression error" warning.


P.S. I'll change the main post as soon as I can get permission. (looks like someone changed the forum rules while I was gone!)
[edit]Woo! I can edit now! Main post updated.
  • Last Edit: 27 June, 2011, 03:02:43 PM by Omion
"We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel, H2G2

  • hidn
  • [*][*]
MP3 repacker
Reply #488
thank you!
possible icl version?

  • lvqcl
  • [*][*][*][*][*]
  • Developer
MP3 repacker
Reply #489
possible icl version?

Since when ICL was able to compile OCaml? 

  • hidn
  • [*][*]
MP3 repacker
Reply #490
I do not know 

  • Omion
  • [*][*][*][*]
  • Developer
MP3 repacker
Reply #491
thank you!
possible icl version?

No ICL version, unfortunately. As lvqcl implied, there is no way to compile OCaml with ICL.

I am trying to put together a multi-threaded(*) version for batch processing, which should help with today's multi-core CPUs (it wasn't as much of an issue when I started this in 2004  ) It's sort of a background project now, but I should be able to get it done eventually.


(*) Well, technically OCaml can't really speed up things when multi-threading, so I'm really trying to get multiple processes running simultaneously. It's a bit trickier than multi-threading, so I'm running a lot of tests before releasing it.
"We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel, H2G2

  • Antonski
  • [*][*][*]
MP3 repacker
Reply #492
(*) Well, technically OCaml can't really speed up things when multi-threading, so I'm really trying to get multiple processes running simultaneously. It's a bit trickier than multi-threading, so I'm running a lot of tests before releasing it.


I think running parallel processes in Perl is much easier than multi-threading, but I guess you don't want to go back to Perl, right?

  • hidn
  • [*][*]
MP3 repacker
Reply #493
Thanks for the continued development

  • Omion
  • [*][*][*][*]
  • Developer
MP3 repacker
Reply #494
(*) Well, technically OCaml can't really speed up things when multi-threading, so I'm really trying to get multiple processes running simultaneously. It's a bit trickier than multi-threading, so I'm running a lot of tests before releasing it.


I think running parallel processes in Perl is much easier than multi-threading, but I guess you don't want to go back to Perl, right?

Yeah, Perl would be terribly slow, especially for the -z stuff. And I'm much more used to OCaml now than Perl.
"We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel, H2G2

MP3 repacker
Reply #495
mp3packer 1.22-230

Fatal error: exception Invalid_argument("String.sub")

Example mp3 - http://www.multiupload.com/IBM89OEUQ1

  • Omion
  • [*][*][*][*]
  • Developer
MP3 repacker
Reply #496
mp3packer 1.22-230

Fatal error: exception Invalid_argument("String.sub")

Example mp3 - http://www.multiupload.com/IBM89OEUQ1

Thanks for the report. I just released 1.23 to fix it. (download) (mirror)

I'm sure I've fixed this bug about 5 times before, but it keeps coming back in slightly different ways. Hopefully it stays fixed this time.
"We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel, H2G2

MP3 repacker
Reply #497
Quote
Thanks for the report. I just released 1.23 to fix it. (download) (mirror)

I'm sure I've fixed this bug about 5 times before, but it keeps coming back in slightly different ways. Hopefully it stays fixed this time.

Thanks for the fix  1.23 works perfect on my problem files.

  • stereotype
  • [*]
MP3 repacker
Reply #498
I'm trying to compile it under Fedora 15 64-bit, and I'm getting the following error:

Code: [Select]
$ make OBJ_EXT=.o
ocamlopt -c crc.ml
ocamlopt list2.mli
ocamlopt -c list2.ml
ocamlopt expandarray.mli
ocamlopt -c expandarray.ml
ocamlopt c_part.c
ocamlopt -c mp3types.ml
ocamlopt -c pack.ml
ocamlopt -c mp3read.ml
File "mp3read.ml", line 172, characters 7-18:
Warning 26: unused variable return_none.
File "mp3read.ml", line 76, characters 35-40:
Warning 16: this optional argument cannot be erased.
ocamlopt -c mp3write.ml
ocamlopt -c mp3info.ml
ocamlopt -c mp3types.cmx pack.cmx mp3framehuffman.ml
ocamlopt -c mp3types.cmx pack.cmx mp3framehuffman.cmx mp3frameutils.ml
ocamlopt -c mp3queue.ml
File "mp3queue.ml", line 312, characters 6-18:
Warning 26: unused variable bitrate_list.
File "mp3queue.ml", line 361, characters 5-18:
Warning 26: unused variable print_bitrate.
File "mp3queue.ml", line 347, characters 5-26:
Warning 26: unused variable update_side_reservoir.
File "mp3queue.ml", line 115, characters 5-13:
Warning 26: unused variable debug_in.
File "mp3queue.ml", line 420, characters 28-2840:
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
{side_bits=[|  |]}
File "mp3queue.ml", line 479, characters 18-2324:
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
{side_bits=[|  |]}
File "mp3queue.ml", line 538, characters 24-1361:
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
{side_bits=[|  |]}
File "mp3queue.ml", line 577, characters 14-1514:
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
{side_bits=[|  |]}
ocamlopt -c multiproc.ml
File "multiproc.ml", line 163, characters 3-65:
Warning 5: this function application is partial,
maybe some arguments are missing.
File "multiproc.ml", line 219, characters 3-65:
Warning 5: this function application is partial,
maybe some arguments are missing.
File "multiproc.ml", line 359, characters 5-88:
Warning 10: this expression should have type unit.
ocamlopt -o mp3packer.exe unix.cmxa str.cmxa crc.cmx list2.cmx expandarray.cmx c_part.o mp3types.cmx pack.cmx mp3read.cmx mp3write.cmx mp3info.cmx mp3framehuffman.cmx mp3frameutils.cmx mp3queue.cmx multiproc.cmx mp3packer.ml
File "mp3packer.ml", line 331, characters 8-14:
Warning 26: unused variable errors.
File "mp3packer.ml", line 335, characters 8-14:
Warning 26: unused variable errors.
ocamlopt -o mp3reader.exe unix.cmxa crc.cmx list2.cmx c_part.o mp3types.cmx pack.cmx mp3read.cmx mp3reader.ml
File "mp3reader.ml", line 1, characters 0-1:
Error: No implementations provided for the following modules:
         Str referenced from mp3types.cmx
make: *** [mp3reader] Error 2
Any ideas?
  • Last Edit: 21 October, 2011, 07:44:08 AM by db1989

  • Omion
  • [*][*][*][*]
  • Developer
MP3 repacker
Reply #499
@stereotype:

It looks like I haven't updated the mp3reader dependencies in the makefile. You can fix it by adding "str.cmxa" after "unix.cmxa" in the mp3reader line of the makefile:
Code: [Select]
<TAB>ocamlopt -o mp3reader$(EXE_EXT) unix.cmxa str.cmxa crc.cmx list2.cmx c_part$(OBJ_EXT) mp3types.cmx pack.cmx mp3read.cmx mp3reader.ml

(the <TAB> at the beginning should be an actual tab)

However, you probably don't need mp3reader at all. It's just a program to output MP3 statistics in a Mathematica-style format. Run this to just make mp3packer:
Code: [Select]
make mp3packer OBJ_EXT=.o

"We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel, H2G2