random access to video file

J

JRV

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
 
D

Dennis Lee Bieber

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)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top