Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   random access to video file (http://www.velocityreviews.com/forums/t952648-random-access-to-video-file.html)

JRV 09-25-2012 08:51 AM

random access to video file
 
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

Dennis Lee Bieber 09-25-2012 04:28 PM

Re: random access to video file
 
On Tue, 25 Sep 2012 01:51:43 -0700 (PDT), JRV
<jean.ronan.vigouroux@gmail.com> 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
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/



All times are GMT. The time now is 04:14 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.