Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Page 1 of 2 1 2 >
Topic Options
#149115 - 18/03/2003 19:24 Strip WAV headers from WAV-embedded MP3-files
smu
old hand

Registered: 30/07/2000
Posts: 879
Loc: Germany (Ruhrgebiet)
Hi.

I have some MP3 files which someone (quite idiotically) embedded into WAV files. Now I need to strip these headers, because the empeg (or at least jemplode) does not recognize these as valid MP3 files. Does anyone know of a command line tool to do this?

Ciao,
Sven
_________________________
proud owner of MkII 40GB & MkIIa 60GB both lit by God and HiJacked by Lord

Top
#149116 - 18/03/2003 19:59 Re: Strip WAV headers from WAV-embedded MP3-files [Re: smu]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
I can't seem to find a tool, but it shouldn't be too hard to write one, based on the RIFF spec.
_________________________
Bitt Faulk

Top
#149117 - 18/03/2003 21:08 Re: Strip WAV headers from WAV-embedded MP3-files [Re: smu]
Ezekiel
pooh-bah

Registered: 25/08/2000
Posts: 2413
Loc: NH USA
Have you tried the repair options in Mp3 Tag Studio?

-Zeke
_________________________
WWFSMD?

Top
#149118 - 19/03/2003 02:47 Re: Strip WAV headers from WAV-embedded MP3-files [Re: smu]
simspos
enthusiast

Registered: 28/03/2002
Posts: 230
Loc: Dudley, UK
Found this link, seems to do what you want, but I have no experience of it.

--------------

http://minnie.tuhs.org/pipermail/mp3encoder/2002-February/004595.html

Hi Jaroslav,

You could try "WaveMP3" rel. 1.2

Adds/strips a Wave Riff header to/from your MP3 files.

http://home.pi.be/~mk442837/
http://home.pi.be/~mk442837/wavemp3.zip

Top
#149119 - 19/03/2003 11:07 Re: Strip WAV headers from WAV-embedded MP3-files [Re: Ezekiel]
smu
old hand

Registered: 30/07/2000
Posts: 879
Loc: Germany (Ruhrgebiet)
Does MP3 Tag Studio have a command line interface? I don't think so. And I already have a graphical client which can handle complete directories (not recursively descending into subdirs though): WaveMP3

Ciao,
Sven
_________________________
proud owner of MkII 40GB & MkIIa 60GB both lit by God and HiJacked by Lord

Top
#149120 - 19/03/2003 13:40 Re: Strip WAV headers from WAV-embedded MP3-files [Re: smu]
Ezekiel
pooh-bah

Registered: 25/08/2000
Posts: 2413
Loc: NH USA
Sorry, didn't see the command line bit on your post, I tend to skim.

Thanks for the scarcasm though, it's really [censored] appreciated. Ass.

I'm done.

-Zeke
_________________________
WWFSMD?

Top
#149121 - 19/03/2003 14:00 Re: Strip WAV headers from WAV-embedded MP3-files [Re: Ezekiel]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
Hey, lighten up... I don't think that was sarcasm. I think he genuinely wanted to know whether or not MP3TS had a command line interface. Many GUI applications do. I use MP3TS every day and I still don't know whether it has a command line interface.
_________________________
Tony Fabris

Top
#149122 - 19/03/2003 14:08 Re: Strip WAV headers from WAV-embedded MP3-files [Re: Ezekiel]
smu
old hand

Registered: 30/07/2000
Posts: 879
Loc: Germany (Ruhrgebiet)
Hi.

Tony is half right. I really wanted to know wether MP3TS has a command line interface or not. I can't deny a little bit of sarcasm though. Sorry it made you feel bad.

Ciao,
Sven
_________________________
proud owner of MkII 40GB & MkIIa 60GB both lit by God and HiJacked by Lord

Top
#149123 - 19/03/2003 17:45 Re: Strip WAV headers from WAV-embedded MP3-files [Re: smu]
Ezekiel
pooh-bah

Registered: 25/08/2000
Posts: 2413
Loc: NH USA
That's OK. Sorry for having to putting up with my nasty reply. Bad afternoon and not enough food. Your post triggered a bit of rage. I really didn't see the bit about the command line. I know Magnus stops by the BBS every so often. I didn't see anything useful in the Help files.

-Zeke
_________________________
WWFSMD?

Top
#149124 - 19/03/2003 17:52 Re: Strip WAV headers from WAV-embedded MP3-files [Re: smu]
Ezekiel
pooh-bah

Registered: 25/08/2000
Posts: 2413
Loc: NH USA
http://cbothamy.free.fr/projects/id3ren/

May help or serve as a starting point for a roll your own. Haven't tried it.

-Zeke
_________________________
WWFSMD?

Top
#149125 - 20/03/2003 00:50 Re: Strip WAV headers from WAV-embedded MP3-files [Re: Ezekiel]
jarob10
enthusiast

Registered: 07/01/2002
Posts: 274
Loc: Stockport, UK
In reply to:

http://cbothamy.free.fr/projects/id3ren/

May help or serve as a starting point for a roll your own. Haven't tried it.




Anyone aware of a similar program to this that can handle id3v2 tags ? The one linked ablove cant (currently). It needs to be command line and windows compatible.

If MP3TS got command line support, that would obviously be the perfect solution.
_________________________
A coward you are, an expert on bulls you are not.

Top
#149126 - 20/03/2003 03:15 Re: Strip WAV headers from WAV-embedded MP3-files [Re: smu]
simspos
enthusiast

Registered: 28/03/2002
Posts: 230
Loc: Dudley, UK
What's with the "command line only" criteria. Isn't it all about getting the job done???

confused, Sim

Top
#149127 - 20/03/2003 05:36 Re: Strip WAV headers from WAV-embedded MP3-files [Re: simspos]
jarob10
enthusiast

Registered: 07/01/2002
Posts: 274
Loc: Stockport, UK
In reply to:

What's with the "command line only" criteria. Isn't it all about getting the job done???




batch file integration.

For me, at least.
_________________________
A coward you are, an expert on bulls you are not.

Top
#149128 - 20/03/2003 09:40 Re: Strip WAV headers from WAV-embedded MP3-files [Re: jarob10]
simspos
enthusiast

Registered: 28/03/2002
Posts: 230
Loc: Dudley, UK
Arrrr, that makes a lot of sense - just couldn't see the reasoning - stupid me

Cheers, Sim

Top
#149129 - 20/03/2003 09:56 Re: Strip WAV headers from WAV-embedded MP3-files [Re: smu]
JeffS
carpal tunnel

Registered: 14/01/2002
Posts: 2858
Loc: Atlanta, GA
If no one comes up with anything by the end of today I might be able to help. In a project I used to work on we had some utilities we’d written to handle reading/writing WAV files. I’ll have to dig out the code and try to remember exactly how it all worked, but if stripping out the header is all you need I think I can probably create a small command-line utility to do it for you after I get off work.
_________________________
-Jeff
Rome did not create a great empire by having meetings; they did it by killing all those who opposed them.

Top
#149130 - 20/03/2003 12:02 Re: Strip WAV headers from WAV-embedded MP3-files [Re: Ezekiel]
smu
old hand

Registered: 30/07/2000
Posts: 879
Loc: Germany (Ruhrgebiet)
[id3ren]

Seems to be quite useful and I can probably use it to solve another problem I'm having. I can't see an option to remove WAV/RIFF headers though.

Ciao,
Sven
_________________________
proud owner of MkII 40GB & MkIIa 60GB both lit by God and HiJacked by Lord

Top
#149131 - 20/03/2003 12:07 Re: Strip WAV headers from WAV-embedded MP3-files [Re: JeffS]
smu
old hand

Registered: 30/07/2000
Posts: 879
Loc: Germany (Ruhrgebiet)
That would be really nice, and indeed, I only need to remove the RIFF headers from an WAV encapsulated MP3 file. And this encapsulation really seems to consist of nothing else but a WAV file header.

cu,
Sven
_________________________
proud owner of MkII 40GB & MkIIa 60GB both lit by God and HiJacked by Lord

