Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #30110
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Subject | Re: random access to video file |
| Date | 2012-09-25 12:28 -0400 |
| Organization | > Bestiaria Support Staff < |
| References | <743a4d43-286f-412e-9886-1cda4c8c5cb1@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1357.1348590526.27098.python-list@python.org> (permalink) |
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/
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
random access to video file JRV <jean.ronan.vigouroux@gmail.com> - 2012-09-25 01:51 -0700 Re: random access to video file Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-25 12:28 -0400
csiph-web