Click here to Skip to main content
11,637,415 members (64,585 online)
   

Graphics

 
QuestionAnimation in borderless window Pin
Aleonis23-Oct-11 1:14
memberAleonis23-Oct-11 1:14 
AnswerRe: Animation in borderless window Pin
Richard MacCutchan23-Oct-11 2:21
mvpRichard MacCutchan23-Oct-11 2:21 
GeneralRe: Animation in borderless window Pin
Aleonis23-Oct-11 2:32
memberAleonis23-Oct-11 2:32 
GeneralRe: Animation in borderless window Pin
Richard MacCutchan23-Oct-11 2:44
mvpRichard MacCutchan23-Oct-11 2:44 
GeneralRe: Animation in borderless window Pin
Aleonis23-Oct-11 3:32
memberAleonis23-Oct-11 3:32 
AnswerRe: Animation in borderless window Pin
Alisaunder23-Oct-11 5:07
memberAlisaunder23-Oct-11 5:07 
GeneralRe: Animation in borderless window Pin
Aleonis23-Oct-11 7:14
memberAleonis23-Oct-11 7:14 
QuestionXna object Transformation. Pin
AghaKhan22-Oct-11 20:56
memberAghaKhan22-Oct-11 20:56 
Questionfree or affordable software for the editing of the photo [modified] Pin
anthonybates11-Jul-11 18:06
memberanthonybates11-Jul-11 18:06 
AnswerRe: free or affordable software for the editing of the photo Pin
Drew Stainton11-Jul-11 18:38
memberDrew Stainton11-Jul-11 18:38 
QuestionGraphics Plugin for Liquidity Risk Software? Pin
StaceyL21-Jun-11 10:46
memberStaceyL21-Jun-11 10:46 
Jokei want to Pin
yexiaofeng18-Apr-11 22:05
memberyexiaofeng18-Apr-11 22:05 
Questionhai Pin
SR Baby31-Mar-11 22:32
memberSR Baby31-Mar-11 22:32 
QuestionProblem with compression of a DirectShow video filter Pin
428814-Jan-11 7:05
member428814-Jan-11 7:05 
I'm experiencing problems in setting compression parameters for a directshow video filter for a video and audio grabbed from a usb webcam.