Top
#149132 - 20/03/2003 12:18 Re: Strip WAV headers from WAV-embedded MP3-files [Re: smu]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Do you know that the WAV file contains only one RIFF chunk? If so, you can just strip off the first twenty bytes of the file. If you don't know, then you'll have to parse the headers to find where the chunks begin and end, and strip each chunk's header out individually.

It should be pretty easy to determine if there's more than one chunk per file or not. Search for the four-character strings "fmt " and "data". If you see more than one, chances are that it's got more than one chunk, and you'll need a vaguely intelligent program to fix it. If there's not, then you should just be able to strip the first twent bytes off.

Under unix, you should be able to
strings file.wav | egrep '(fmt )|(data)'
What OS are you using? Could Perl be used?
_________________________
Bitt Faulk

Top
#149133 - 20/03/2003 12:51 Re: Strip WAV headers from WAV-embedded MP3-files [Re: wfaulk]
JeffS
carpal tunnel

Registered: 14/01/2002
Posts: 2858
Loc: Atlanta, GA
What OS are you using?

Yes, I'd need to know this if I was going to write a utility. Also, I believe Bitt's correct in that it really will be nothing more than deleting the first few bytes, depending on your file(s).
_________________________
-Jeff
Rome did not create a great empire by having meetings; they did it by killing all those who opposed them.

Top
#149134 - 20/03/2003 12:52 Re: Strip WAV headers from WAV-embedded MP3-files [Re: wfaulk]
smu
old hand

Registered: 30/07/2000
Posts: 879
Loc: Germany (Ruhrgebiet)
Do you know that the WAV file contains only one RIFF chunk?

I am not certain about this. I handled a few sample file with WaveMP3, and it removed more than just 20 bytes from some of the files, but I can't remember how much exactly.

The grep you proposed returns two matches on each file, one beeing "WAVEfmt " and one being "data".

Regarding the OS: The files reside on a Linux (SAMBA) file server, while I usually use Windows for most other things (well: eMail, Office (though, ironically, mostly LaTeX), webbrowsing etc.) because my notebook doesn't run too well under Linux and I don't have the time to find out why. So basically, both Windows and Linux could be used for this task. And Perl is available on both systems, perl 5.6.1 in both cases.

cu,
sven
_________________________
proud owner of MkII 40GB & MkIIa 60GB both lit by God and HiJacked by Lord

Top
#149135 - 20/03/2003 13:03 Re: Strip WAV headers from WAV-embedded MP3-files [Re: wfaulk]
smu
old hand

Registered: 30/07/2000
Posts: 879
Loc: Germany (Ruhrgebiet)
Do you know that the WAV file contains only one RIFF chunk?

I am not certain about this. I handled a few sample file with WaveMP3, and it removed more than just 20 bytes from some of the files, but I can't remember how much exactly. I ran it on oone more file just now, and WaveMP3 removed a total of 70 Bytes.

The grep you proposed returns two matches on each file, one beeing "WAVEfmt " and one being "data".

Regarding the OS: The files reside on a Linux (SAMBA) file server, while I usually use Windows for most other things (well: eMail, Office (though, ironically, mostly LaTeX), webbrowsing etc.) because my notebook doesn't run too well under Linux and I don't have the time to find out why. So basically, both Windows and Linux could be used for this task. And Perl is available on both systems, perl 5.6.1 in both cases.

cu,
sven
_________________________
proud owner of MkII 40GB & MkIIa 60GB both lit by God and HiJacked by Lord

Top
#149136 - 20/03/2003 13:07 Re: Strip WAV headers from WAV-embedded MP3-files [Re: smu]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
The fmt chunk, I believe, is metadata. I wouldn't have expected that to be there, but it shouldn't be too difficult to remove. At the same time, it does mean that it will be slightly more complicated than chopping off the first n bytes of data, as I don't think that we can rely on the fact that the fmt chunk will always be of a particular length.

Can you send me a copy of one of the shorter files? I can probably get some perl working in a few minutes.
_________________________
Bitt Faulk

Top
#149137 - 20/03/2003 13:30 Re: Strip WAV headers from WAV-embedded MP3-files [Re: wfaulk]
smu
old hand

