Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Monday, November 13, 2006 12:40:46 PM(UTC)

adamani  
adamani

Groups: Registered
Posts: 6


I would like to generate an AVI file with my own bitmaps along with audio capture.  The GenAvi example only shows how to generate an AVI file with bitmaps.

Can anyone provide c++ code that I could use with the GenAvi sample to also capture audio?

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Tuesday, November 14, 2006 2:40:37 AM(UTC)

Qasem Lubani  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)










There might be more than one way to do this, but
the appropriate approach depends on how exactly you have the images, and how you want to mix them.

If you want to do saving of the A-V data while the
audio is being fed in real-time, you must have a quick way of obtaining the video images to be able to catch up with the audio.

On the other hand, if you can capture the audio alone then mix with the video, see the following post for some hints about it:


http://support.leadtools.com/SupportPortal/cs/forums/9602/ShowPost.aspx#9602
 
#3 Posted : Tuesday, November 14, 2006 8:38:23 AM(UTC)

adamani  
adamani

Groups: Registered
Posts: 6


I would like to capture the audio in real-time from the sound card.  Do you know what objects I need to work with so that I can modify the GenAvi sample?

I do have a quick way to get the bitmap images and I know how to get audio data from the sound card.  I just need to know which objects to use to also feed the sound data along with the video data as done in the GenAvi sample.

If you can guide me on what to modify in the GenAvi sample to also add the audio capture, I would really appreciate it.

 

 
#4 Posted : Wednesday, November 15, 2006 5:25:06 AM(UTC)

Qasem Lubani  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)


My suggestion is not to use GenAVI, but use the Video Callback multimedia filter instead.


Here's how to proceed:


1. Use the ltmmCapture control to capture audio from your audio device and video from a dummy video source.


The dummy video source could be a still image
(bitmap) read through the LEAD Still Image Reader filter, or it could be any video source.


2. Insert the LEAD Video Callback filter into the capture graph to interrupt the video stream.


3. The callback function is called with every
frame, which enables you to take one of your bitmaps and replace the video frame data with this bitmap.




 I recommend checking the Video Callback demo
shipped with the toolkit. This demo uses our LEADTOOLS Raster Imaging Pro
toolkit, so if you don't have it, download the free evaluation edition from our
site. However, the functionality you need does not necessarily require our
Imaging toolkit, and the Multimedia toolkit with the DirectShow filters will probably be enough.

 
#5 Posted : Wednesday, November 22, 2006 3:23:09 PM(UTC)

adamani  
adamani

Groups: Registered
Posts: 6


Yes the Video Callback filter method works but the Video Callback filter requires a runtime license.

Can you suggest doing this some other way?

 
#6 Posted : Thursday, November 23, 2006 1:01:24 AM(UTC)

Qasem Lubani  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)


There is another approach you could try.




Use ltmmCapture control to capture audio from the
Audio device. The target for this control will be the TargetObject property, an object of type ltmmSampleTarget (say AudioTarget).




Also use ltmmConvert control whose source is the SourceObject property, an object of type ltmmMultiStreamSource.


You need to feed this MultiStream object 2 streams:


- Audio stream from AudioTarget above.


- Video stream, created from your video samples. This is similar in many ways to the GenAVI sample.




The other parts (feeding audio and using
multi-stream objects) are shown in the help topic "Replace Audio using IltmmMultiStreamSource and IltmmMultiStreamTarget Example".

 
#7 Posted : Thursday, November 23, 2006 5:59:07 PM(UTC)

adamani  
adamani

Groups: Registered
Posts: 6


I would really appreciate it if you could give me some c++ sample code on how to set this all up.

thanks.
 
#8 Posted : Monday, November 27, 2006 1:05:36 AM(UTC)

Qasem Lubani  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)


I'm afraid we currently don't have an example that
performs this exact task. However, the sample code in the 2 topics mentioned
above (GenAVI and Replace Audio) contain between them the majority of code you need.

 
#9 Posted : Monday, November 27, 2006 9:04:23 AM(UTC)

adamani  
adamani

Groups: Registered
Posts: 6


I was able to figure it out.

Is the IltmmMultiStreamSource object thread safe?  Can I call DeliverSample(0,1000, pMediaSample) and DeliverSample(1,1000, pMediaSample) from different threads?  Do the calls need to be synchronized or can I call them at the same time from different threads?

 

 
#10 Posted : Tuesday, November 28, 2006 5:55:09 AM(UTC)

Qasem Lubani  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)


Are you considering calling the DeliverSample method twice on the same instance of the object from different threads?


Or do you want to have 2 different object instances used in 2 threads.

 
#11 Posted : Tuesday, November 28, 2006 12:32:50 PM(UTC)

adamani  
adamani

Groups: Registered
Posts: 6


Since I am using a multistream source object, I am calling DeliverSample twice on the same instance object from different threads.  One thread delivers video on stream #0 and the other thread delivers audio samples on stream #1.

 
#12 Posted : Friday, December 1, 2006 6:27:29 AM(UTC)

Otis  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

I would try this method which should work but since it is slightly more complex, it will require more coding.

Another graph can be created with ltmmCapture for capturing the audio. This must be assigned the ltmmSampleTarget object on output. It will be the source of the audio samples for the application. Using ltmmMultiStreamSource and ltmmConvert another graph can be constructed to generate the AVI with audio and video. The application would simpy be fed audio from the capture graph and generate video frames internally. These can all be sent to the convert graph for AVI output.

 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.226 seconds.