random access to video file

Discussion in 'Python' started by JRV, Sep 25, 2012.

  1. JRV

    JRV Guest

    Hello,

    Is there a method for randomly accessing a video file in Python / OpenCV ?

    A kind of fseek which would allow to go directly to frame n ...

    Cordially,
    JRV
    JRV, Sep 25, 2012
    #1
    1. Advertising

  2. On Tue, 25 Sep 2012 01:51:43 -0700 (PDT), JRV
    <> declaimed the following in
    gmane.comp.python.general:

    > Hello,
    >
    > Is there a method for randomly accessing a video file in Python / OpenCV ?
    >
    > A kind of fseek which would allow to go directly to frame n ...
    >

    What format video file?

    Most are some variation of IFF chunked data, possibly interleaving
    the audio chunks with video image (especially in streaming formats --
    whereas a fast drive might support having one video and one audio chunk,
    doing a lot of seeking between the two during playback).

    DV-AVI (as produced from standard definition miniDV tape cameras)
    have video encoded as a stream of JPEG frames. Since JPEG doesn't
    produce a constant output size for varying input, one can not just
    compute a "jump n-frames forward" except by having processed all the
    intermediate frames.

    MPEG (memory card/disk based standard definition cameras and HDV
    tape) uses a Group-of-Pictures concept, typically 15 frames to a GoP. A
    GoP consists of one JPEG frame at the beginning, followed by a series of
    changes from that frame (and those tend to have bidirectional change
    frames saved between them). To modify one frame typically requires
    regenerating the entire GoP.

    AVCHD is even more compressed than HDV MPEG -- and a 13GB (1-hour)
    HDV capture can easily expand to an 80GB "less-compressed" intermediate
    file for editing on slower computers.

    I suspect NLE software scans the video file during loading to build
    an index of, at the least, where each video chunk begins and what frame
    it starts on. With more memory, it may be possible to index by GoP.
    (Sony Vegas appears to handle the audio by building a separate proxy
    file of just the audio)
    --
    Wulfraed Dennis Lee Bieber AF6VN
    HTTP://wlfraed.home.netcom.com/
    Dennis Lee Bieber, Sep 25, 2012
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin
    Replies:
    19
    Views:
    1,117
    Tris Orendorff
    Feb 13, 2006
  2. Replies:
    3
    Views:
    445
    Travis Newbury
    Feb 8, 2006
  3. wallge
    Replies:
    8
    Views:
    671
    wallge
    Jan 12, 2007
  4. globalrev
    Replies:
    4
    Views:
    742
    Gabriel Genellina
    Apr 20, 2008
  5. VK
    Replies:
    15
    Views:
    1,117
    Dr J R Stockton
    May 2, 2010
Loading...

Share This Page