Registered: 30/07/2000
Posts: 879
Loc: Germany (Ruhrgebiet)
The smallest file I can verify to really be with a valid RIFF encapsulation is about 6MB in size and available for download at http://www.incase.de/file1.wav in about ten minutes while the smallest file which looks like it is with RIFF encapsulation is about 700kB in size and available at http://www.incase.de/file2.wav.

Thanks for the offer.

[Edit: Both files are available now.]

Ciao,
Sven


Edited by smu (20/03/2003 13:42)
_________________________
proud owner of MkII 40GB & MkIIa 60GB both lit by God and HiJacked by Lord

Top
#149138 - 20/03/2003 14:36 Re: Strip WAV headers from WAV-embedded MP3-files [Re: smu]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
This is nice....

file1.wav isn't really a valid RIFF file. It's close and I can hack around it, but its data chunk (where it stores the actual mp3 data) has its length specified incorrectly. The ID3v1 tag lies just outside the chunk proper. file2.wav doesn't have a ID3v1 tag, so I can't tell if this is common or bad just in this case. Anyway, I've hacked around it. Give me a few and it'll be done.
_________________________
Bitt Faulk

Top
#149139 - 20/03/2003 14:58 Re: Strip WAV headers from WAV-embedded MP3-files [Re: wfaulk]
smu
old hand

Registered: 30/07/2000
Posts: 879
Loc: Germany (Ruhrgebiet)
I added an id3 tag (artist) to the smaller file and uploaded it as http://www.incase.de/file2.wav.

cu and thnx alot,
Sven
_________________________
proud owner of MkII 40GB & MkIIa 60GB both lit by God and HiJacked by Lord

Top
#149140 - 20/03/2003 15:14 Re: Strip WAV headers from WAV-embedded MP3-files [Re: wfaulk]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
I'm sure there's a bug or two, but here you go. It strips out the "data" chunk, which seems to be where the mp3 file is kept. I have tried to make it so that it will write multiple "data" chunks to the different files. I imagine that shouldn't happen, though.

There's a debug flag for printing out some additional data and a currdir flag for writing output to the current directory, even if the file was specified as ``../file.wav'' or whatever. Both are off as posted. You'll have to edit the source to change them; just change the appropriate variable to 1 instead of 0.

It can take multiple files as arguments, and will skip over those that aren't valid RIFF files.

It's not the prettiest code, but it should get the job done.

Let me know if it works.

Edit: There's a bug here. Don't use this one.


Attachments
147694-unriffmp3 (346 downloads)



Edited by wfaulk (20/03/2003 15:23)
_________________________
Bitt Faulk

Top
#149141 - 20/03/2003 15:18 Re: Strip WAV headers from WAV-embedded MP3-files [Re: smu]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
I don't see any ID3v1 tags in there. In fact, it's identical to the file2.wav you posted earlier.

Edit: Oh, I see. You meant file3.wav. It's even worse. It just had a tag tacked onto the end of the whole thing. Actually, that might be true of file1, too, except it happened to have the "data" chunk as the final chunk.

Hang on and I'll fix my code.


Edited by wfaulk (20/03/2003 15:21)
_________________________
Bitt Faulk

Top
#149142 - 20/03/2003 15:28 Re: Strip WAV headers from WAV-embedded MP3-files [Re: wfaulk]
JeffS
carpal tunnel

Registered: 14/01/2002
Posts: 2858
Loc: Atlanta, GA
It appears Bitt has you all fixed up, so I'll assume you don't need me to dig out those wav headers tonight . . . My wife will be glad to have me for another hour! Let me know if I can help at all.
_________________________
-Jeff
Rome did not create a great empire by having meetings; they did it by killing all those who opposed them.

Top
#149143 - 20/03/2003 15:34 Re: Strip WAV headers from WAV-embedded MP3-files [Re: wfaulk]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Okay. Here it is again.


Attachments
147697-unriffmp3 (348 downloads)

_________________________
Bitt Faulk

Top
#149144 - 20/03/2003 15:35 Re: Strip WAV headers from WAV-embedded MP3-files [Re: JeffS]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
I think your wav headers might have failed anyway. It seems that ID3v1 tags were just tacked on to the end of the files in some cases, outside RIFF encapsulation.
_________________________
Bitt Faulk

Top
Page 1 of 2 1 2 >