The code I am using (adapted from various websites on the internet) is the following (removed error checking to improve readability):

	//... various code before
	hr=m_pGraph->AddFilter(m_pVidDeviceFilter,L"Vid Capture Filter");
	hr=m_pGraph->AddFilter(m_pAudDeviceFilter,L"Aud Capture Filter");
	
	hr = CoCreateInstance(CLSID_WMAsfWriter,NULL,CLSCTX_INPROC_SERVER, 
                      IID_IBaseFilter, (void **) &m_pWMASFWritter); 
 
	
 
	//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	// !!! Try to add compression from now on !!!!

	DWORD dwBitRate = 2670000; // I tried almost everything here
	DWORD dwQuality = 50; // in range[0-100]
	DWORD dwSecPerKey = 5000;
 
	// Initialize a new Profile Manager
	IWMProfileManager* pIPM = 0;
	WMCreateProfileManager(&pIPM);
 
	// Create a new empty profile
	IWMProfile* pIProf = 0;
	pIPM->CreateEmptyProfile(WMT_VER_9_0,&pIProf);
	pIProf->SetName(L"Window Media Video 9 Profile");
	pIProf->SetDescription (L"Window Media Video 9 Custom Encoding");
 
	// Create a new video stream
	IWMStreamConfig* pVideoStream = 0;
	pIProf->CreateNewStream(WMMEDIATYPE_Video,&pVideoStream);
 
	pVideoStream->SetStreamName(L"videostream");;
	pVideoStream->SetConnectionName(L"video");
	pVideoStream->SetBitrate(662144); // This causes problems
	pVideoStream->SetBufferWindow(3000);
	pVideoStream->SetStreamNumber(1);
 
	IWMVideoMediaProps* pVideoMediaProps = 0;
 
	// Get this Interface from pVideoStream...
	hr = pVideoStream->QueryInterface(IID_IWMMediaProps, (void**)&pVideoMediaProps);
 
	WM_MEDIA_TYPE sMediaType;
	WMVIDEOINFOHEADER sVideoInfoHeader;
	memset(&sMediaType, 0, sizeof(sMediaType));
	sMediaType.majortype = WMMEDIATYPE_Video;
	sMediaType.subtype = WMMEDIASUBTYPE_MPEG2_VIDEO;
	sMediaType.bFixedSizeSamples = FALSE;
	sMediaType.bTemporalCompression = TRUE;
	sMediaType.formattype = WMFORMAT_VideoInfo;
	sMediaType.cbFormat = sizeof(WMVIDEOINFOHEADER);
	sMediaType.pbFormat = (BYTE *)&sVideoInfoHeader;
 
	// Setup the Video Info Header
	memset(&sVideoInfoHeader, 0, sizeof(sVideoInfoHeader));
	sVideoInfoHeader.rcSource.left = 0;
	sVideoInfoHeader.rcSource.top = 0;
	sVideoInfoHeader.rcSource.right = 352;
	sVideoInfoHeader.rcSource.bottom = 240;
	sVideoInfoHeader.rcTarget.left = 0;
	sVideoInfoHeader.rcTarget.top = 0;
	sVideoInfoHeader.rcTarget.right = 352;
	sVideoInfoHeader.rcTarget.bottom = 240;
	sVideoInfoHeader.dwBitRate = 262144;
	sVideoInfoHeader.AvgTimePerFrame = 333667; // (1/29.97) in 100-ns units

	sVideoInfoHeader.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
	sVideoInfoHeader.bmiHeader.biWidth = 352;
	sVideoInfoHeader.bmiHeader.biHeight = 240;
	sVideoInfoHeader.bmiHeader.biPlanes = 1;
	sVideoInfoHeader.bmiHeader.biBitCount = 24;
	sVideoInfoHeader.bmiHeader.biCompression = MAKEFOURCC(0xe4,0x36,0xeb,0x83);
	sVideoInfoHeader.bmiHeader.biSizeImage = 0;
	sVideoInfoHeader.bmiHeader.biXPelsPerMeter = 0;
	sVideoInfoHeader.bmiHeader.biYPelsPerMeter = 0;
	sVideoInfoHeader.bmiHeader.biClrUsed = 0;
	sVideoInfoHeader.bmiHeader.biClrImportant = 0;
 
	// Set the VideoMediaProps for this Stream
	pVideoMediaProps->SetMediaType(&sMediaType);
	// pVideoMediaProps->SetMaxKeyFrameSpacing(1000000);
	// pVideoMediaProps->SetQuality(100);
	pVideoMediaProps->Release();
 

	hr = pIProf->AddStream(pVideoStream); ////// hr IS ALWAYS NS_E_INVALID_STREAM HERE!! PROBLEM!

	if (hr == NS_E_INVALID_STREAM)
	{
 
		// Here the problem!
		
 
	}
 
	// Set the profile for the writer
	CComQIPtr<IConfigAsfWriter2> pConfigWriter;
	pConfigWriter = m_pWMASFWritter;
 
	hr = pConfigWriter->SetParam(AM_CONFIGASFWRITER_PARAM_DONTCOMPRESS, FALSE, 0);
	hr = pConfigWriter->ConfigureFilterUsingProfile(pIProf);
 

 
	//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	// !!! End of compression code... continue with streaming/networking code.. !!!
	
	hr=m_pGraph->AddFilter(m_pWMASFWritter,L"ASF Writter");
	
	hr = m_pWMASFWritter->QueryInterface( IID_IFileSinkFilter, (void**)&m_pFileSinkFilter );
 
	hr = m_pFileSinkFilter->SetFileName(L"C:\\test.wmv", NULL);
	
	//.... etc....

Can someone point me in the right direction please?
---

