Questions on Video and Compression

Locked Questions on Video and Compression

  • Monday, July 16, 2007 11:46 PM
     
     

    I am now looking into the source code for the client service and I am having trouble with the following things. If you could answer these questions for me, I would be very appreciative:


    1. Where exactly or in what file is the source located for actually playing video?

    2. Where exactly or in what file is the code located for sending the video to the internet?

    3. Where exactly or in what file is the code for compression and where is the interface for the compressor or is the default windows compressor used?

    4. What is the schematic for compression? Can there be separate compressors for the video shown on the local screen and the screens of internet viewers?

    5. Are there any updated notes that go along with the 4.0 client and not the 3.5 client?



    Thank you again and I look forward to hearing from you.

    • Moved by Max Wang_Chinasoft Thursday, April 28, 2011 7:54 PM forum consolidation (From:Developer Discussions)
    •  

All Replies

  • Tuesday, July 17, 2007 6:27 PM
     
     

    For sample projects, install the conferencexp source project.


    2. Where exactly or in what file is the code located for sending the video to the internet?


    I m looking for that, too.


    Actually i'm sending the video with this code but couldn't manage to receive and show the video.


    Sender:

                    vcg = new VideoCaptureGraph((FilterInfo)cklbCameras.SelectedItem);

                    vcg.RenderNetwork(this.rtpVideoSender);

                    vcg.Run();           // CF5 Start graph -> Show video



    Receiver: (doesn't work)

            private void FrameReceived(object sender, RtpStream.FrameReceivedEventArgs ea)
            {
                switch ( ea.RtpStream.PayloadType )
                {
                    case PayloadType.dynamicVideo:
                        VideoReceived(ea);
                        return;


  • Wednesday, July 18, 2007 3:29 PM
     
     

    CXPHU,

     

    1.  It kind of depends on what you mean by "playing" video.  Do you mean...

     

    Where are the render graphs constructed?  See RtpStream_FirstFrameReceived in Audio or VideoCapability.cs

    Or are you asking more generally how DirectShow works?  I'll address that in the next question.

     

    2.  Similarly, do you mean...

     

    Where are the Audio and Video sending capabilities created?  FMain.cs of CXPClient (BarUI)

    Or where does the network sender get introduced?  RenderNetwork of the CaptureGraph

    Which filter handles this and how?  We have 2 custom network filters for sending and receiving the data off the network.  They fit into DirectShow graphs as follows.  In the sending graph you have, Source => (Optional Compressor) => CxpRtpRenderer, and on the receiving side graph you have, RtpSource => (optional Decompressor and any needed transforms) => Renderer.

     

    3.  We have default compression rates that are located at DeafultVideoCompressorSettings in VideoCapability.cs.  If  custom compression rate is set, we store it in the registry and read it back from there when needed.

     

    4.  Although you could split the video signal and encode it differently for local vs. remote, I am not sure why you would want to.  Encoding video requires a lot of cpu; encoding it twice...  It would make more sense to have no encoding for local video and just render the stream directly.  In any event, that is handled in the VideoCompressor class in Filters.cs, using the interfaces that DirectShow and the Windows Media codecs expose.

     

    5.  No.  4.0's purpose was to upgrade from .Net 1.1 to .Net 2.0.  I don't believe any functionality changed that would outdate the documentation.

     

    JVE

  • Wednesday, July 18, 2007 3:34 PM
     
     

    Miclare,

     

    We don't use the eventing code for Audio and Video.  DirectShow provides the threads for reading that data via our filters.

     

    Your best bet to understand how the code works is to step through it from the GUI down (Rtcp packets and RtpSender streams) and also from the network layer up (Rtcp packets and RtpStream frames).  Those are pretty much the 2 basic directions that our code flows.

     

    Let me know if I can answer more specific questions.

     

    By the way, we do have a sample program that includes networking and the video.  It is in the AudioVideo_Samples.sln.

     

    JVE

  • Thursday, July 19, 2007 8:18 AM
     
     
     Jason Van Eaton wrote:

    Miclare,

    We don't use the eventing code for Audio and Video. DirectShow provides the threads for reading that data via our filters.

    Your best bet to understand how the code works is to step through it from the GUI down (Rtcp packets and RtpSender streams) and also from the network layer up (Rtcp packets and RtpStream frames). Those are pretty much the 2 basic directions that our code flows.

    Let me know if I can answer more specific questions.

    By the way, we do have a sample program that includes networking and the video. It is in the AudioVideo_Samples.sln.

    JVE



    Hi Jason,

    Thank u for the answer. I looked at the AudioVideo_Samples solution. This project only works for receiving and showing the first frame. Could you help me to make it show the whole video conversa
    tion.
  • Thursday, July 19, 2007 2:11 PM
     
     

    Miclare,

     

    The sample works fine for me (video at 30 frames per second).  Do you get any errors in the event logs - Rtp, Conference, Filters, UnEx?

     

    JVE

  • Tuesday, July 24, 2007 3:26 PM
     
     

    I am mainly trying to find out where the code for actual compression of video is located. Also, I am having troubling seeing how and where the bit rates are dealt with in the code. Lastly, are the objects (vcg and cg) the same or separate objects in playing video and sending the video to the internet? Thank you

  • Tuesday, July 24, 2007 4:10 PM
     
     

    Point 3 above...

     

    /// <summary>

    /// By default, we use the WMVideo9 Encoder DMO, WMV1 media type

    ///

    /// We support 3 basic default bit rates for video

    /// 100 Kbps for video &lt; 320 x 240

    /// 300 Kbps for video &gte; 320 x 240 && &lt; 640 x 480

    /// 1 Mbps for video &gte; 640 x 480

    /// </summary>

    private void DefaultVideoCompressorSettings()

    {

    // Read camera's current media type

    _AMMediaType mt;

    object fb;

    vcg.Source.GetMediaType(out mt, out fb);

    if(!(fb is VIDEOINFOHEADER))

    {

    Debug.Fail(string.Format(CultureInfo.CurrentCulture,

    "We were expecting a VIDEOINFOHEADER format block, not a {0}",

    MediaType.FormatType.GuidToString(mt.formattype)));

    return;

    }

    // Construct the compressor settings

    VideoCompressorQualityInfo vcqi = DefaultQualityInfo();

    VIDEOINFOHEADER vih = (VIDEOINFOHEADER)fb;

    int bmpRes = vih.BitmapInfo.Height * vih.BitmapInfo.Width;

    if(bmpRes < 320 * 240)

    {

    vcqi.BitRate = 100000;

    }

    else if(bmpRes < 640 * 480)

    {

    vcqi.BitRate = 300000;

    }

    else

    {

    vcqi.BitRate = 1000000;

    }

    // Set the Video Compressor's Quality

    vcg.VideoCompressor.QualityInfo = vcqi;

    }

     

    You will need to step through the code of the last line until you are comfortable with how this gets set on the filter.

     

    A VideoCaptureGraph is a specialized version of a CaptureGraph.  From your question, I would call them the same.

     

    JVE