Skip to content

Commit eee964b

Browse files
committed
Enable bufsize control on readers
1 parent 50966ef commit eee964b

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

src/ffmpegio/streams/SimpleStreams.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def __init__(
2121
show_log=None,
2222
progress=None,
2323
blocksize=None,
24+
bufsize=-1,
2425
**options,
2526
) -> None:
2627

@@ -53,7 +54,11 @@ def __init__(
5354

5455
# start FFmpeg
5556
self._proc = ffmpegprocess.Popen(
56-
ffmpeg_args, stdin=stdin, progress=progress, capture_log=True
57+
ffmpeg_args,
58+
stdin=stdin,
59+
progress=progress,
60+
capture_log=True,
61+
bufsize=bufsize,
5762
)
5863

5964
# set the log source and start the logger
@@ -215,8 +220,9 @@ def _finalize(self, ffmpeg_args):
215220
has_fg = configure.has_filtergraph(ffmpeg_args, "video")
216221

217222
pix_fmt = outopts.get("pix_fmt", None)
218-
if pix_fmt is None or (
219-
not has_fg
223+
if (
224+
pix_fmt is None
225+
and not has_fg
220226
and inurl not in ("-", "pipe:", "pipe:0")
221227
and not inopts.get("pix_fmt", None)
222228
):
@@ -228,6 +234,9 @@ def _finalize(self, ffmpeg_args):
228234
else:
229235
pix_fmt_in = s_in = r_in = None
230236

237+
if pix_fmt_in is None and pix_fmt is None:
238+
raise ValueError("pix_fmt must be specified.")
239+
231240
(
232241
self.dtype,
233242
self.shape,

0 commit comments

Comments
 (0)