PDA

View Full Version : Streaming AVIS from two cameras synchronously by using trigger



nabla
July 13, 2009, 11:52:08
Hi i'm using an external trigger for two firewire-cameras.

Now i want to capture two avis in parallel by using the following code:




Grabber grabber2;
grabber2.openDev( "DMx 21BF04 1" );
grabber2.setVideoFormat( "Y800 (640x480)" );
grabber2.setExternalTrigger(true);

tCodecListPtr pCodecs = Codec::getAvailableCodecs();

choice = 0;

// Create a media stream sink to record AVI files, using this codec.
tMediaStreamContainerPtr pAVIContainer1 = MediaStreamContainer::create( MSC_AviContainer );
tMediaStreamContainerPtr pAVIContainer2 = MediaStreamContainer::create( MSC_AviContainer );


tMediaStreamSinkPtr pSink1 = MediaStreamSink::create( pAVIContainer1, pCodecs->at( choice ) );
pSink1->setSinkMode( GrabberSinkType::ePAUSE );
pSink1->setFilename( "ctest1.avi" );
tMediaStreamSinkPtr pSink2 = MediaStreamSink::create( pAVIContainer2, pCodecs->at( choice ) );
pSink2->setSinkMode( GrabberSinkType::ePAUSE );
pSink2->setFilename( "ctest2.avi" );

grabber1.setSinkType( pSink1 );
grabber2.setSinkType( pSink2 );

grabber1.startLive(true);
grabber2.startLive(true);

std::cout << "Press [enter] to start capturing!" << std::endl;
std::cin.get();

pSink1->setSinkMode(GrabberSinkType::eRUN );
pSink2->setSinkMode(GrabberSinkType::eRUN );

std::cout << "Video recording started." << std::endl;
std::cout << "Press [enter] to stop capturing!";
std::cin.get();

pSink1->setSinkMode(GrabberSinkType::ePAUSE );
pSink2->setSinkMode(GrabberSinkType::ePAUSE );

std::cout << "Video recording stopped." << std::endl;

// GrabberSinkType::ePAUSE. The AVI file is closed.
grabber1.stopLive();
grabber2.stopLive();



I get always the following run-time error:


File: c:\ic 3.0\core\dshowlibgeneral\dynamicfilterchain.cpp
Line: 238

Message: CDynamicFilterChain, failed to disconnect pin of filter.

I have no idea what is the problem ?

Thanks in advance for your help !

Sascha Schmidt
July 13, 2009, 14:31:17
Hallo nabla,

I think it is not possible to use one codec instance in two sinks.

So please try it as follows:



tCodecListPtr pCodecsA = Codec::getAvailableCodecs();
tCodecListPtr pCodecsB = Codec::getAvailableCodecs();

//..

tMediaStreamSinkPtr pSink1 = MediaStreamSink::create( pAVIContainer1, pCodecsA->at( choice ) );

//..

tMediaStreamSinkPtr pSink2 = MediaStreamSink::create( pAVIContainer2, pCodecsB->at( choice ) );

nabla
July 13, 2009, 17:00:47
That was the solution...

Thanks a lot !