locked
Write BufferCB frames to Avi RRS feed

  • Question

  • Is there a way i can add frames that is grabbed in BufferCB to an AVI file in DirectShow?

    I don't want to use a File Writer in my graph but i want to decide myself which frames are written to my AVI file.

    ThanksAHR

    Wednesday, August 10, 2011 7:34 PM

All replies

  • ahrahr wrote:
    >
    >Is there a way i can add frames that is grabbed in BufferCB to an AVI file
    >in DirectShow?
    >
    >I don't want to use a File Writer in my graph but i want to decide myself
    >which frames are written to my AVI file.
     
    There are several ways.  There is an AVIFile API available that pre-dates
    DirectShow.  You can create AVI fiiles by hand with it.
     
    On the other hand, it might be easier for you to write a very simple filter
    to select the frames, and insert that in your graph just before the AVI Mux
    and File Writer.  You'll have to adjust or eliminate the timestamps, but
    otherwise it should work.
    --
    Tim Roberts, timr@probo.com
    Providenza & Boekelheide, Inc.
     

    Tim Roberts, DDK MVP Providenza & Boekelheide, Inc.
    Thursday, August 11, 2011 4:46 AM
  • Hi Tim

    Sorry my late response.

     

    Do you know where i can find a good tutorial on how to write my own filter in C# or is that not possible to do in C#?

     

    Br

    AHR

    Friday, September 9, 2011 4:46 PM
  • ahrahr wrote:
    >
    >Do you know where i can find a good tutorial on how to write my own
    >filter in C# or is that not possible to do in C#?
     
    It is certainly possible -- go look up DirectShowNet.  Whether it is
    advisable or not is a more difficult question.
     
    Actually, I'm just being snarky.  As long as you're not working in
    real-time, it should be fine.
    --
    Tim Roberts, timr@probo.com
    Providenza & Boekelheide, Inc.
     

    Tim Roberts, DDK MVP Providenza & Boekelheide, Inc.
    Saturday, September 10, 2011 3:53 AM
  • Actually, you coud do what you want with a simple trans in place filter, avi mux and file writer.

    In the transform() , you decide if you want to write the frame or not.  I the first case, return S_OK, in the second one, return S_FALSE (which causes the frame to be discarded by the transform filter).

    The only additional point is you have to take care of the retained frames fimestamps, and fix them so that the frames timestamps are consecutive (otherwise if it detects timestamps gaps, the AVI mux will fill the missing frames by repeating the previous frame). 

     

     


    Michel Roujansky, http://www.roujansky.com
    Saturday, September 10, 2011 7:49 PM
  • Thanks guys.

     

    One question, what is a "simple trans in place filter"? Is that a filter i need to write myself and can you guide to me some tutorials or examples on how to that i can use?

     

    Br

    AHR

    Monday, September 12, 2011 3:25 AM
  • Argh, i guess you are talking about custom created filters.

    I hope i can do something like:

    Webcam1 - AVI Mux - SampleGrabber \                             / File Writer 1

                                                                      = My Filter =

    Webcam2 - AVI Mux - SampleGrabber /                             \ File Writer 2

    "My Filter" should contain two input and two output pins. My Filter must buffer frames grabbed from webcam 1 and 2. Once i got a frame on input 1 and a frame at the same sampling time on input 2 i will send them to each of the file writers.

    Is the above possible and are you able to help me.

     

    Br

    AHR

    Monday, September 12, 2011 7:23 PM