I used DirectShow to render a video file or webcam. With webcam, i can get
IID_IAMStreamConfig to change resolution, but not video file.
Any way to do this? Thanks in advance.
This is code worked with webcam, not video file:
// Variables
ICaptureGraphBuilder2 * m_pBuilder;
IAMStreamConfig* m_pVSC;
// Get IID_IAMStreamConfig
hr = m_pBuilder->FindInterface(&PIN_CATEGORY_CAPTURE,
&MEDIATYPE_Video,
m_pSrcFilter, IID_IAMStreamConfig, (void **)&m_pVSC);
// Get current AM_MEDIA_TYPE
AM_MEDIA_TYPE *pmt;
hr = m_pVSC->GetFormat(&pmt);
// Change info
...
// Set new AM_MEDIA_TYPE
hr = m_pVSC->SetFormat(pmt);
You can try it out in graphedit and use the property page to configure
it.
On Apr 25, 2:36 am, "James Duy Trinh \(VietDoor\)"
Any example to use this library?
"Ralf Globisch" <Ralf.G...@gmail.com> wrote in message
news:0f387de6-5d96-4cfc...@y9g2000yqg.googlegroups.com...
1) Download the Setup.msi file and install the filters
2) Start Graphedit
3) Insert some kind of RGB source filter (PushSource, AVI, webcam)
4) Insert scale filter (You can find it under the directshow filters
under the name "Meraka RTVC Scale Filter"
5) Connect the source filter to the scale filter
6) Configure the scale filter using the filter property page.
7) Render the rest of the graph and play the graph.
Note that there is a limitation on the scale filter, you cannot scale
up by more than a factor of 2.
If you want to use the scale filter programmatically you can do the
following (The example code uses COM smart pointers):
....................
IBaseFilterPtr pScaleFilter = NULL;
...
ISettingsInterfacePtr pSettingsInterface = pScaleFilter;
char szParamValue[255];
int nLength = 0;
HRESULT hr;
hr = pSettingsInterface->GetParameter("targetwidth", 255,
szParamValue, nLength);
hr = pSettingsInterface->GetParameter("targetheight", 255,
szParamValue, nLength);
hr = pSettingsInterface->SetParameter("targetwidth", "800");
hr = pSettingsInterface->SetParameter("targetheight", "600");
....................
On Apr 29, 1:59 am, "James Duy Trinh \(VietDoor\)"
<vietd...@gmail.com> wrote:
> Hi Globisch,
>
> Any example to use this library?
>
> "Ralf Globisch" <Ralf.Globi...@gmail.com> wrote in message
>
> news:0f387de6-5d96-4cfc...@y9g2000yqg.googlegroups.com...
> You can't change the resolution of a video file using that interface
> but you could alternatively scale the video to your desired
> resolution.
> However you might loose quality by doing that (if you scale up) since
> you can't generate what doesn't exist in the original file. There's a
> free open-source scale filter for RGB media athttp://sourceforge.net/projects/videoprocessing/
Note that you must configure the scale filter *before* you render the
rest of the graph since this filter does not support dynamic
reconfiguration at present.
If you wish to use and configure the scale filter programmatically,
you can do this accessing the ISettingsInterface COM interface of the
filter.
Note that the example is using COM smart pointers:
IBaseFilterPtr pScaleFilter = NULL;
...
ISettingsInterfacePtr pSettingsInterface = pScaleFilter;
char szParamValue[255];
int nLength = 0;
HRESULT hr;
hr = pSettingsInterface->GetParameter("targetwidth", 255,
szParamValue, nLength);
hr = pSettingsInterface->GetParameter("targetheight", 255,
szParamValue, nLength);
hr = pSettingsInterface->SetParameter("targetwidth", "800");
hr = pSettingsInterface->SetParameter("targetheight", "600");
....
On Apr 29, 1:59 am, "James Duy Trinh \(VietDoor\)"
<vietd...@gmail.com> wrote:
> Hi Globisch,
>
> Any example to use this library?
>
> "Ralf Globisch" <Ralf.Globi...@gmail.com> wrote in message
>
> news:0f387de6-5d96-4cfc...@y9g2000yqg.googlegroups.com...
> You can't change the resolution of a video file using that interface
> but you could alternatively scale the video to your desired
> resolution.
> However you might loose quality by doing that (if you scale up) since
> you can't generate what doesn't exist in the original file. There's a
> free open-source scale filter for RGB media athttp://sourceforge.net/projects/videoprocessing/
"Ralf Globisch" <Ralf.G...@gmail.com> wrote in message
news:0fa47c2f-84c4-4f61...@x1g2000prh.googlegroups.com...
Once you've done that you can follow the programmatic approach.
1) Simply add your source, the scale filter to your graph. (You'll
have to download the source code from sourceforge using some
subversion client for this. The GUID for the scale filter is in the
ScaleFilter.h header file. Add the scale filter to the graph using the
GUID)
2) Connect the source to the scale filter. Configure the scale filter
using the ISettingsInterface like shown in my previous posts.
3) Add a sample grabber and a renderer to the graph.
4) Build the rest of the graph.(configure the sample grabber callback,
connect the rest of the graph, etc)
On May 8, 4:50 am, "James Duy Trinh" <vietd...@gmail.com> wrote:
> But i need a scale filter before samegrabber filter, so we can get frame
> with the respected size.
>