I added two new simple samples for the MediaTools DirectShow filters to demonstrate how to capture M-JPEG video feed, esp. from an IP camera, and write the video frames into sequence of JPEG files. The other sample takes a directory on the input and plays the images back as video. If you are working on certain transformation filter, it is an easy way to make a reference feed and use it for debugging purposes.
The filters behind that empower the sample are described in another post.
RenderHttpMjpegVideoIntoFiles01 sample takes an URL on the input to generate image/jpeg JPEG or multipart/x-mixed-replace M-JPEG stream. For example, it might be http://demo1.stardotcams.com/nph-mjpeg.cgi feed from a demo StarDot Technologies IP camera.
The application will create a new directory to write files into, and will save each new video frame received into new JPEG file.
Z:\MediaTools\Samples\RenderHttpMjpegVideoIntoFiles01\Release>RenderHttpMjpegVideoIntoFiles01.exe http://demo1.stardotcams.com/nph-mjpeg.cgi URL: http://demo1.stardotcams.com/nph-mjpeg.cgi Writing to directory: Z:\MediaTools\Samples\RenderHttpMjpegVideoIntoFiles01\Release\2010-05-12 22-07-37 Event: nCode EC_CLOCK_CHANGED 0xD, nParameter1 0x00000000, nParameter2 0x00000000 Event: nCode EC_PAUSED 0xE, nResult 0x00000000, nParameter2 0x00000000 [...] ^C
The application will generate the files and convert media sample time stamps into file time.
The DirectShow graph that implements the operation is the following:
The other sample RenderJpegFiles01 takes a directory path to look for JPEG files, e.g. generated by previous sample, and pushes them into DirectShow graph as a video feed. File times will be converted [back] to media sample times.
Z:\MediaTools\Samples\RenderJpegFiles01\Release>RenderJpegFiles01 "Z:\MediaTools\Samples\RenderHttpMjpegVideoIntoFiles01\Release\2010-05-12 22-07-37" Directory: Z:\MediaTools\Samples\RenderHttpMjpegVideoIntoFiles01\Release\2010-05-12 22-07-37 Event: nCode EC_CLOCK_CHANGED 0xD, nParameter1 0x00000000, nParameter2 0x00000000 Event: nCode EC_PAUSED 0xE, nResult 0x00000000, nParameter2 0x00000000 Event: nCode EC_VMR_RECONNECTION_FAILED 0x55, nResult 0x80004005, nParameter2 0x00000000 Event: nCode EC_VMR_RENDERDEVICE_SET 0x53, RendererDeviceType 0x2, nParameter2 0x00000000 Event: nCode EC_VIDEO_SIZE_CHANGED 0xA, Extent 384x240, nParameter2 0x00000000 Event: nCode EC_COMPLETE 0x1, nResult 0x00000000, nParameter2 0x00000000 Event: nCode EC_ERRORABORT 0x3, nResult 0x80004005, nParameter2 0x00000000 Detected resolution change, new resolution is 1024x768, recreating filter graph... Event: nCode EC_VMR_RECONNECTION_FAILED 0x55, nResult 0x80004005, nParameter2 0x00000000 Event: nCode EC_VMR_RENDERDEVICE_SET 0x53, RendererDeviceType 0x2, nParameter2 0x00000000 Event: nCode EC_VIDEO_SIZE_CHANGED 0xA, Extent 384x240, nParameter2 0x00000000 Event: nCode EC_CLOCK_CHANGED 0xD, nParameter1 0x00000000, nParameter2 0x00000000 Event: nCode EC_PAUSED 0xE, nResult 0x00000000, nParameter2 0x00000000
Download links:
- RenderHttpMjpegVideoIntoFiles01: source code, binary
- RenderJpegFiles01: source code, binary
Hi,
I am unable to download your binaries as well as the source code
Thanks,
krish
Krish, I fixed the link for RenderJpegFiles01 binary, the rest of the links are good. You can download source code using SVN client or file by file using browser.