IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Huge problem with LAME and MP3 in Flash
mluggy
post Feb 28 2006, 20:46
Post #1





Group: Members
Posts: 7
Joined: 22-October 05
Member No.: 25272



Hi guys,

I just switched to Lame for encoding of hunderds of music files.

I use the following command:
lame.exe -b 64 --cbr --nogap --quiet file1.wav file1.mp3

I then join all mp3 files using
copy /b *.mp3 final.mp3

The file plays great on my Windows Media Player and Winamp, however when I try to stream it through a web flash player, I get fast-forward. see here:
http://www.israel-music.com/efraim_shreibe...rim_shpil_3000/

The original file is here:
http://www.israel-music.com/temp/orig.mp3

Is there any way to fix that? What am I doing wrong?

Thanks!

Michael.
Go to the top of the page
+Quote Post
Synthetic Soul
post Feb 28 2006, 21:06
Post #2





Group: Super Moderator
Posts: 4887
Joined: 12-August 04
From: Exeter, UK
Member No.: 16217



QUOTE (mluggy @ Feb 28 2006, 07:46 PM)
I then join all mp3 files using
copy /b *.mp3 final.mp3
You can't join MP3 files in this way. Each file has a header, so by joining two files together the second file's header will end up part way through the new file. I guess Flash's player can't cope with this. It is bad practice at best.

musiCutter will join MP3 files. Presumably it will do so correctly.


--------------------
I'm on a horse.
Go to the top of the page
+Quote Post
rosshmusic
post Feb 28 2006, 22:10
Post #3





Group: Members
Posts: 101
Joined: 18-October 05
Member No.: 25196



