CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    Join Date
    Nov 2001
    Location
    London, UK
    Posts
    275

    Arrow Video streaming!!!

    hi,
    may be my question is too open but i just need a general view of how to do it.

    the problem is:

    How to make a webcam work using a C program and then stream the video on network?

    Another problem is that the streaming server should be capable of handling multiple requests at the same time so that more than one users are able to view the video.

    Any suggestions or views?

  2. #2
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940
    Try having a look at DirectShow. You could also look at the Video For Windows help pages.

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  3. #3
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    628

    Re: Video streaming!!!

    i realize that this is an old post, but here's hoping!

    i am trying to do exactly teh same thing! and i was wiondering if you decided to use directshow or vfw.. which one did you choose and why? this would really help me out!

  4. #4
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: Video streaming!!!

    VFW is really old. I'd recommend getting to know the Windows Media Encoder which will act as a basic streaming server.

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  5. #5
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    628

    Re: Video streaming!!!

    hi Darwen,

    Thanks for replying. i'm a little bit stumped tho!

    i tried to install the directx sdk. all the info i found on teh web seems very hyped on something called a graph editor. i found that you have to go to start, programs, microsoft directx version wahtever, graph editor to launch it. but after having installed it, i cannot find this! seems there was a problem in installing it. just to make sure i have the right file, i went to http://msdn.microsoft.com/library/de...st/directx.asp and downloaded:

    "DirectX 9.0c Redistributable for Software Developers - Multilingual with Updated DirextX for Managed Code - (December 2004)
    This download provides the end-user redistributable that developers may include with their product. The redistributable license agreement covers the terms under which developers may use the Redistributable. This update includes the DirectX for Managed Code Update from the DirectX 9.0 SDK Update (December 2004).

    Date: December 10, 2004
    "

    is this the correct file? and is there some special way to install it or something? i just unzipped teh file and ran the setup like i would for anythign else... what could be wrong?

    i would really appreciate any info you guys could give me.. i'm really stumped!

    thanks a lot!
    drew.

  6. #6
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    628

    Re: Video streaming!!!

    looks like i might have had the wrong file
    stupid ms said it was the right one!
    for future reference for anyone who needs directx sdk, go to: http://www.activewin.com/awin/commen...=14757&Group=1

    there are a bunch of links.. make sure the file you're downloading is atleast 200mb!

    will get back to you and let you know if its actually the right file i got this time!

  7. #7
    Join Date
    Oct 2002
    Posts
    1,134

    Re: Video streaming!!!

    The Graph Editor is part of the SDK, not part of the redistributable code. Once you've got it, you'll quickly understand why it's regarded as an essential part of DirectX development!
    Regards
    Robert Thompson

  8. #8
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: Video streaming!!!

    Firstly, thanks for filling in the holes.

    In fact, the graph editor can be used to view the filter graph in your application.

    You need to use the Running Object Table COM object (which is a way of doing interprocess communication - it registers COM objects which are running).

    Have a look at these code snippets from the DirectX documentation (just search for IRunningObjectTable and you'll get to them)

    Code:
    HRESULT AddToRot(IUnknown *pUnkGraph, DWORD *pdwRegister) 
    {
        IMoniker * pMoniker;
        IRunningObjectTable *pROT;
        if (FAILED(GetRunningObjectTable(0, &pROT))) {
            return E_FAIL;
        }
        WCHAR wsz[256];
        wsprintfW(wsz, L"FilterGraph %08x pid %08x", (DWORD_PTR)pUnkGraph, GetCurrentProcessId());
        HRESULT hr = CreateItemMoniker(L"!", wsz, &pMoniker);
        if (SUCCEEDED(hr)) {
            hr = pROT->Register(ROTFLAGS_REGISTRATIONKEEPSALIVE, pUnkGraph,
                pMoniker, pdwRegister);
            pMoniker->Release();
        }
        pROT->Release();
        return hr;
    }
    and to remove :

    Code:
    void RemoveFromRot(DWORD pdwRegister)
    {
        IRunningObjectTable *pROT;
        if (SUCCEEDED(GetRunningObjectTable(0, &pROT))) {
            pROT->Revoke(pdwRegister);
            pROT->Release();
        }
    }
    If you keep the format string to what is defined, then GraphEdit will pick it up and you can see exactly what's going on in your filter graph.

    I find this invaluable !

    I should write a book on this subject you know....

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  9. #9
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: Video streaming!!!

    And don't forget to rate !

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  10. #10
    Join Date
    Nov 2004
    Location
    Virginia, The lovers' state
    Posts
    64

    Talking Re: Video streaming!!!

    Quote Originally Posted by drewdaman
    looks like i might have had the wrong file
    stupid ms said it was the right one! .........

    will get back to you and let you know if its actually the right file i got this time!
    Q: You know what I say to any one who is just starting to learn DirectShow?

    A: GOOD LUCK, and Heart felt sympathies.... :-)

    Let me give you a news you may be interested in - starting from the october 2004 update, MS decided to REMOVE DIRECTSHOW from the DirectX SDK.... It has now been moved to the Platform SDK......

  11. #11
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: Video streaming!!!

    Thanks for the downloading tip.

    DirectShow is complicated, and needs a great deal of COM knowledge.

    It's not easy. In fact it's extremely difficult in C++ - bearing in mind the COM knowledge that is required.

    However, I'm working on a C# interop dll for DirectShow as we speak, and then it'll get a whole lot easier.

    I don't know when it'll be released but the .NET capability of wrapping COM objects should make interfacing with DirectShow a lot easier....

    Makes my article about interfacing with COM IUnknown interfaces come into focus eh ?

    Darwen.
    Last edited by darwen; January 27th, 2005 at 06:37 PM.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  12. #12
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: Video streaming!!!

    Oh and to rate, you need to go to the 'rate this post' link at the top right of the particular submission, not the entire article.

    Please rate again.

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  13. #13
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    628

    Re: Video streaming!!!

    hi guys. thanks for all the replies. don't worry about the rating.. it it (or will be in a minute) taken care of!

    i have no com knowledge at at so.. from what you guys are telling me, it directshow would be really hard for me to learn.

    so, what i would like to ask you guys now is if there is a simpler way to do waht i need. when i researched teh web and looked up other codeguru artilces, everythign seemed to point towards directshow.

    to recap, what i would like to do is to be able to get hold of a stream from a webcam, send it out over the internet and be able to view it at another machine. so basically, i want to be able to connect my webcam at home, go on vacation and be able to see my house from my laptop. can anyone suggest a simplier way to accomplish this than directshow? i was looking into vfw, but it seems that vfw was intended mainly for capturing stuff to your hard drive. please correct me if i am wrong.

    thanks again for all the interest and information! ratings are coming!

  14. #14
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: Video streaming!!!

    Again download the windows media encoder and see if it'll do what you ask.

    You won't have to touch direct show then.

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  15. #15
    Join Date
    Feb 2002
    Location
    Surrey, England
    Posts
    99

    Re: Video streaming!!!

    I'm not sure I'm too clear on this. Do you want to write code to forward the video traffic from your web cam, or write a video viewing application, or both?

    Maybe no code is needed at all, it seems to me this is just a network traffic issue.

    All you need to do is map the port from you web cam through your firewall/router so that it is visible externally. You'll need to have a static IP address so you can be sure what address to browse to whilst you are on holiday (some ISPs allocate them dynamically and you can never be sure of getting the same address twice).

    With any luck, the viewing software on your laptop should allow you to specify the IP address and port number.

    If you set this up all should be fine. You'll need to leave your PC running the whole time you are away though unless it's dedicated, free standing IP camera.

    Hope this is relevant and helps!

    Mark

    PS Another alternative would be to periodically capture images from your web camera and upload them onto a web server so you could browse them externally through an ordinary browser. Good luck.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured