ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Capture Video Using Codec
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

ageu

Brazil
2 Posts

Posted - May 12 2016 :  16:16:16  Show Profile  Reply
I haveImageEn version 4.1.0.
I have used the component to capture images from a PCI vídeo capture using directshow. Code: ImageEnView1.IO.SaveToStreamJpeg(imgStream).
Now I need to capture the vídeo and save the vídeo as AVI file using H264 codec.
When I set the codec using the setVideoCodec function the ImagEnViewer doesn't show live vídeo. The event ImageEnView1DShowNewFrame is not fired. But the vídeo are saved in the file.
When I do not set codec. the ImagEnViewer show live vídeo. The event ImageEnView1DShowNewFrame is fired.
I did a test with the DirectShow1 Demo Project and have the same problem.
I don't know what it happening.
Any help are wellcome.
Best Regards,
Ageu

AlphaUniform

30 Posts

Posted - Aug 03 2016 :  08:57:14  Show Profile  Reply
Same problem here with Version 6.3.0.
Any chance to get CompressedVideo Capture with Livepreview?

Best regards,
Alex
Go to Top of Page

xequte

38610 Posts

Posted - Aug 07 2016 :  19:55:27  Show Profile  Reply
Hi Alex

I assume ImageEnView1.DShowParams.EnableSampleGrabber is true?

Do you get other events for TImageEnView.OnDShowEvent?



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

AlphaUniform

30 Posts

Posted - Aug 08 2016 :  04:44:14  Show Profile  Reply
Hi Nigel,
yes. EnableSampleGrabber is set to true.
After switching to Videocapture with codec the OnDShowEvent is fired once.

Here is my code sequence:


//---------------------------------------------------------------------------
this->bVideoMode = !this->bVideoMode;
	if(this->bVideoMode)
	 {
		imgView->IO->DShowParams->Disconnect();
		btToggleVideoMode->ImageIndex = 7;
		//imgView->IO->DShowParams->RenderAudio = false;
		imgView->IO->DShowParams->SetVideoCodec(cbVideoCodecs->ItemIndex); <-- XVid
		//imgView->IO->DShowParams->VideoCodecQuality = 1;
		imgView->IO->DShowParams->FileOutput = "C:\\temp\\testavi1.avi";
		this->RunVideo();
	 }
	else
	 {
		imgView->IO->DShowParams->Disconnect();
		btToggleVideoMode->ImageIndex = 6;
		imgView->IO->DShowParams->SetVideoCodec(-1);
		imgView->IO->DShowParams->FileOutput = "";
		this->RunVideo();
	 }


//---------------------------------------------------------------------------
void __fastcall TfmDXCaptureMain::RunVideo(void)
{
	this->DisconnectVideo();
	this->ConnectVideo();
	TIEDSRunResult ret = imgView->IO->DShowParams->Run();
	if(ret == iedsSuccess)
	 {
//Show devicename in caption
	 }
	else if(ret == iedsBusy)
	 {
		//Busy Msg
	 }
	else
	 {
		//Error Msg
	 }
}
//---------------------------------------------------------------------------


//---------------------------------------------------------------------------
void __fastcall TfmDXCaptureMain::ConnectVideo(void)
{
	if(!imgView->IO->DShowParams->Connected)
	 {
		//preset videodevice
		imgView->IO->DShowParams->SetVideoInput(iSelectedDevice);
		imgView->IO->DShowParams->Connect();
		//get n set resolution
		this->FillResolution();
		//reconnect with resolution
		imgView->IO->DShowParams->Disconnect();
		imgView->IO->DShowParams->SetVideoInput(iSelectedDevice, 0, Video_format_struct[this->iStreamSizeIndex].BitmapWidth, Video_format_struct[this->iStreamSizeIndex].BitmapHeight, 
Video_format_struct[this->iStreamSizeIndex].Format, Video_format_struct[this->iStreamSizeIndex].BitRate);
		imgView->IO->DShowParams->EnableSampleGrabber = true;
		imgView->IO->DShowParams->Connect();
		imgView->IO->DShowParams->GetCurrentVideoFormat(this->iCurrentStreamWidth, this->iCurrentStreamHeight, this->asCurrentFormat);
	 }
}
//---------------------------------------------------------------------------


Thanks for your help.

Best regards
Alex
Go to Top of Page

xequte

38610 Posts

Posted - Aug 09 2016 :  19:52:05  Show Profile  Reply
Hi Alex

Our DirectShow developer has advised that it is not possible to simutaneously grab and compress via DirectShow, i.e. Frame grabbing is allowed only when NO compression is specified.

It is possible to use the RenderVideo property (which does not use DShowNewFrame) but the performance is not real-time (slow).

http://www.imageen.com/help/TIEDirectShow.RenderVideo.html

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: