<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Fooling Around &#187; Video</title>
	<atom:link href="http://alax.info/blog/tag/video/feed" rel="self" type="application/rss+xml" />
	<link>http://alax.info/blog</link>
	<description>// Software Production Line</description>
	<lastBuildDate>Fri, 03 Feb 2012 22:49:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Microsoft DTV-DVD Video Decoder at High Resolutions</title>
		<link>http://alax.info/blog/1283</link>
		<comments>http://alax.info/blog/1283#comments</comments>
		<pubDate>Wed, 21 Sep 2011 20:51:23 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[H.264]]></category>
		<category><![CDATA[microsoft]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1283</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1283" title="Microsoft DTV-DVD Video Decoder at High Resolutions"></a>It is really great news that Windows 7 offers quite some goodies for MPEG-4 support right out of the box, but some things appear to be made not so accurate. The component responsible for video decoding is Microsoft DTV-DVD Video &#8230;<p class="read-more"><a href="http://alax.info/blog/1283">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1283" title="Microsoft DTV-DVD Video Decoder at High Resolutions"></a><p>It is really great news that Windows 7 offers quite some goodies for MPEG-4 support right out of the box, but some things appear to be made not so accurate.</p>
<p>The component responsible for video decoding is <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd390679%28v=vs.85%29.aspx">Microsoft DTV-DVD Video Decoder</a> (also known as Microsoft MPEG-2 Video Decoder), available with DirectShow interface. It offers video decoding capabilities for video resolutions up to 1920&#215;1088 (Full HD), including DXVA version 2 mode. The decoder is a &#8220;preferred decoder&#8221; and is given a first chance to be taken when it comes for <a href="http://msdn.microsoft.com/en-us/library/dd390342%28v=VS.85%29.aspx">Intelligent Connect</a> to render a video stream.</p>
<p>Technology went ahead though, stepped behind 1920&#215;1088 in particular. Microsoft DTV-DVD Video Decoder DirectShow filter still remains the first take in H.264 video decoding, and what however is taking place &#8211; the decoder accepts the format (media type) which is clearly cannot decode, neither according to specification, nor in real life. As soon as pin connection succeeds, DirectShow is not trying to look for another decoder, which can truly decode the feed. Result: failure to decode video.</p>
<p><img class="alignnone size-full wp-image-1284" title="Incorrect Media Type on Microsoft DTV-DVD Decoder Output" src="http://alax.info/blog/wp-content/uploads/2011/09/Image001.png" alt="" width="1034" height="624" /></p>
<p>The problem takes place in a quite surprising way. Given 5 megapixel video (2560&#215;1592, H.264, Baseline profile, from <a href="http://en.wikipedia.org/wiki/RTSP">RTSP</a>-enabled IP camera), the decoder advertises 720&#215;480 NV12 output media type. While consuming input data, the decoder outputs nothing and keeps video window black.</p>
<p>It does not issue any filter graph events, no. The filter is persistent and works hard in assumption that a new piece of knowledge will come from Mars and provide new capabilities to start decoding video, or filter&#8217;s input will give up and provide a new <a href="http://en.wikipedia.org/wiki/Network_Abstraction_Layer#Parameter_Sets">SPS</a> to lower resolution down to something less complex.</p>
<p>Well then, so is this advanced technology yet to be discovered by science? It appears that no. CoreAVC Video Decoder, applied to the same H.264 video decodes it well and nice:</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2011/09/Image002.png"><img class="alignnone size-large wp-image-1287" title="CoreAVC H.264 Video Decoder with 5 MP Video from StarDot SDH500BN IP Camera" src="http://alax.info/blog/wp-content/uploads/2011/09/Image002-505x600.png" alt="" width="505" height="600" /></a></p>
<p><span style="text-decoration: underline;">Update 2011-09-26</span>: According to Microsoft classification, this is <a href="http://connect.microsoft.com/VisualStudio/feedback/details/689926/dtv-dvd-video-decoder-directshow-filter-negotiates-decoding-at-high-resolutions-but-fails-to-actually-decode">a bug on a released product</a>. That is, if anyone is experiencing severe issues as a result of this behavior, one might need to contact Microsoft Support directly in search of a solution.</p>
<p>Actually, as resolutions over Full HD (1920&#215;1080) are not so much common at the moment, the issue side effects are not yet likely. Still moving on with time, I think the issues are likely to come up, without being severe though.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1283/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>A tricky EVR bug was caught up: input pin may falsely report disconnected state</title>
		<link>http://alax.info/blog/1262</link>
		<comments>http://alax.info/blog/1262#comments</comments>
		<pubDate>Tue, 26 Jul 2011 17:13:38 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Seriously]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[evr]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[Source]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1262</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1262" title="A tricky EVR bug was caught up: input pin may falsely report disconnected state"></a>Crime An application which builds a DirectShow graph unexpectedly started failing with VFW_E_NOT_CONNECTED (0&#215;80040209) error code. Scene The problem takes place during DirectShow graph building, yet in stopped state. Specific call which appeared to be giving out the error in &#8230;<p class="read-more"><a href="http://alax.info/blog/1262">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1262" title="A tricky EVR bug was caught up: input pin may falsely report disconnected state"></a><h4>Crime</h4>
<p>An application which builds a DirectShow graph unexpectedly started failing with VFW_E_NOT_CONNECTED (0&#215;80040209) error code.</p>
<h4>Scene</h4>
<p>The problem takes place during DirectShow graph building, yet in stopped state. Specific call which appeared to be giving out the error in first place appears to be EVR input pin&#8217;s <a href="http://connect.microsoft.com/VisualStudio/feedback/details/680766/enhanced-video-renderer-is-incorrectly-reporting-vfw-e-not-connected-0x80040209-for-a-connected-pin">IPin::ConnectionMediaType</a>, and the problem is also specific to <a href="http://msdn.microsoft.com/en-us/library/ms694916%28VS.85%29.aspx">Enhanced video Renderer</a> (Windows 7, but not necessarily only this version).</p>
<h4>Investigation</h4>
<p>The problem does not appear to be persistent. On the contrary, it is taking place for just a few milliseconds after pin connection. After the problem is gone, it does not seem to ever come up again unless the filter graph is built again from the beginning.</p>
<p>EVR pin connection is always reporting success, so the following error code stating <a href="http://msdn.microsoft.com/en-us/library/ms919477.aspx">VFW_E_NOT_CONNECTED</a> &#8220;The operation cannot be performed because the pins are not connected.&#8221; goes against documented behavior, and is thus a bug.</p>
<p>Depending on time between pin connection and media type polling, the call can reach EVR:</p>
<ul>
<li>before it starts showing the problem &#8211; stage A</li>
<li>at the time the call fails &#8211; stage B</li>
<li>after the failure time interval, when the call is successful from then on &#8211; stage C</li>
</ul>
<p>Thus, the problem is limited to specific use cases:</p>
<ul>
<li>the application should care about media type on EVR input</li>
<li>unexpected failure takes place when the call reaches in stage B</li>
<li>also found: the clipping window for the EVR has to belong to a non-primary monitor</li>
</ul>
<p>If an application keep polling for media type in a loop, the result may be about the following:</p>
<pre style="color: #000000; background: #ffffff;"><span style="color: #603000;">UINT</span> nStageA <span style="color: #808030;">=</span> <span style="color: #008c00;">0</span><span style="color: #808030;">,</span> nStageB <span style="color: #808030;">=</span> <span style="color: #008c00;">0</span><span style="color: #808030;">,</span> nStageC <span style="color: #808030;">=</span> <span style="color: #008c00;">0</span><span style="color: #800080;">;</span>
<span style="color: #696969;">// [...]</span>
<span style="color: #800000; font-weight: bold;">for</span><span style="color: #808030;">(</span><span style="color: #800080;">;</span> <span style="color: #800080;">;</span> <span style="color: #808030;">)</span>
<span style="color: #800080;">{</span>
    AM_MEDIA_TYPE MediaType<span style="color: #800080;">;</span>
    <span style="color: #400000;">ZeroMemory</span><span style="color: #808030;">(</span><span style="color: #808030;">&amp;</span>MediaType<span style="color: #808030;">,</span> <span style="color: #800000; font-weight: bold;">sizeof</span> MediaType<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
    <span style="color: #800000; font-weight: bold;">const</span> HRESULT nConnectionMediaTypeResult <span style="color: #808030;">=</span> pInputPin<span style="color: #808030;">-</span><span style="color: #808030;">&gt;</span>ConnectionMediaType<span style="color: #808030;">(</span><span style="color: #808030;">&amp;</span>MediaType<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
    <span style="color: #800000; font-weight: bold;">if</span><span style="color: #808030;">(</span>SUCCEEDED<span style="color: #808030;">(</span>nConnectionMediaTypeResult<span style="color: #808030;">)</span><span style="color: #808030;">)</span>
    <span style="color: #800080;">{</span>
        <span style="color: #800000; font-weight: bold;">if</span><span style="color: #808030;">(</span>nStageB<span style="color: #808030;">)</span>
        <span style="color: #800080;">{</span>
            nStageC<span style="color: #808030;">+</span><span style="color: #808030;">+</span><span style="color: #800080;">;</span>
            <span style="color: #800000; font-weight: bold;">break</span><span style="color: #800080;">;</span>
        <span style="color: #800080;">}</span> <span style="color: #800000; font-weight: bold;">else</span>
            nStageA<span style="color: #808030;">+</span><span style="color: #808030;">+</span><span style="color: #800080;">;</span>
    <span style="color: #800080;">}</span> <span style="color: #800000; font-weight: bold;">else</span>
    <span style="color: #800080;">{</span>
        ATLASSERT<span style="color: #808030;">(</span>nConnectionMediaTypeResult <span style="color: #808030;">=</span><span style="color: #808030;">=</span> VFW_E_NOT_CONNECTED<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
        nStageB<span style="color: #808030;">+</span><span style="color: #808030;">+</span><span style="color: #800080;">;</span>
    <span style="color: #800080;">}</span>
    CoTaskMemFree<span style="color: #808030;">(</span>MediaType<span style="color: #808030;">.</span>pbFormat<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
<span style="color: #800080;">}</span>
<span style="color: #696969;">// [...]</span>
<span style="color: #603000;">CString</span> sMessage<span style="color: #800080;">;</span>
sMessage<span style="color: #808030;">.</span>Format<span style="color: #808030;">(</span>_T<span style="color: #808030;">(</span><span style="color: #800000;">"</span><span style="color: #0000e6;">Bingo!</span><span style="color: #0f69ff;">\r</span><span style="color: #0f69ff;">\n</span><span style="color: #0f69ff;">\r</span><span style="color: #0f69ff;">\n</span><span style="color: #800000;">"</span><span style="color: #808030;">)</span> _T<span style="color: #808030;">(</span><span style="color: #800000;">"</span><span style="color: #0000e6;">nStageA </span><span style="color: #0f69ff;">%d</span><span style="color: #0000e6;">, nStageB </span><span style="color: #0f69ff;">%d</span><span style="color: #0000e6;"> - 0x</span><span style="color: #0f69ff;">%08x</span><span style="color: #0000e6;">, nStageC </span><span style="color: #0f69ff;">%d</span><span style="color: #0f69ff;">\n</span><span style="color: #800000;">"</span><span style="color: #808030;">)</span><span style="color: #808030;">,</span> nStageA<span style="color: #808030;">,</span> nStageB<span style="color: #808030;">,</span> nResult<span style="color: #808030;">,</span> nStageC<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
AtlMessageBox<span style="color: #808030;">(</span>m_hWnd<span style="color: #808030;">,</span> <span style="color: #808030;">(</span><span style="color: #603000;">LPCTSTR</span><span style="color: #808030;">)</span> sMessage<span style="color: #808030;">,</span> _T<span style="color: #808030;">(</span><span style="color: #800000;">"</span><span style="color: #0000e6;">Result</span><span style="color: #800000;">"</span><span style="color: #808030;">)</span><span style="color: #808030;">,</span> MB_ICONERROR<span style="color: #808030;">)</span><span style="color: #800080;">;</span></pre>
<p><img class="alignnone size-full wp-image-1263" title="EVR Input Pin IPin::ConnectedMediaType Stages" src="http://alax.info/blog/wp-content/uploads/2011/07/Image0034.png" alt="" width="384" height="184" /></p>
<h5>Workaround</h5>
<p>An obvious straightforward workaround is to follow EVR connection with a wait for Stage B to pass, or timeout &#8211; whichever takes place first.</p>
<p>Also, <a href="http://connect.microsoft.com/VisualStudio/feedback/details/680766/enhanced-video-renderer-is-incorrectly-reporting-vfw-e-not-connected-0x80040209-for-a-connected-pin">vote for the bug on Microsoft Connect</a>.</p>
<h5>More Details</h5>
<p>Video renderer filter are notorious for re-agreeing media type and being fretful as for memory allocators and media types (for a good reason though!). So it makes sense to suggest that the problem takes place when the filter is doing something related, such as it starts background activity immediately after connection in order to discover upstream peer capabilities.</p>
<p>In order to possibly get details on this, it is possible to raise an exception as soon as Stage B is detected and take a look at thread states using a debugger. Indeed, on of the background threads is engaged in EVR reconnection activity:</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2011/07/Image0023.png"><img class="alignnone size-large wp-image-1264" title="EVR Background Thread State" src="http://alax.info/blog/wp-content/uploads/2011/07/Image0023-800x429.png" alt="" width="620" height="332" /></a></p>
<p>Yes it does the reconnection, but nevertheless it is expected to do the things undercover and transparently, it still allows a failure on the outer API.</p>
<pre>     evr.dll!GetSourceRectFromMediaType() + 0x37 bytes    
     evr.dll!CEVRInputPin::CheckMediaType() + 0x81 bytes    
     evr.dll!CBasePin::ReceiveConnection() + 0x61 bytes    
     evr.dll!CEVRInputPin::ReceiveConnection() + 0x1fc2d bytes    
     quartz.dll!CBasePin::AttemptConnection() - 0x21 bytes    
     quartz.dll!CBasePin::TryMediaTypes() + 0x60 bytes    
     quartz.dll!CBasePin::AgreeMediaType() + 0x54 bytes    
     quartz.dll!CBasePin::Connect() + 0x46 bytes    
     quartz.dll!CFilterGraph::ConnectDirectInternal() + 0x83 bytes    
     quartz.dll!CFilterGraph::ConnectRecursively() + 0x2c bytes    
     quartz.dll!CFilterGraph::ConnectInternal() + 0xde bytes    
     quartz.dll!CFilterGraph::Connect() + 0x17 bytes    
     quartz.dll!CFGControl::WorkerDisplayChanged() + 0xf1 bytes    
     quartz.dll!CFGControl::CGraphWindow::OnReceiveMessage() + 0x2e2a bytes    
&gt;    quartz.dll!WndProc() + 0x3e bytes    
     user32.dll!_InternalCallWinProc@20() + 0x23 bytes    
     user32.dll!_UserCallWinProcCheckWow@32() + 0xb7 bytes    
     user32.dll!_DispatchMessageWorker@8() + 0xed bytes    
     user32.dll!_DispatchMessageW@4() + 0xf bytes    
     quartz.dll!ObjectThread() + 0x65 bytes</pre>
<p>A test Visual C++ .NET 2010 application <a href="http://www.assembla.com/code/roatl-utilities/subversion/nodes/trunk/EvrInputPinConnectionBug">is available from SVN</a>. The code requires a media file, and refers to <em>352&#215;288 I420.avi</em>, which is included into ZIP file attached to <a href="http://connect.microsoft.com/VisualStudio/feedback/details/680766/enhanced-video-renderer-is-incorrectly-reporting-vfw-e-not-connected-0x80040209-for-a-connected-pin#details">MS Connect Feedback</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1262/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Another VFW/DirectShow Pain in the Ass: picapmk4.dll</title>
		<link>http://alax.info/blog/1250</link>
		<comments>http://alax.info/blog/1250#comments</comments>
		<pubDate>Thu, 21 Jul 2011 13:05:33 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Seriously]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[codec]]></category>
		<category><![CDATA[compatibility]]></category>
		<category><![CDATA[crapware]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[issue]]></category>
		<category><![CDATA[picapmk4]]></category>
		<category><![CDATA[vfw]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1250</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1250" title="Another VFW/DirectShow Pain in the Ass: picapmk4.dll"></a>A customer complained on video playback problems which had symptoms of software compatibility issue. At certain operation modes software froze leaving the only option to kill process and restart. I appeared that the system has a third party DLL installed, &#8230;<p class="read-more"><a href="http://alax.info/blog/1250">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1250" title="Another VFW/DirectShow Pain in the Ass: picapmk4.dll"></a><p>A customer complained on video playback problems which had symptoms of software compatibility issue. At certain operation modes software froze leaving the only option to kill process and restart.</p>
<p>I appeared that the system has a third party DLL installed, a new hero name&#8217;s &#8211; <strong>picapmk4.dll</strong>. The DLL registers itself as Video for Windows codec and is clearly indicating capabilities it does not really support.</p>
<p>The DLL itself has no indication of its source, no valid version info. Instead it has GPL v2 embedded, XviD logo and about box resource template showing up as &#8220;PMK4 Video Codec&#8221;.</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2011/07/Image0011.png"><img class="alignnone size-full wp-image-1251" title="XviD logo" src="http://alax.info/blog/wp-content/uploads/2011/07/Image0011.png" alt="" width="468" height="211" /></a></p>
<p><a href="http://alax.info/blog/wp-content/uploads/2011/07/Image0021.png"><img class="alignnone size-full wp-image-1252" title="PMK4 Video Codec" src="http://alax.info/blog/wp-content/uploads/2011/07/Image0021.png" alt="" width="467" height="371" /></a></p>
<p>Looks like crapware, which is hostile to DirectShow environment, with possibly GPL compliance issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1250/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using IP Video Source programmatically as a standalone DirectShow Video Source Filter for JPEG and M-JPEG IP Cameras</title>
		<link>http://alax.info/blog/1241</link>
		<comments>http://alax.info/blog/1241#comments</comments>
		<pubDate>Sun, 17 Jul 2011 18:22:04 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Utilities]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[JPEG]]></category>
		<category><![CDATA[M-JPEG]]></category>
		<category><![CDATA[panasonic]]></category>
		<category><![CDATA[sample]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1241</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1241" title="Using IP Video Source programmatically as a standalone DirectShow Video Source Filter for JPEG and M-JPEG IP Cameras"></a>Recent IP Video Source class/module is not limited to use via registration as a video input/capture/source device. The filter is also registered as a regular filter and can be used programmatically in a regular way: CoCreateInstance, AddFilter etc. A C++ &#8230;<p class="read-more"><a href="http://alax.info/blog/1241">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1241" title="Using IP Video Source programmatically as a standalone DirectShow Video Source Filter for JPEG and M-JPEG IP Cameras"></a><p>Recent <a href="http://alax.info/blog/1216">IP Video Source</a> class/module is not limited to use via registration as a video input/capture/source device. The filter is also registered as a regular filter and can be used programmatically in a regular way: <a href="http://msdn.microsoft.com/en-us/library/ms686615%28VS.85%29.aspx">CoCreateInstance</a>, <a href="http://msdn.microsoft.com/en-us/library/dd390016%28VS.85%29.aspx">AddFilter</a> etc.</p>
<p>A C++ code snippet below shows how to import interface definition, create an instance of the filter, set it up and start video from a camera:</p>
<pre style="color: #000000; background: #ffffff;"><span style="color: #004a43;">#</span><span style="color: #004a43;">include </span><span style="color: #800000;">&lt;</span><span style="color: #40015a;">dshow.h</span><span style="color: #800000;">&gt;</span>
<span style="color: #004a43;">#</span><span style="color: #004a43; font-weight: bold;">pragma </span><span style="color: #bb7977; font-weight: bold;">comment(lib, </span><span style="color: #0000e6; font-weight: bold;">"strmiids.lib"</span><span style="color: #bb7977; font-weight: bold;">)</span>

<span style="color: #004a43;">#import </span><span style="color: #800000;">"</span><span style="color: #0000e6;">libid:BDCE8B49-8895-4605-8278-E9A1FBC889AC</span><span style="color: #800000;">"</span><span style="color: #004a43;"> no_namespace raw_interfaces_only raw_dispinterfaces named_guids </span><span style="color: #696969;">// IpVideoSource</span>

<span style="color: #696969;">// [...]</span>

<span style="color: #800000; font-weight: bold;">inline</span> <span style="color: #603000;">VOID</span> ATLENSURE_INLINE_SUCCEEDED<span style="color: #808030;">(</span>HRESULT nResult<span style="color: #808030;">)</span>
<span style="color: #800080;">{</span>
    ATLENSURE_SUCCEEDED<span style="color: #808030;">(</span>nResult<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
<span style="color: #800080;">}</span>

<span style="color: #696969;">// [...]</span>

CComPtr<span style="color: #800080;">&lt;</span>IBaseFilter<span style="color: #800080;">&gt;</span> pBaseFilter<span style="color: #800080;">;</span>
ATLENSURE_INLINE_SUCCEEDED<span style="color: #808030;">(</span>pBaseFilter<span style="color: #808030;">.</span>CoCreateInstance<span style="color: #808030;">(</span>CLSID_JpegVideoSourceFilter<span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
CComQIPtr<span style="color: #800080;">&lt;</span>IJpegVideoSourceFilter<span style="color: #800080;">&gt;</span> pJpegVideoSourceFilter <span style="color: #808030;">=</span> pBaseFilter<span style="color: #800080;">;</span>
ATLENSURE_THROW<span style="color: #808030;">(</span>pJpegVideoSourceFilter<span style="color: #808030;">,</span> E_NOINTERFACE<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
ATLENSURE_INLINE_SUCCEEDED<span style="color: #808030;">(</span>pFilterGraph<span style="color: #808030;">-</span><span style="color: #808030;">&gt;</span>AddFilter<span style="color: #808030;">(</span>pBaseFilter<span style="color: #808030;">,</span> <span style="color: #800000;">L"</span><span style="color: #0000e6;">Source</span><span style="color: #800000;">"</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>

ATLENSURE_INLINE_SUCCEEDED<span style="color: #808030;">(</span>pJpegVideoSourceFilter<span style="color: #808030;">-</span><span style="color: #808030;">&gt;</span>put_Location<span style="color: #808030;">(</span>CComBSTR<span style="color: #808030;">(</span>_T<span style="color: #808030;">(</span><span style="color: #800000;">"</span><span style="color: #0000e6;">http://p.viewnetcam.com:60001/nphMotionJpeg?Resolution=640x480&amp;Quality=Standard</span><span style="color: #800000;">"</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
ATLENSURE_INLINE_SUCCEEDED<span style="color: #808030;">(</span>pJpegVideoSourceFilter<span style="color: #808030;">-</span><span style="color: #808030;">&gt;</span>put_Width<span style="color: #808030;">(</span><span style="color: #008c00;">640</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
ATLENSURE_INLINE_SUCCEEDED<span style="color: #808030;">(</span>pJpegVideoSourceFilter<span style="color: #808030;">-</span><span style="color: #808030;">&gt;</span>put_Height<span style="color: #808030;">(</span><span style="color: #008c00;">480</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>

<span style="color: #004a43;">#</span><span style="color: #004a43; font-weight: bold;">pragma </span><span style="color: #bb7977; font-weight: bold;">region Render Output Pin</span>
CComPtr<span style="color: #800080;">&lt;</span>IEnumPins<span style="color: #800080;">&gt;</span> pEnumPins<span style="color: #800080;">;</span>
ATLENSURE_INLINE_SUCCEEDED<span style="color: #808030;">(</span>pBaseFilter<span style="color: #808030;">-</span><span style="color: #808030;">&gt;</span>EnumPins<span style="color: #808030;">(</span><span style="color: #808030;">&amp;</span>pEnumPins<span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
CComPtr<span style="color: #800080;">&lt;</span>IPin<span style="color: #800080;">&gt;</span> pPin<span style="color: #800080;">;</span>
ATLENSURE_THROW<span style="color: #808030;">(</span>pEnumPins<span style="color: #808030;">-</span><span style="color: #808030;">&gt;</span>Next<span style="color: #808030;">(</span><span style="color: #008c00;">1</span><span style="color: #808030;">,</span> <span style="color: #808030;">&amp;</span>pPin<span style="color: #808030;">,</span> <span style="color: #7d0045;">NULL</span><span style="color: #808030;">)</span> <span style="color: #808030;">=</span><span style="color: #808030;">=</span> S_OK<span style="color: #808030;">,</span> E_FAIL<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
ATLASSERT<span style="color: #808030;">(</span>pPin<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
ATLENSURE_INLINE_SUCCEEDED<span style="color: #808030;">(</span>pFilterGraph<span style="color: #808030;">-</span><span style="color: #808030;">&gt;</span>Render<span style="color: #808030;">(</span>pPin<span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
<span style="color: #004a43;">#</span><span style="color: #004a43; font-weight: bold;">pragma </span><span style="color: #bb7977; font-weight: bold;">endregion</span></pre>
<p>This starts M-JPEG video from Panasonic BB-HCM381A camera available to public online at http://p.viewnetcam.com:60001/nphMotionJpeg?Resolution=640&#215;480&amp;Quality=Standard</p>
<p>UPDATE: ATLENSURE_SUCCEEDED macro in the snippet replaced with ATLENSURE_INLINE_SUCCEEDED &#8211; see additional post on this.</p>
<p>C#.NET code snippet will look like this (using <a href="http://directshownet.sourceforge.net/">DirectShowLib</a>):</p>
<pre style="color: #000000; background: #ffffff;"><span style="color: #800000; font-weight: bold;">using</span> DirectShowLib<span style="color: #800080;">;</span>
<span style="color: #800000; font-weight: bold;">using</span> AlaxInfoIpVideoSource<span style="color: #800080;">;</span>

<span style="color: #696969;">// [...]</span>

FilterGraph filterGraph <span style="color: #808030;">=</span> <span style="color: #800000; font-weight: bold;">new</span> FilterGraph<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
IJpegVideoSourceFilter sourceFilter <span style="color: #808030;">=</span> Activator<span style="color: #808030;">.</span>CreateInstance<span style="color: #808030;">(</span>Type<span style="color: #808030;">.</span>GetTypeFromCLSID<span style="color: #808030;">(</span><span style="color: #800000; font-weight: bold;">new</span> Guid<span style="color: #808030;">(</span><span style="color: #800000;">"</span><span style="color: #0000e6;">{A8DA2ECB-DEF6-414D-8CE2-E651640DBA4F}</span><span style="color: #800000;">"</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span> <span style="color: #800000; font-weight: bold;">as</span> IJpegVideoSourceFilter<span style="color: #800080;">;</span>
IBaseFilter sourceBaseFilter <span style="color: #808030;">=</span> sourceFilter <span style="color: #800000; font-weight: bold;">as</span> IBaseFilter<span style="color: #800080;">;</span>
<span style="color: #808030;">(</span>filterGraph <span style="color: #800000; font-weight: bold;">as</span> IFilterGraph2<span style="color: #808030;">)</span><span style="color: #808030;">.</span>AddFilter<span style="color: #808030;">(</span>sourceBaseFilter<span style="color: #808030;">,</span> <span style="color: #800000;">"</span><span style="color: #0000e6;">Source</span><span style="color: #800000;">"</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
sourceFilter<span style="color: #808030;">.</span>Location <span style="color: #808030;">=</span> @<span style="color: #800000;">"</span><span style="color: #0000e6;">http://p.viewnetcam.com:60001/nphMotionJpeg?Resolution=640x480&amp;Quality=Standard</span><span style="color: #800000;">"</span><span style="color: #800080;">;</span>
sourceFilter<span style="color: #808030;">.</span>Width <span style="color: #808030;">=</span> <span style="color: #008c00;">640</span><span style="color: #800080;">;</span>
sourceFilter<span style="color: #808030;">.</span>Height <span style="color: #808030;">=</span> <span style="color: #008c00;">480</span><span style="color: #800080;">;</span>
IPin pin <span style="color: #808030;">=</span> DsFindPin<span style="color: #808030;">.</span>ByDirection<span style="color: #808030;">(</span>sourceBaseFilter<span style="color: #808030;">,</span> PinDirection<span style="color: #808030;">.</span>Output<span style="color: #808030;">,</span> <span style="color: #008c00;">0</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
<span style="color: #808030;">(</span>filterGraph <span style="color: #800000; font-weight: bold;">as</span> IFilterGraph2<span style="color: #808030;">)</span><span style="color: #808030;">.</span>Render<span style="color: #808030;">(</span>pin<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
<span style="color: #808030;">(</span>filterGraph <span style="color: #800000; font-weight: bold;">as</span> IMediaControl<span style="color: #808030;">)</span><span style="color: #808030;">.</span>Run<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
EventCode eventCode<span style="color: #800080;">;</span>
<span style="color: #808030;">(</span>filterGraph <span style="color: #800000; font-weight: bold;">as</span> IMediaEvent<span style="color: #808030;">)</span><span style="color: #808030;">.</span>WaitForCompletion<span style="color: #808030;">(</span><span style="color: #808030;">-</span><span style="color: #008c00;">1</span><span style="color: #808030;">,</span> <span style="color: #800000; font-weight: bold;">out</span> eventCode<span style="color: #808030;">)</span><span style="color: #800080;">;</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1241/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DirectShow App Mess: Google Video Chat vs. Skype</title>
		<link>http://alax.info/blog/1233</link>
		<comments>http://alax.info/blog/1233#comments</comments>
		<pubDate>Fri, 08 Jul 2011 15:26:06 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Utilities]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[chat]]></category>
		<category><![CDATA[crapware]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[skype]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1233</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1233" title="DirectShow App Mess: Google Video Chat vs. Skype"></a>Two widely popular applications, which use DirectShow API appeared to be locked in a combat: Google video chat is installing a plugin which registers artificial video capture sources &#8220;Google Camera Adapter 0&#8243; and &#8220;Google Camera Adapter 1&#8243;. As the application &#8230;<p class="read-more"><a href="http://alax.info/blog/1233">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1233" title="DirectShow App Mess: Google Video Chat vs. Skype"></a><p>Two widely popular applications, which use DirectShow API appeared to be locked in a combat: Google video chat is installing a plugin which registers artificial video capture sources &#8220;Google Camera Adapter 0&#8243; and &#8220;Google Camera Adapter 1&#8243;.</p>
<p>As the application does not announce any integration capabilities and is only using video for internal purposes for in-browser video, the approach with system-wide device registration is, well, questionable.</p>
<p><img class="alignnone size-full wp-image-1234" title="Google Chat DirectShow Video Sources" src="http://alax.info/blog/wp-content/uploads/2011/07/Image004.png" alt="" width="593" height="399" /></p>
<p><img class="alignnone size-full wp-image-1236" title="Video Capture Devices on AMCAP" src="http://alax.info/blog/wp-content/uploads/2011/07/Image001.png" alt="" width="655" height="557" /></p>
<p>No need to mention, that devices are not operational: they are giving ERROR_DLL_INIT_FAILED (Error 0x8007045A) as soon as you try to instantiate a filter in a DirectShow video capture enabled application.</p>
<p>In-browser Google Video Chat itself does work and shows video from &#8220;real&#8221; DirectShow devices, including such artificial as created by <a href="http://alax.info/blog/1216">IP Video Source</a> tool. Google developers prefer still to take data off the device and as soon as possible leave DirectShow domain, as their graph looks like:</p>
<p style="padding-left: 30px;">Video Capture Source -&gt; <a href="http://msdn.microsoft.com/en-us/library/dd377612%28VS.85%29.aspx">Smart Tee Filter</a> -&gt; <a href="http://msdn.microsoft.com/en-us/library/dd377544%28VS.85%29.aspx">Sample Grabber Filter</a> -&gt; <a href="http://msdn.microsoft.com/en-us/library/dd390934%28VS.85%29.aspx">Null Renderer Filter</a></p>
<p>While Google plugin developers might need some interprocess synchronization, as the plugin runs in a child &#8220;plugin container&#8221; process (plugin-container.exe), introduction of virtual video capture devices is not necessary, but is a plain garbage for the operating system and DirectShow environment.</p>
<p>For some reason, Google developers decided to introduce a special thing: they mirror captured video left-to right when it comes to showing picture capture locally. Well, quite possibly it starts a new era in video conferencing: one will not see a direct copy of video sent remotely, but instead he will be given a mirrored thing.</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2011/07/Image005.png"><img class="alignnone size-large wp-image-1235" title="Mirrored Video on Google Video Chat" src="http://alax.info/blog/wp-content/uploads/2011/07/Image005-800x253.png" alt="" width="620" height="196" /></a></p>
<p>The curious part is, however, the effect the broken devices introduce to another popular software &#8211; Skype.</p>
<p><span id="more-1233"></span>As Skype is capable of video capturing from a DirectShow device, for video-enabled conferencing, it enumerates the available devices and definitely gets in touch with the aliens from Google planet, which are already known to be broken junk.</p>
<p>The outcome appears to be subject to chances, there are two possible outcomes and only one is such that is more or less good for a user:</p>
<ul>
<li>either, Skype shows other available devices and ignores Google adapters (while basically any reasonable DirectShow video capture device would still list those devices &#8211; after all they are registered as existing!)</li>
<li>or, Skype stumbles upon a broken thing, stops enumeration and show no video capture devices available at all! Since Skype does enumeration only once on startup, if it fails to discover devices a user needs to close Skype completely and start it again for another try with video hardware.</li>
</ul>
<p><a href="http://alax.info/blog/wp-content/uploads/2011/07/Image002.png"><img class="alignnone size-medium wp-image-1237" title="Skype with No Cameras" src="http://alax.info/blog/wp-content/uploads/2011/07/Image002-320x273.png" alt="" width="320" height="273" /></a> <a href="http://alax.info/blog/wp-content/uploads/2011/07/Image003.png"><img class="alignnone size-medium wp-image-1238" title="Skype with non-Google Cameras" src="http://alax.info/blog/wp-content/uploads/2011/07/Image003-320x273.png" alt="" width="320" height="273" /></a></p>
<p>It appears that both applications have severe issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1233/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IP Video Source: Pure JPEG URLs and Software Version</title>
		<link>http://alax.info/blog/1227</link>
		<comments>http://alax.info/blog/1227#comments</comments>
		<pubDate>Tue, 07 Jun 2011 19:02:47 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Utilities]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[capture]]></category>
		<category><![CDATA[device]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[driver]]></category>
		<category><![CDATA[dshow]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[JPEG]]></category>
		<category><![CDATA[M-JPEG]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1227</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1227" title="IP Video Source: Pure JPEG URLs and Software Version"></a>This does not update the software with new features, but there are a few simple things worth mentioning explicitly. The first is that virtual DirectShow camera device can be set up with both M-JPEG and JPEG URLs. That is, IP &#8230;<p class="read-more"><a href="http://alax.info/blog/1227">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1227" title="IP Video Source: Pure JPEG URLs and Software Version"></a><p>This does not update the software with new features, but there are a few simple things worth mentioning explicitly.</p>
<p>The first is that virtual DirectShow camera device can be set up with both M-JPEG and JPEG URLs. That is, IP cameras which do not implement M-JPEG, or implement it in a buggy way (there is a *huge* deal of such out there) can still be set up to send video as individual video frames/images as long as they implement JPEG snapshots. This is taking place often at a lower frame rate, but still works.</p>
<p>The driver will automatically detect type of URL (by response from the device) and will choose best access method for the given URL.</p>
<p>Second is that if you are looking for IP Video Source software version, such as to check against available updates, it is here on the UI (right click the caption):</p>
<p><img class="alignnone size-full wp-image-1228" title="About on System Menu" src="http://alax.info/blog/wp-content/uploads/2011/06/Image004.png" alt="" width="563" height="430" /></p>
<p><img class="alignnone size-full wp-image-1229" title="About and Version" src="http://alax.info/blog/wp-content/uploads/2011/06/Image005.png" alt="" width="436" height="294" /></p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1227/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>IP Video Source: 64-bit version, resolution flexibility, Adobe FMLE</title>
		<link>http://alax.info/blog/1223</link>
		<comments>http://alax.info/blog/1223#comments</comments>
		<pubDate>Sun, 05 Jun 2011 17:42:10 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Utilities]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[capture]]></category>
		<category><![CDATA[device]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[driver]]></category>
		<category><![CDATA[dshow]]></category>
		<category><![CDATA[ecnoder]]></category>
		<category><![CDATA[encoder]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[FMLE]]></category>
		<category><![CDATA[google talk]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[JPEG]]></category>
		<category><![CDATA[M-JPEG]]></category>
		<category><![CDATA[skype]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1223</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1223" title="IP Video Source: 64-bit version, resolution flexibility, Adobe FMLE"></a>The IP Video Source update provides several improvements to the driver: copy/paste feature to backup, restore, or synchronize installed devices between 32-bit and 64-bit versions 64-bit version and .MSI dynamic video resizing (via Video Resizer DSP) Adobe FMLE compatibility Updates &#8230;<p class="read-more"><a href="http://alax.info/blog/1223">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1223" title="IP Video Source: 64-bit version, resolution flexibility, Adobe FMLE"></a><p>The <a href="http://alax.info/blog/1216">IP Video Source</a> update provides several improvements to the driver:</p>
<ul>
<li>copy/paste feature to backup, restore, or synchronize installed devices between 32-bit and 64-bit versions</li>
<li>64-bit version and .MSI</li>
<li>dynamic video resizing (via <a href="http://msdn.microsoft.com/en-us/library/ff819491%28VS.85%29.aspx">Video Resizer DSP</a>)</li>
<li>Adobe FMLE compatibility</li>
</ul>
<p>Updates in greater detail follow.</p>
<h4>Device Copy/Paste Feature</h4>
<p>The video device management window is providing Copy and Paste buttons, which let user transfer device information, including name and settings, through clipboard for various purposes:</p>
<ul>
<li>save data in order to be able to restore devices later</li>
<li>restore devices from saved list, or re-create from a list saved on another machine</li>
<li>duplicate a device</li>
<li>synchronize devices between 32-bit and 64-bit versions</li>
</ul>
<p>The device data is a text, one line per device, lines in comma-separated values (<a href="http://en.wikipedia.org/wiki/Comma-separated_values">CSV</a>) format.</p>
<p><img class="alignnone size-full wp-image-1224" title="Manage Video Devices" src="http://alax.info/blog/wp-content/uploads/2011/06/Image001.png" alt="" width="565" height="432" /></p>
<p><span id="more-1223"></span></p>
<h4>64-Bit Version</h4>
<p>Software is available in both 32-bit and 64-bit versions. While most of multimedia software is still 32-bit, sometimes 64-bit version is really helpful to, for example:</p>
<ul>
<li> interface to &#8220;Any CPU&#8221; .NET code which executes in 64-bit on a 64-bit operating system</li>
<li>go beyond 32-bit code boundaries, especially in part of multiple devices and virtual address space limit</li>
</ul>
<p>64-bit version duplicates functionality available in 32-bit version, though 32- and 64-bit modules run in completely separated environments.</p>
<p><img class="alignnone size-full wp-image-1225" title="Start Menu - Video Type-In" src="http://alax.info/blog/wp-content/uploads/2011/06/Image002.png" alt="" width="420" height="451" /></p>
<h4>Dynamic Video Resizing</h4>
<p>The source DirectShow filter is capable of connecting with media types different from original/camera media type in resolution part for decompressed video. The filter is internally taking advantage of <a href="http://msdn.microsoft.com/en-us/library/ff819491%28VS.85%29.aspx">Video Resizer DSP</a>, and resizes decompressed video to format of interest.</p>
<p>As Video Resizer DSP is available starting with Windows Vista, the functionality availability is subject to the same conditions.</p>
<p>The feature is absolutely required for Adobe Flash Media Live Encoder software, as it make certain assumptions as for supported resolutions, and completely ignores the information the filter makes available in standard way.</p>
<h4>Adobe Flash Media Live Encoder Friendliness</h4>
<p>The update make the device much closer to interoperation with Adobe product. The software works around a handful of bugs, including as ridiculous as neglecting to provide correct BI_RGB value in BITMAPINFOHEADER::biCompression structure, yet researchers are still to resolve the remained ones.</p>
<p>FMLE would start perfect and stream video being run under debugger, otherwise in a regular run chances are that Adobe application would internally respond with E_UNEXPECTED failure for unknown reason, stop any encoding without giving a single little notice on the GUI.</p>
<p>After all, the encoding runs perfectly through web based encoder, and the driver is providing a good way to stream to video distribution sites such as <a href="http://ustream.tv">http://ustream.tv</a>, <a href="http://livestream.com">http://livestream.com</a> from an IP camera or video encoder.</p>
<p><img class="alignnone size-large wp-image-1226" title="Adobe FMLE 3.2" src="http://alax.info/blog/wp-content/uploads/2011/06/Image003-800x600.png" alt="" width="620" height="465" /></p>
<h4>Download Information</h4>
<ul>
<li>Download (32-bit): <a href="../../blog-dist/AlaxInfoIpVideoSourceSetup.msi">AlaxInfoIpVideoSourceSetup.msi</a></li>
<li>Download (64-bit): <a href="http://alax.info/blog-dist/AlaxInfoIpVideoSourceSetup-x64.msi">AlaxInfoIpVideoSourceSetup-x64.msi</a></li>
<li>License: This software is free to use</li>
</ul>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1223/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>DirectShow Video Source Filter for JPEG and M-JPEG IP Cameras</title>
		<link>http://alax.info/blog/1216</link>
		<comments>http://alax.info/blog/1216#comments</comments>
		<pubDate>Sun, 22 May 2011 22:07:03 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Utilities]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[capture]]></category>
		<category><![CDATA[device]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[driver]]></category>
		<category><![CDATA[dshow]]></category>
		<category><![CDATA[ecnoder]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[google talk]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[JPEG]]></category>
		<category><![CDATA[M-JPEG]]></category>
		<category><![CDATA[skype]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1216</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1216" title="DirectShow Video Source Filter for JPEG and M-JPEG IP Cameras"></a>This implements a DirectShow driver/wrapper over a HTTP based JPEG/M-JPEG streamed video, widely available with IP cameras. Once installed, it provides a Start Menu shortcut to manage video capture devices, where a user can add/remove devices. The devices are automatically &#8230;<p class="read-more"><a href="http://alax.info/blog/1216">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1216" title="DirectShow Video Source Filter for JPEG and M-JPEG IP Cameras"></a><p>This implements a <a href="http://msdn.microsoft.com/en-us/library/dd375454%28VS.85%29.aspx">DirectShow</a> driver/wrapper over a HTTP based JPEG/<a href="http://en.wikipedia.org/wiki/Motion_JPEG#IP_Cameras">M-JPEG</a> streamed video, widely available with IP cameras. Once installed, it provides a Start Menu shortcut to manage video capture devices, where a user can add/remove devices. The devices are automatically registered with DriectShow and are available to applications.</p>
<p><img class="alignnone size-full wp-image-1217" title="Start Menu Shortcut" src="http://alax.info/blog/wp-content/uploads/2011/05/Image0011.png" alt="" width="451" height="482" /> <img class="alignnone size-full wp-image-1218" title="Manage Video Devices" src="http://alax.info/blog/wp-content/uploads/2011/05/Image0021.png" alt="" width="377" height="432" /></p>
<p>The compatibility list includes:</p>
<ul>
<li>Windows SDK <a href="http://msdn.microsoft.com/en-us/library/dd373424%28VS.85%29.aspx">AmCap</a> Sample (reference)</li>
<li><a href="http://msdn.microsoft.com/en-us/library/dd390950%28VS.85%29.aspx">VideoLan VLC</a></li>
<li><a href="http://www.skype.com/">Skype</a> (see below)</li>
<li><a href="http://www.google.com/talk/">Google Talk Video Chat</a></li>
<li><a href="http://luxriot.com">Luxriot</a> (as rather an example as Luxriot has its own generic JPEG/M-JPEG device driver, however this still demonstrates compatibility and interoperability of applications)</li>
<li><a href="http://msdn.microsoft.com/en-us/library/dd390950%28VS.85%29.aspx">GraphEdit</a>, GraphStudio and similar tools</li>
</ul>
<p><span id="more-1216"></span></p>
<p>For a created device it is required to configure:</p>
<ol>
<li>JPEG or M-JPEG resource URL on the device, where the driver will access video feed or sequential snapshots</li>
<li>Image/video size on the device</li>
</ol>
<p><img class="alignnone size-full wp-image-1219" title="Device Property Sheet - General Property Page" src="http://alax.info/blog/wp-content/uploads/2011/05/Image0032.png" alt="" width="377" height="432" /></p>
<p>Resource URLs vary from device to device and there is no standard identifier. This has to be looked up for specific model in device API reference or SDK. For JPEG snapshots it is possible to copy image shortcut from web browser and paste address into device settings.</p>
<p>Note that some devices, especially low end IP cameras deliver non-compliant feed which can be decoded either by manufacturer&#8217;s ActiveX control or model-specific implementation which this driver does not convert and is unlikely to ever cover. The driver will only work with hardware which honors industry standards.</p>
<p>For example, <a href="http://www.stardot.com/products/cameras">Stardot NetCam SC</a> cameras make the video feed accessible using /nph-mjpeg.cgi resource, so the full URL will consist of protocol prefix &#8220;http://&#8221;, optional username and password (see screenshot above), IP address or host name e.g. &#8220;demo2.stardotcams.com&#8221;, resource identifier on the device &#8220;/nph-mjpeg.cgi&#8221;.</p>
<p>Hence, http://demo2.stardotcams.com/nph-mjpeg.cgi</p>
<p>It is necessary to provide video size of the footage in advance so that the driver could negotiate content media types without accessing the device. Future versions of the driver might implement auto-detection.</p>
<h4>Skype Compatibility</h4>
<p>To make the device work with Skype, it is necessary to:</p>
<ol>
<li>Configure the device (using its web interface) to work at resolution 640&#215;480</li>
<li>Add/configure device with Alax.Info IP video Source as described above, including setting of 640 by 480 pixel resolution in device configuration</li>
</ol>
<p><img class="alignnone size-full wp-image-1220" title="Skype Video Device" src="http://alax.info/blog/wp-content/uploads/2011/05/Image0042.png" alt="" width="716" height="612" /></p>
<h4>Internals</h4>
<p>Software implements and registers video input/capture devices, listed under <a href="http://msdn.microsoft.com/en-us/library/ms783347%28VS.85%29.aspx">DirectShow CLSID_VideoInputDeviceCategory</a> category. The applications access devices from the list and treat as a regular device such as web camera.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/dd373424%28VS.85%29.aspx">Windows SDK AmCap sample</a> will create the following DirectShow graph where the source filter implemented by this software:</p>
<p><img class="alignnone size-full wp-image-1221" title="Outer DirectShow Fitler Graph" src="http://alax.info/blog/wp-content/uploads/2011/05/Image006.png" alt="" width="615" height="295" /></p>
<p>Internally, software creates a worker filter graph in order to stream data from the device:</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2011/05/Image0051.png"><img class="alignnone size-large wp-image-1222" title="Inner DirectShow Fitler Graph" src="http://alax.info/blog/wp-content/uploads/2011/05/Image0051-800x294.png" alt="" width="620" height="227" /></a></p>
<p>To decode video, software uses stock <a href="http://msdn.microsoft.com/en-us/library/dd390691%28VS.85%29.aspx">MJPEG Decompressor Filter</a> provided with operating system.</p>
<h4>Download Information</h4>
<ul>
<li>Download (32-bit): <a href="http://alax.info/blog-dist/AlaxInfoIpVideoSourceSetup.msi">AlaxInfoIpVideoSourceSetup.msi</a></li>
<li>Download (64-bit): To Be Done/On Request</li>
<li>License: This software is free to use</li>
</ul>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1216/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Utility Clearance: Enumerate VCM Codecs</title>
		<link>http://alax.info/blog/1194</link>
		<comments>http://alax.info/blog/1194#comments</comments>
		<pubDate>Mon, 25 Apr 2011 15:23:16 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Utilities]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[codec]]></category>
		<category><![CDATA[icm]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[utility]]></category>
		<category><![CDATA[vcm]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1194</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1194" title="Utility Clearance: Enumerate VCM Codecs"></a>EnumerateVcmCodecs uses ICOpen API to enuerate available codecs and prints out information obtained from enumeration. 32-bit and 64-bit versions respectively enumerate codecs available for the platform (lists may vary because the codecs are actually provided by different DLLs, built for &#8230;<p class="read-more"><a href="http://alax.info/blog/1194">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1194" title="Utility Clearance: Enumerate VCM Codecs"></a><p>EnumerateVcmCodecs uses <a href="http://msdn.microsoft.com/en-us/library/dd756960%28VS.85%29.aspx">ICOpen</a> API to enuerate available codecs and prints out information obtained from enumeration. 32-bit and 64-bit versions respectively enumerate codecs available for the platform (lists may vary because the codecs are actually provided by different DLLs, built for respective platform).</p>
<pre>szName
  fccType: 0x63646976 (vidc), fccHandler 0x64697663 (cvid)
  dwFlags 0
  dwVersion 0x0, dwVersionICM 0x104
  szDescription ""
  szDriver "iccvid.dll"
szName
  fccType: 0x63646976 (vidc), fccHandler 0x30323469 (i420)
  dwFlags 0
  dwVersion 0x0, dwVersionICM 0x104
  szDescription ""
  szDriver "msh263.drv"
...</pre>
<p>A binary [<a href="http://trac2.assembla.com/roatl-utilities/browser/trunk/EnumerateVcmCodecs/_Bin/Win32/Release/EnumerateVcmCodecs.exe?format=raw">Win32</a>, <a href="http://trac2.assembla.com/roatl-utilities/browser/trunk/EnumerateVcmCodecs/_Bin/x64/Release/EnumerateVcmCodecs.exe?format=raw">x64</a>] and Visual C++ .NET 2010 source code <a href="http://trac2.assembla.com/roatl-utilities/browser/trunk/EnumerateVcmCodecs">are  available from SVN</a>.</p>
<p>See also:</p>
<ul>
<li><a href="http://social.msdn.microsoft.com/Forums/en-US/windowsdirectshowdevelopment/thread/d9029891-25e5-4ed1-ab31-9cae7c6c8eae">related topic on MSDN Forums</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1194/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Utility Clearance: Export AVI Resources</title>
		<link>http://alax.info/blog/1190</link>
		<comments>http://alax.info/blog/1190#comments</comments>
		<pubDate>Sun, 24 Apr 2011 16:10:58 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Utilities]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[ATL]]></category>
		<category><![CDATA[AVI]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[resource]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[utility]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1190</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1190" title="Utility Clearance: Export AVI Resources"></a>ExportAviResources walks through AVI video clips attached as resources to a binary file and exports them into separate files. Such clips can be used with Animation Controls for GUI animations. You might want to run the utility against SYSTEM32/SYSWOW64 folders &#8230;<p class="read-more"><a href="http://alax.info/blog/1190">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1190" title="Utility Clearance: Export AVI Resources"></a><p>ExportAviResources walks through AVI video clips attached as resources to a binary file and exports them into separate files.</p>
<p>Such clips can be used with <a href="http://msdn.microsoft.com/en-us/library/bb761881%28VS.85%29.aspx">Animation Controls</a> for GUI animations. You might want to run the utility against SYSTEM32/SYSWOW64 folders to see if any of stock animations are good for you:</p>
<pre>D:\&gt;for %i in (C:\Windows\system32\*.dll) do "..\Utilities\ExportAviResources\x64\Release\ExportAviResources.exe" "%i"</pre>
<p>A binary [<a href="http://trac2.assembla.com/roatl-utilities/browser/trunk/ExportAviResources/_Bin/Win32/Release/ExportAviResources.exe?format=raw">Win32</a>, <a href="http://trac2.assembla.com/roatl-utilities/browser/trunk/ExportAviResources/_Bin/x64/Release/ExportAviResources.exe?format=raw">x64</a>] and Visual C++ .NET 2010 source code <a href="http://trac2.assembla.com/roatl-utilities/browser/trunk/ExportAviResources">are  available from SVN</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1190/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

