Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Using The H.264 Decoder To Decode IP Camera Stream

TBoone
2013-03-17
2013-04-01
  • TBoone
    TBoone
    2013-03-17

    I would like to use the H.264 Decoder to decode the 720P H.264 stream from an IP camera. I know how to write a source filter to get access to the data stream from the camera. I would assume that I can use the source filter's fillbuffer method to simply pass the H.264 encoded data downstream to a connected H.264 Decoder. Is this correct or am I oversimplifying the problem. Any help, suggestions, etc are greatly appreciated.
    

    -TB

     
  • Ralf Globisch
    Ralf Globisch
    2013-03-17

    That's right, the main thing is to fill out the media type of the source filter so that the connection to the decoder can take place. You can select MEDIASUBTYPE_AVC1 to pass NAL units without start codes and MEDIASUBTYPE_H264 for NAL units with start codes. Also, be sure to pass the SPS and PPS to the decoder. See http://msdn.microsoft.com/en-us/library/windows/desktop/dd757808(v=vs.85).aspx for more info on media types. If you're looking for an example, you can check out the H.264 source filter code . It loads NAL units from a .264 file and sends them to a decoder.

     
  • TBoone
    TBoone
    2013-03-17

    Thanks for the reply. So other than making sure that the mediatype is correct, it looks like all I need to do is copy the downloaded stream data to the output pin in the Fillbuffer method. No data processing/parsing of the stream data from the camera is necessary?

    -TB

     
  • TBoone
    TBoone
    2013-03-31

    I have been trying to download the source code for the H264Source filter file by file and since I'm not familiar with the layout of this site, I'm having trouble finding all the current & proper files in the project. Is there a way to download the entire H264Source filter project at once?

    Thanks for any help...

    Tom Fisher

     
  • Ralf Globisch
    Ralf Globisch
    2013-04-01

    Hi,

    The easiest would be to use a subversion client and then to checkout the trunk using the following URI:

    svn checkout svn://svn.code.sf.net/p/videoprocessing/code/trunk videoprocessing-code

    Another option is to use the repo browser of tortoise svn if you prefer GUI-like tools.

    You'll find the source for the codec in
    trunk/videoprocessing/Source/Codecs/H264v2Codec/
    It relies heavily on
    trunk/videoprocessing/Source/Codecs/CodecUtils/

    The source for the filters can be found under

    trunk/videoprocessing/Source/Filters/DirectShow/

    Cheers,
    Ralf

     
  • TBoone
    TBoone
    2013-04-01

    Thanks again. I have cobbled together the source and successfully compiled it. However, I can't seem to find a .mp4 test file so that I can run it in the debugger. Can you point me to an appropriate file that the filter will accept?

    Tom Fisher

     
  • TBoone
    TBoone
    2013-04-01

    I found the foreman.h264 file. Also had to set the boolean m_bUseRtvcH264 in GraphEdit so that the decoder would connect to it!! Of course you knew that! Now reaize that the decoder will only connect to MEDIASUBTYPE_H264M ??

    Thanks for any hints!!

    Tom Fisher

     
  • Ralf Globisch
    Ralf Globisch
    2013-04-01

    Hi Tom,

    After re-reading your initial post, I must apologise: When I read your first post I understood you wanted to read an H.264 stream from an IP camera, and output it to a H.264 decoder, not that you wanted to use our decoder to decode the stream, but after re-reading the thread, it seems quite clear. Have you seen the limitations of our H.264 codec (http://devcon-1.blogspot.com/2012/03/h.html)? Please check if the stream from your IP camera conforms to the limitations. It's due to those limitations that we use our own media type instead of the standard H.264 DirectShow media types.

    Also, I'm sure you might be aware of it, but just in case you aren't: Windows 7 has a built-in H.264 decoder?