Repository navigation
[cli] Add --stdin to read the input video from a pipe - #598
Open
EnesSoydan wants to merge 1 commit into
Open
EnesSoydan wants to merge 1 commit into
EnesSoydan wants to merge 1 commit into
Conversation
Owner
|
Also FYI I'm trying to get v0.7.3. out right now so I'd like to hold this until after the release just to avoid bringing in any last minute changes. Feel free to continue working on this in the meantime though, I'll make sure we get this landed in the version that we ship just after v0.7.3. Can you also post a quick comment in each of the linked bugs in the PR description so I can assign those issues to you (so folks know it's taken)? Just something like "I'd like to take this on, staged #598 for this" is sufficient. Thanks. |
This was referenced Nov 8, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #434
Closes #189
Adds a
--stdinflag, so a video can be piped in:This went through the task list in #189:
VideoStreamAv, since PyAV already takes a file-like object.--stdinwith another backend is an error, and so is combining it with-i.split-video,save-images,load-scenes, andtime -s.save-htmlleaves out images.save-fcpandsave-otioare rejected as well, because they write a reference to a source file that doesn't exist here.$VIDEO_NAME: it is set tostdin, so output files get names likestdin-Scenes.csv.I left
split-videofrom a stream out of this PR.Two things I ran into while testing:
sys.stdin.buffer.seekable()returnsTruefor a pipe, and PyAV then fails withOSError: [Errno 22]when it tries to seek._PipeReaderis a small wrapper that reports the stream as non-seekable.__main__.pyletsSystemExitthrough so this isn't logged as an unhandled exception. The existing OpenCV "no frames" path still exits with 0; I didn't change that here.The new tests in
tests/test_cli.pywrite to the CLI through a real pipe. They include a check that the scenes match the same video opened with-i.I edited
docs/cli.rstby hand instead of committing the output ofgenerate_cli_docs.py, because the generator also changed some unrelated lines.Tested on Windows with Python 3.10 and PyAV 17. I haven't run it on Linux or macOS, or with a real
ffmpegpipe, sinceffmpegisn't installed on my machine. The tests pipe the file's bytes directly.