Discussion:
combining video and audio?
(too old to reply)
l***@gmail.com
17 years ago
Permalink
Hi,

I have a capture module (written in non-directshow) that captures the
video and audio to separate video (AVI) and audio (MP3) files. I'm
looking for some sample code that would show me how to combine the two
into one AVI file. C++ would be great, but c# might be good too.

thanks so much for _any_ help,
Lior
Alessandro Angeli
17 years ago
Permalink
Post by l***@gmail.com
I have a capture module (written in non-directshow) that
captures the video and audio to separate video (AVI) and
audio (MP3) files. I'm looking for some sample code that
would show me how to combine the two into one AVI file.
C++ would be great, but c# might be good too.
Build the following graph (you can try it in in GraphEdit):

AsyncReader (AVI)
-> AVISplitter
-> AVIMux -> FileWriter
-> MPEG1Splitter
AsyncReader (MP3)

Configure the AVIMux to create an index and to fully
interleave the streams.

If the stream were in sync, they will stay in sync when
muxed together.

You can replace the AsyncReader+MPEG1Splitter with the
WMASFReader if you want to (handles MP3s better if they are
VBR or have ID3 tags or other non-fully compliant features).
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
l***@gmail.com
17 years ago
Permalink
Ok, that was very helpful, but here is where I'm at: the MP3 that I
have is created with lame_enc.dll (capturing the audio). the Graph
Edit tells me that 'these filters cannot agree on a connection. Verify
type compatibility of input pin and out pin'. Now, if I take another
MP3 file it allows connection

any ideas?

thanks much,
Lior
Alessandro Angeli
17 years ago
Permalink
Post by l***@gmail.com
Ok, that was very helpful, but here is where I'm at: the
MP3 that I have is created with lame_enc.dll (capturing
the audio). the Graph Edit tells me that 'these filters
cannot agree on a connection. Verify type compatibility
of input pin and out pin'. Now, if I take another MP3
file it allows connection
An MP3 is an MP3, no matter how it was created (as long as
it follows the standard and LAME is supposed to). Does that
happen with the MPEG1Splitter and/or the WMASFReader? Can
you post the first 16KiB of the file in hex?
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
l***@gmail.com
17 years ago
Permalink
Hi Alessando,

and thanks. I found the issue. I didnt include the following commands.
when I do, it connects:

mixerline.UnMute();
mixerline.SetVolume(60);
mixerline.Select();
mixer.Close();

now there are time stamps problems, but I think this is covered in
another thread (http://groups.google.com/group/
microsoft.public.multimedia.directx.dshow.programming/browse_thread/
thread/5d8b00560508f37a/e987a9e79eebc94b?lnk=gst&q=AVI+File%3A
+combining+MPEG4+compressed+video+and+MP3+compressed
+audio&rnum=1&hl=en#e987a9e79eebc94b)

BTW, with AVIMUX GUI program (http://www.alexander-noe.com/video/amg/)
it does work, so I'm thinking of getting the (open) sources from there

thanks,
Lior
...
Loading...