and you can also use the function in foobar to export mutiple tracks as one file using the converter (I believe diiskwriter can do this as well...

load the wav files and then select all of them (in the order you want them in) and use the converter to export as a single file (using any encoder you want - for you it would just mean making a custom mp3 command line entry)....

I do this all the time with mis-tracked live shows... I can't imagine it wouldn't work for your application... they sound (well, like the chipmunks) like sample clips from the CD, in which case this would work fine....
Go to the top of the page
+Quote Post
Synthetic Soul
post Feb 28 2006, 22:50
Post #4





Group: Super Moderator
Posts: 4887
Joined: 12-August 04
From: Exeter, UK
Member No.: 16217



Sorry, yes; if you have the WAV files then the best option is to concatenate these, and then encode the large WAV to MP3.

For some reason I'd got it into my head that you only had MP3 as source.

Thanks rosshmusic.


--------------------
I'm on a horse.
Go to the top of the page
+Quote Post
mluggy
post Feb 28 2006, 23:27
Post #5





Group: Members
Posts: 7
Joined: 22-October 05
Member No.: 25272



Do you think there's any way I can rescue the hunderds of files done this way? re-encoding with the basic LAME params didn't help :-(
Go to the top of the page
+Quote Post
[JAZ]
post Feb 28 2006, 23:45
Post #6





Group: Members
Posts: 1797
Joined: 24-June 02
From: Catalunya(Spain)
Member No.: 2383



QUOTE (Synthetic Soul @ Feb 28 2006, 09:06 PM)
You can't join MP3 files in this way.  Each file has a header, so by joining two files together the second file's header will end up part way through the new file.

*


MP3 does not have a "main" header, at least if we talk about CBR files, which is the case. Sure we could argue that the first frame has the LAME header, but that is skipped by a decoder.


The problem is not in the way it is joined. I *think* that the reason could be that the mp3 is mono, and flash assumes it is stereo.
If the reason is really this one, you can't fix it, except if there is an option in flash to change the number of channels.

Edit: It could be the samplerate too, but i thought flash supported them.

This post has been edited by [JAZ]: Mar 1 2006, 00:01
Go to the top of the page
+Quote Post
Synthetic Soul
post Mar 1 2006, 11:07
Post #7





Group: Super Moderator
Posts: 4887
Joined: 12-August 04
From: Exeter, UK
Member No.: 16217



QUOTE ([JAZ] @ Feb 28 2006, 10:45 PM)
QUOTE (Synthetic Soul @ Feb 28 2006, 09:06 PM)
You can't join MP3 files in this way.  Each file has a header, so by joining two files together the second file's header will end up part way through the new file.
MP3 does not have a "main" header, at least if we talk about CBR files, which is the case. Sure we could argue that the first frame has the LAME header, but that is skipped by a decoder.

The problem is not in the way it is joined. I *think* that the reason could be that the mp3 is mono, and flash assumes it is stereo.
I just concatenated some MP3s using this method. I then loaded the new file into foobar 0.9, and the reported track length is that of the first track.

This doesn't sound successful to me.

That said, I don't seem to have faired too well in this thread so far, so I probably should have just got out while the going was (midly) good. unsure.gif


--------------------
I'm on a horse.
Go to the top of the page
+Quote Post
Synthetic Soul
post Mar 1 2006, 16:46
Post #8





Group: Super Moderator
Posts: 4887
Joined: 12-August 04
From: Exeter, UK
Member No.: 16217



OK, I've just tried this again, with the same results. However, Gabriel posted this in another thread:

QUOTE (Gabriel @ Mar 1 2006, 03:12 PM)
QUOTE
Also the following (Copy /b *.mp3 combined.mp3) creates invalid format.
This command should produce valid streams, provided that you respect the following:
*same number of channels
*same sampling freq
*no id3/ape/whatever tag

So, is this a bug in foobar? Mr QuestionMan "correctly" reports the file to be 43:47. foobar 0.9 reports it as 2:31. If I play it only the first song plays (i.e.: it plays for 2:31 also).

foobar 0.8.3 also reports the file as 2:31.

MQM report can be viewed here.

I don't like spreading mistruths, so I would like to see a satisfactory conclusion to this. I'm probably doing something really dumb.

This post has been edited by Synthetic Soul: Mar 1 2006, 16:54


--------------------
I'm on a horse.
Go to the top of the page
+Quote Post
Synthetic Soul
post Mar 1 2006, 17:31
Post #9





Group: Super Moderator
Posts: 4887
Joined: 12-August 04
From: Exeter, UK
Member No.: 16217



I've just tested this using -t to stop LAME.EXE writing the LAME tag, and foobar now reports the correct length.

Opinions?

This post has been edited by Synthetic Soul: Mar 1 2006, 17:32


--------------------
I'm on a horse.
Go to the top of the page
+Quote Post
senab
post Mar 1 2006, 17:40
Post #10





Group: Members
Posts: 247
Joined: 4-August 05
From: Birmingham, UK
Member No.: 23690



QUOTE (Synthetic Soul @ Mar 1 2006, 04:31 PM)
I've just tested this using -t to stop LAME.EXE writing the LAME tag, and foobar now reports the correct length.

Opinions?
*


Well it looks like Foobar is relying on the LAME tag a little too much. Maybe it's something to post in the Foobar Bug forum?

What version of Foobar was you using btw?


--------------------
::.. www.senab.co.uk
Go to the top of the page
+Quote Post
Gabriel
post Mar 1 2006, 17:56
Post #11


LAME developer


Group: Developer
Posts: 2950
Joined: 1-October 01
From: Nanterre, France
Member No.: 138



By default Lame includes a TOC into the first frame ancillary data. This data is skipped by decoders that do not know how to handle it.
Concatenation of mp3 files produces a correct mp3 stream, compliant with the standard.
However, it might happen that some players that know about the additionnal TOC will see the initial TOC, which is the TOC of the first file, and trust it to be the correct TOC for the new file.
You can not really blame players for such behavior.
Anyway, this does not impact compliance of the resulting mp3 stream.
Go to the top of the page
+Quote Post
Synthetic Soul
post Mar 1 2006, 18:10
Post #12





Group: Super Moderator
Posts: 4887
Joined: 12-August 04
From: Exeter, UK
Member No.: 16217



Thanks for the technical info Gabriel.

It's not much use being compliant if I can only play the first track of an album in foobar, or other players that rely on the TOC, though.

I just went to the URL quoted in the first post. Firstly, the result is hilarious. Secondly, could this double-time be caused by the fact that the data and initial TOC don't match?

Rather than me try to dig myself out of my hole I thought I could divert attention back on to the original question: why does the Flash player have trouble with these files?

While you ponder that I'm ducking back under the stone I crawled out from...

QUOTE ([JAZ] @ Feb 28 2006, 10:45 PM)
I *think* that the reason could be that the mp3 is mono, and flash assumes it is stereo.
If the reason is really this one, you can't fix it, except if there is an option in flash to change the number of channels.

Edit: It could be the samplerate too, but i thought flash supported them.
This could be easily tested by simply using a non-concatenated file couldn't it?

mluggy, do you get the same issue using one of the original files (before you merge it using COPY)?

This post has been edited by Synthetic Soul: Mar 1 2006, 18:22


--------------------
I'm on a horse.
Go to the top of the page
+Quote Post
Shade[ST]
post Mar 1 2006, 18:40
Post #13





Group: Members
Posts: 1189
Joined: 19-May 05
From: Montreal, Canada
Member No.: 22144



Would using foobar2000's "fix entire stream" in "fix mp3 header" feature work to fix this problem?
Go to the top of the page
+Quote Post
Synthetic Soul
post Mar 1 2006, 18:44
Post #14





Group: Super Moderator
Posts: 4887
Joined: 12-August 04
From: Exeter, UK
Member No.: 16217



I tried a couple of settings, a few of which included rewriting the whole stream, and it didn't work.

That's not to say it definately won't; I'm not that up on this tool. Nothing I tried worked though.


--------------------
I'm on a horse.
Go to the top of the page
+Quote Post
xmixahlx
post Mar 1 2006, 21:01
Post #15





Group: Members
Posts: 1394
Joined: 20-December 01
From: seattle
Member No.: 693



wouldn't you pipe the multiple wav inputs into lame? like:

sox *wav -t wav - | lame - filename.mp3

joining afterwards seems weird to me, but whatever...


later

This post has been edited by xmixahlx: Mar 1 2006, 21:01


--------------------
RareWares/Debian :: http://www.rarewares.org/debian.html
Go to the top of the page
+Quote Post
mluggy
post Mar 1 2006, 22:28
Post #16





Group: Members
Posts: 7
Joined: 22-October 05
Member No.: 25272



QUOTE (xmixahlx @ Mar 1 2006, 02:01 PM)
wouldn't you pipe the multiple wav inputs into lame? like:

sox *wav -t wav - | lame - filename.mp3

joining afterwards seems weird to me, but whatever...


later
*


That worked great when trying new files - Thank you so much! and thank you Synthetic soul for the effort. I had followed your recommendations (using -t, fixing streams, etc.) but apparently I needed a real tool (like SOX) to join the files together.

Now if I could only fix these old problematic files.. :-(
Go to the top of the page
+Quote Post
Synthetic Soul
post Mar 2 2006, 09:55
Post #17





Group: Super Moderator
Posts: 4887
Joined: 12-August 04
From: Exeter, UK
Member No.: 16217



QUOTE (mluggy @ Mar 1 2006, 09:28 PM)
thank you Synthetic soul for the effort. I had followed your recommendations (using -t, fixing streams, etc.) but apparently I needed a real tool (like SOX) to join the files together.
See posts 3 and 4. It was suggested back then that you join the WAVE files, if you had them, and then convert to MP3.

QUOTE (mluggy @ Mar 1 2006, 09:28 PM)
Now if I could only fix these old problematic files.. :-(
See posts 5 to 14. We are trying to work out where the process has fallen down. Are you able to answer my question in post 12 please?

With regard to the files that you have already merged: do you have the original WAVE files? If not, do you have the MP3 files before they were joined (i.e.: if "a.mp3" and "b.mp3" are joined to make "c.mp3" do you still have "a.mp3" and "b.mp3", so that perhaps you can make "d.mp3")?

If you still have the source WAVE files then you could use SOX in a batch file to do all joins in one run.

If you don't have the source WAVE files but have the source MP3 files, depending on your answer to my question, we may be able to help you batch join these also.

Either way I'd really appreciate an answer to my question. This thread contains information that may be useful to other members who want to join MP3s and/or want to use MP3 with Flash. If we can tie up all the loose ends it may help other members with the same problems. Thanks.


--------------------
I'm on a horse.
Go to the top of the page
+Quote Post
mluggy
post Mar 2 2006, 11:00
Post #18





Group: Members
Posts: 7
Joined: 22-October 05
Member No.: 25272



QUOTE (Synthetic Soul @ Mar 2 2006, 02:55 AM)
See posts 3 and 4.  It was suggested back then that you join the WAVE files, if you had them, and then convert to MP3.

I had the original WAV files of only 1 CD so I tried that. Concating the WAV first using copy /b didn't work in flash. Using FooBar's Convert into a single file worked well, but I couldn't see how this can be automated, so I let it go.

QUOTE (Synthetic Soul @ Mar 2 2006, 02:55 AM)
See posts 5 to 14.  We are trying to work out where the process has fallen down.  Are you able to answer my question in post 12 please?

I tried encoding the merged file in Mono and fixing the stream using Foobar's FIX options - it didn't work in Flash. I didn't test a single (non-concated) track as it appear a useless test.

QUOTE (Synthetic Soul @ Mar 2 2006, 02:55 AM)
With regard to the files that you have already merged: do you have the original WAVE files?  If not, do you have the MP3 files before they were joined (i.e.: if "a.mp3" and "b.mp3" are joined to make "c.mp3" do you still have "a.mp3" and "b.mp3", so that perhaps you can make "d.mp3")?

If you still have the source WAVE files then you could use SOX in a batch file to do all joins in one run.

If you don't have the source WAVE files but have the source MP3 files, depending on your answer to my question, we may be able to help you batch join these also.

Either way I'd really appreciate an answer to my question.  This thread contains information that may be useful to other members who want to join MP3s and/or want to use MP3 with Flash.  If we can tie up all the loose ends it may help other members with the same problems.  Thanks.
*


Since I don't have the original WAV files I can't use the new SOX batch (which works great). I do have the MP3 files and i'll appriciate any idea on how to fix those (uptill now i've tried re-encoding with various LAME switches and bitrates).

Here's the process I use with SOX, simply create this as a batch file:

CODE
@echo off
set /p varname="Enter MP3 filename to export (i.e - final.mp3)"
C:
cd\
cd PATH_TO_WAV_FILES
C:\PATH_TO_SOX\sox *.wav -t wav chunk.wav
C:\PATH_TO_LAME\lame.exe -b 64 --cbr -m m --quiet chunk.wav C:\PATH_TO_EXPORT\%varname%
del *.wav

For some reason concating everything on the same line didn't work as well, so I had to manually browse the WAV directory and perform the process in 2 phases.

Thanks again!

This post has been edited by mluggy: Mar 7 2006, 08:34
Go to the top of the page
+Quote Post
Synthetic Soul
post Mar 2 2006, 11:59
Post #19





Group: Super Moderator
Posts: 4887
Joined: 12-August 04
From: Exeter, UK
Member No.: 16217



QUOTE (mluggy @ Mar 2 2006, 10:00 AM)
I didn't test a single (non-concated) track as it appear a useless test.
[JAZ] suggested that it is purely the fact that the file is mono and/or has the wrong samplerate, and not the concatenation process that was causing the problem in Flash.

If you test a file that hasn't been concatenated, or tell me that you know this (not) to be the case, you can prove or disprove this. We then know where to keep looking.

I promise I am not asking you to do things for my own amusement. blink.gif

This post has been edited by Synthetic Soul: Mar 2 2006, 12:08


--------------------
I'm on a horse.
Go to the top of the page
+Quote Post
mluggy
post Mar 2 2006, 17:00
Post #20





Group: Members
Posts: 7
Joined: 22-October 05
Member No.: 25272



Jaz might've been right! I did numerous other tests and the final mp3 worked correctly ONLY when encoding as mono (i.e - adding "-m m" switch to LAME).

I tried re-encoding the old files with "-m m" and it didn't work, however. I guess they were ruined.
Go to the top of the page
+Quote Post
Synthetic Soul
post Mar 2 2006, 17:21
Post #21





Group: Super Moderator
Posts: 4887
Joined: 12-August 04
From: Exeter, UK
Member No.: 16217



QUOTE ([JAZ] @ Feb 28 2006, 10:45 PM)
I *think* that the reason could be that the mp3 is mono, and flash assumes it is stereo.
If the reason is really this one, you can't fix it, except if there is an option in flash to change the number of channels.

Edit: It could be the samplerate too, but i thought flash supported them.
QUOTE (mluggy @ Mar 2 2006, 04:00 PM)
Jaz might've been right! I did numerous other tests and the final mp3 worked correctly ONLY when encoding as mono (i.e - adding "-m m" switch to LAME).

I tried re-encoding the old files with "-m m" and it didn't work, however. I guess they were ruined.
I think I give up. I'm getting an ulcer.


--------------------
I'm on a horse.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 20th December 2014 - 04:19