Search code examples
winapivideovideo-capturevideo-processing

Can Video For Windows (VFW) allow multiple video streams in one file?


There is not much theory or documentation on the concepts of streams and samples in Video For Windows API (VFW). I am wondering if a video should only contain:

  • one video stream
  • one audio stream

Or can a video contain multiple video streams (one after the other) and multiple audio streams?

I assume a "sample" just means one frame of the video, not multiple frames. I assume a stream, is a collection of frames or collection of samples. So it would be useful to divide a video into multiple streams (collections of frames) to make multiple "sections", or multiple streams

If you cannot have multiple streams in a video, and this api is only designed to have one video stream per video (with an optional audio stream), how would one create a video composed of multiple sections? Just edit/cut/paste directly into a single stream? Or use a different API such as MediaFoundation/DirectShow instead?


Solution

  • I'm not sure if it's doable via plain VfW but apparently the AVI format does support multiple video streams. I found a thread which has samples from a Fujifilm Finepix Real3D W1 camera with dual video streams:

      Duration: 00:00:02.99, start: 0.000000, bitrate: 9676 kb/s
        Stream #0.0: Video: mjpeg, yuvj422p, 320x240, 30 tbr, 30 tbn, 30 tbc
        Metadata:
          strn            : FUJIFILM AVI STREAM 0200
        Stream #0.1: Audio: pcm_s16le, 11024 Hz, 2 channels, s16, 352 kb/s
        Stream #0.2: Video: mjpeg, yuvj422p, 320x240, 30 tbr, 30 tbn, 30 tbc
        Metadata:
          strn            : FUJIFILM AVI STREAM 0200
    

    Posters offered advice on how to split such a video. Among the options were ffmpeg and DirectShow-based software (GraphEdit and GraphStudioNext); I suspect you can use them to create such a video as well.