Question[OpenGL/MFC/C++] backface transparency... Pin
Maximilien11-Jan-11 5:02
memberMaximilien11-Jan-11 5:02 
AnswerRe: [OpenGL/MFC/C++] backface transparency... Pin
jk chan14-Jan-11 4:42
memberjk chan14-Jan-11 4:42 
AnswerRe: [OpenGL/MFC/C++] backface transparency... Pin
parths19-Jan-11 2:49
memberparths19-Jan-11 2:49 
Questiontransparent using Fillpath Pin
transoft9-Jan-11 15:19
membertransoft9-Jan-11 15:19 
AnswerRe: transparent using Fillpath Pin
Richard MacCutchan9-Jan-11 23:28
mvpRichard MacCutchan9-Jan-11 23:28 
QuestionOpenGL rendering on desktop [modified] Pin
Tcpip200519-Dec-10 1:17
memberTcpip200519-Dec-10 1:17 
AnswerRe: OpenGL rendering on desktop Pin
parths22-Dec-10 22:28
memberparths22-Dec-10 22:28 
GeneralRe: OpenGL rendering on desktop Pin
Tcpip200524-Dec-10 2:06
memberTcpip200524-Dec-10 2:06 
AnswerRe: OpenGL rendering on desktop Pin
Drew Stainton30-Dec-10 12:46
memberDrew Stainton30-Dec-10 12:46 
GeneralRe: OpenGL rendering on desktop Pin
Tcpip200531-Dec-10 17:51
memberTcpip200531-Dec-10 17:51 
Questiontransparently blit a bitmap Pin
mike7521413-Dec-10 9:01
membermike7521413-Dec-10 9:01 
AnswerRe: transparently blit a bitmap Pin
LunaticFringe13-Dec-10 12:00
memberLunaticFringe13-Dec-10 12:00 
AnswerRe: transparently blit a bitmap Pin
jk chan27-Dec-10 1:00
memberjk chan27-Dec-10 1:00 
QuestionGraphics.FillPath( Brush, GraphicsPath ) does not fill a simple Path. Pin
WDI28-Oct-10 2:47
memberWDI28-Oct-10 2:47 
AnswerRe: Graphics.FillPath( Brush, GraphicsPath ) does not fill a simple Path. Pin
RaviRanjankr13-Dec-10 18:49
memberRaviRanjankr13-Dec-10 18:49 
Questiontool for real time graph plotting.. Pin
jainiraj27-Oct-10 1:21
memberjainiraj27-Oct-10 1:21 
AnswerCross Post! Pin
Henry Minute27-Oct-10 1:41
mvpHenry Minute27-Oct-10 1:41 
GeneralRe: Cross Post! Pin
jainiraj27-Oct-10 4:18
memberjainiraj27-Oct-10 4:18 
GeneralRe: Cross Post! Pin
Richard MacCutchan27-Oct-10 5:37
mvpRichard MacCutchan27-Oct-10 5:37 
QuestionTRUE == FALSE in GDI: Another rtfm? Pin
Tadeusz Westawic22-Oct-10 3:37
memberTadeusz Westawic22-Oct-10 3:37 
QuestionFreeing Selected BM from DC in GDI Pin
Tadeusz Westawic17-Oct-10 17:32
memberTadeusz Westawic17-Oct-10 17:32 
AnswerRe: Freeing Selected BM from DC in GDI Pin
LunaticFringe17-Oct-10 18:00
memberLunaticFringe17-Oct-10 18:00 
GeneralRe: Freeing Selected BM from DC in GDI Pin
Tadeusz Westawic17-Oct-10 18:32
memberTadeusz Westawic17-Oct-10 18:32 
GeneralRe: Freeing Selected BM from DC in GDI Pin
LunaticFringe18-Oct-10 6:29
memberLunaticFringe18-Oct-10 6:29 
AnswerRe: Freeing Selected BM from DC in GDI Pin
Sauro Viti18-Oct-10 7:56
memberSauro Viti18-Oct-10 7:56 
GeneralRe: Freeing Selected BM from DC in GDI Pin
Tadeusz Westawic19-Oct-10 2:56
memberTadeusz Westawic19-Oct-10 2:56 
Questionhow can the diffrent DC share the same OpenGL List? Pin
King Tran5-Oct-10 13:47
memberKing Tran5-Oct-10 13:47 
AnswerRe: how can the diffrent DC share the same OpenGL List? Pin
Peter_in_27805-Oct-10 14:32
memberPeter_in_27805-Oct-10 14:32 
AnswerRe: how can the diffrent DC share the same OpenGL List? Pin
jk chan27-Dec-10 1:06
memberjk chan27-Dec-10 1:06 
Questiondiffrent DC share the same OpenGL list Pin
King Tran26-Sep-10 3:52
memberKing Tran26-Sep-10 3:52 
AnswerRe: diffrent DC share the same OpenGL list Pin
Sauro Viti18-Oct-10 7:43
memberSauro Viti18-Oct-10 7:43 
QuestionHelp) Pin
_Mr_xXx_5-Sep-10 0:49
member_Mr_xXx_5-Sep-10 0:49 
QuestionCreating MultiFrame images and dramatic increase in file size Pin
CincDev5-Aug-10 16:54
memberCincDev5-Aug-10 16:54 
AnswerRe: Creating MultiFrame images and dramatic increase in file size Pin
LunaticFringe5-Aug-10 23:31
memberLunaticFringe5-Aug-10 23:31 
GeneralRe: Creating MultiFrame images and dramatic increase in file size Pin
CincDev6-Aug-10 1:29
memberCincDev6-Aug-10 1:29 
QuestionOpenGL draw 3D earth with texture Pin
King Tran3-Aug-10 22:57
memberKing Tran3-Aug-10 22:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web02 | 2.8.150728.1 | Last Updated 13 Jul 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid