Currently, read() routines in these modules retrieve the data at once, and streaming access uses open() but the latter requires several lines of code to set up. Look into adding iter() routines to simplify the streaming read interface, e.g.,
video:
import ffmpegio as ff
for frame in ff.video.iter('video.mp4'):
... # work with video frame data, one at a time
audio:
for frame in ff.audio.iter('audio.mp3', frame_size=1024):
... # work with audio samples, 1024 samples at a time
media (each stream may not have data available simultaneously):
for vframe, aframe in ff.media.iter('video.mp3', streams=['v:0','a:0']):
if vframe is not None:
... # work with video frame
if aframe is not None:
... # work with audio samples roughly associated with one video frame
Currently,
read()routines in these modules retrieve the data at once, and streaming access usesopen()but the latter requires several lines of code to set up. Look into addingiter()routines to simplify the streaming read interface, e.g.,video:
audio:
media (each stream may not have data available simultaneously):