|
|
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):
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);
DWORD dwBitRate = 2670000;
DWORD dwQuality = 50;
DWORD dwSecPerKey = 5000;
IWMProfileManager* pIPM = 0;
WMCreateProfileManager(&pIPM);
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");
IWMStreamConfig* pVideoStream = 0;
pIProf->CreateNewStream(WMMEDIATYPE_Video,&pVideoStream);
pVideoStream->SetStreamName(L"videostream");;
pVideoStream->SetConnectionName(L"video");
pVideoStream->SetBitrate(662144);
pVideoStream->SetBufferWindow(3000);
pVideoStream->SetStreamNumber(1);
IWMVideoMediaProps* pVideoMediaProps = 0;
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;
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;
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;
pVideoMediaProps->SetMediaType(&sMediaType);
pVideoMediaProps->Release();
hr = pIProf->AddStream(pVideoStream);
if (hr == NS_E_INVALID_STREAM)
{
}
CComQIPtr<IConfigAsfWriter2> pConfigWriter;
pConfigWriter = m_pWMASFWritter;
hr = pConfigWriter->SetParam(AM_CONFIGASFWRITER_PARAM_DONTCOMPRESS, FALSE, 0);
hr = pConfigWriter->ConfigureFilterUsingProfile(pIProf);
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);
Can someone point me in the right direction please?
---
|
|
|
|
|
(OpenGL on vs2008)
I'm drawing surfaces, not volumes. the issue is corruption (or maybe PEBKAC) when displaying "blended" (transparent)
I don't seem to understand how the surface must be "setup" to obtain full surface transparency on both the front side and back side.
I have something like :
::glReadBuffer( GL_BACK );
::glDrawBuffer( GL_BACK );
::glDepthFunc( GL_LESS );
::glEnable( GL_DEPTH_TEST );
glPolygonMode ( GL_FRONT, GL_FILL );
glPolygonMode ( GL_BACK, GL_FILL );
glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE );
glDepthMask( GL_FALSE );
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glColor4ub( red, green, blue, alpha );
glDisable( GL_BLEND );
glDepthMask( GL_TRUE );
glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE );
When using this code, there are some corruption in the display, surface "patches" are not rendered appropriately when displaying against "itself", for example a front facing polygon of a cone or cylinder which is displayed against a back" face of the same cone or cylinder.
see images showing the issue:
simple cylinder :
http://www.flickr.com/photos/thesorus/5346534862/in/photostream/[^]
and
a cone, a sphere and a plane.
http://www.flickr.com/photos/thesorus/5345924155/in/photostream/[^]
Max.
Thanks.
Watched code never compiles.
|
|
|
|
|
To achieve real transparency at a fast rate is hard. To get exact picture , you need to sort triangles from back to front , based your camera vector. Also sometiems , if triangles overlap , you need to splitup it.
The best way to do this is by implementing BSP tree. Using that you can do both front-to back or back-to-front rendering. I would suggest you to look into that first.
In general for a scene , i do like this ( for fake transparency )
1. Render all opaque objects
2. Sort triangles based on their material transparency.
3. Draw triangles which having lesser transparency level first followed by others.
If u can Dream... U can do it
|
|
|
|
|
Did you try glDepthFunc( GL_ALWAYS ) ?
Basically allowing all pixels to be drawn.
I think that might work rather than glDepthFunc( GL_LESS ) and glDepthMask( GL_FALSE );
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
"Philosophy is a study that lets us be unhappy more intelligently."
-Anon.
|
|
|
|
|
Hi
I want the path drawn by "FillPath" to be transparent. How can I implement this?
Gdiplus::Graphics gr(dc);
Gdiplus::SolidBrush brush(Gdiplus::Color::Black);
...
gr.FillPath(brush, path);
gr.DrawPath(&p, path);
...
Thanks,
|
|
|
|
|
You need to select a colour value in your brush with alpha blending to make it appear transparent; see here[^] for more information.
I must get a clever new signature for 2011.
|
|
|
|
|
How to render opengl objects on windows desktop without attaching to the Desktop Window DC.
I mean it looks like rendering opengl scene on a window,but the window is totally transparent.
Thank you all
modified on Sunday, December 19, 2010 9:39 PM
|
|
|
|
|
Check out SetLayeredWindowAttributes [^]in the Win32 API
Use OpenGL Background colour with with RGBA 0.
Search google it's quite simple really.
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
"Philosophy is a study that lets us be unhappy more intelligently."
-Anon.
|
|
|
|
|
thank you.merry christmas
|
|
|
|
|
I think this[^] has the answer you're looking for (particularly answer 4). It isn't as simple as it seems and the other solutions I've seen simply set a transparent replacement colour, which is going to result in popping pixels if any part of your rendered objects happen to contain that colour.
Hope this helps.
Cheers,
Drew.
|
|
|
|
|
Thank you very much,very good.
merry christmas and happy new year
|
|
|
|
|
Anyone know an easy way to transparently blit a bitmap in OpenGL?
|
|
|
|
|
What exactly are you trying to do? Are you attempting to texture some object with said bitmap?
Need more information.
L u n a t i c F r i n g e
|
|
|
|
|
u may need to used blending. opengl supports different blending operation between source and destinations. u can use the function glBlendFunc(..) to define the operations. first u need to enable
blending by calling glEnable(GL_BLEND)
If u can Dream... U can do it
|
|
|
|
|
I think this problem occurs because of x and y of points because when I change the points, the shape will fill correctly.
Here is the code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace FillTriangle
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
GraphicsPath gp = new GraphicsPath(FillMode.Winding);
gp.AddLine(new PointF(290, 170),new PointF(98, 128));
gp.AddLine(new PointF(110, 170), new PointF(290, 170));
gp.AddLine(new PointF(110, 170), new PointF(98, 128));
g.FillPath(new SolidBrush(Color.Red), gp);
}
}
}
|
|
|
|
|
WDI wrote: I think this problem occurs because of x and y of points because when I change the points, the shape will fill
Of-course the problem is occurring because of co-ordinates x and y.
modified on Tuesday, December 21, 2010 12:08 AM
|
|
|
|
|
hi everyone..
I want a tool to plot real time graph for .net platform.The data which has to be plotted is continuously coming in some time interval.Is there any tool available?
Also Performance issue is there.Performance also matters when I am using the tool.
Thanks in adv...
|
|
|
|
|
Please do not ask the same question in more than one forum. Very rude and it wastes everyone's time.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I know it wastes time of many people.But I don't know in which forum it should post.Thats why I posted it in multiple forum.Well thanks for suggestion and sorry for westing your time.
|
|
|
|
|
Since your question mentions the fact that you want to do this in .NET I would expect the .NET Framework forum would be a good start. I note that you have been a CP member for over a year now so you should be familiar with the posting guidelines.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
This statement is going to one of my pgm docs. It's no big deal, I just want to know if anyone recalls a doc?
I know I haven't run across one and this took a while to debug.
Working with monochrome bitmaps and DCs introduces a surjective-only mapping of 32-bit COLORREF values
onto 1-bit mono pixel values (as in FillSolidRect(), e.g.). Here is the map:
0x00000000 <= '0' <= 0x00000fff
0x00001000 <= '1' <= 0xfffff000
I don't know about adding more bitplanes to the bitmap.
Tadeusz Westawic
Sum quid sum.
|
|
|
|
|
I have recently discovered that
dc.SelectObject(&mybitmap);
...
dc.SelectObject((CBitmap*)NULL);
does not cause the release of mybitmap.
What is the proper way to cause dc to release bitmap without assigning another "real" resource (return the dc to its freshly created state) so that another dc in another subroutine can select mybitmap?
Tadeusz Westawic
Sum quid sum.
|
|
|
|
|
The first call to SelectObject will have returned a handle to the default bitmap in the DC. Store it and select it back in when you're finished.
L u n a t i c F r i n g e
|
|
|
|
|
Yes, thank you, it is the way I used to do it.
Let me ask this, then: what does the dc.SelectObject() doc (msdn) mean in explanation of return value, where it says about func may return ptr to temp object?
That is the thing that scared me off the tried and true.
Tadeusz Westawic
Sum quid sum.
|
|
|
|