Re: how to write part of a mp3 file into a new file.

4 views
Skip to first unread message

Alessandro Angeli [MVP::DigitalMedia]

unread,
Feb 21, 2005, 4:47:20 AM2/21/05
to
andy wrote:

> I want to extract part of a mp3 file and write it into a
> new mp3.
> Now I am trying the graph below:
>
> File Source -> MPEG1 Stream Splitter -> Dump
>
> But I find on many occasions, I can't get the correct
> duration, or seek to the correct position of I want.
> Do you have any idea what should I do?

DirectShow in general requires some work even for simple
editing tasks like this and the stock filters are not really
adeguate. IMHO, the best and easier way is to parse the MP3
file yourself. MP3 has a very simple structure and, as long
as you cut on audio frame boundaries, you should be fine (by
the way, counting the frames while scanning the file will
also provide accurate timing). Here is some sample code
regarding MP3 parsing:

http://groups-beta.google.com/group/microsoft.public.win32.programmer.mmedia/msg/a2952ae237dc099d

Here is all the info you need about MP3 parsing:

http://www.wotsit.org/download.asp?f=mpeghdr

The following may also be useful:

http://www.wotsit.org/download.asp?f=mpeg3

http://www.wotsit.org/download.asp?f=mpeg3src


--

// Alessandro Angeli
// MVP :: Digital Media
// a dot angeli at psynet dot net


andy

unread,
Feb 21, 2005, 3:51:01 AM2/21/05
to
I want to extract part of a mp3 file and write it into a new mp3.
Now I am trying the graph below:

File Source -> MPEG1 Stream Splitter -> Dump

But I find on many occasions, I can't get the correct duration, or seek to
the correct position of I want.
Do you have any idea what should I do?

Thanks.

Reply all
Reply to author
Forward
0 new messages