-
Notifications
You must be signed in to change notification settings - Fork 2.7k
FEATURE: Versatile Video
class
#1924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
process_video
Hi @Ashp116 👋🏻 Another great idea! Video processing is probably the oldest part of |
Hi @SkalskiP, yea, I would like to help update the API. I was thinking of changing how videos are written in |
Hi @Ashp116 I'm really glad you want to help me! Let's goooo! 🔥 🔥 🔥 I want the functionalities currently found in
|
UPDATE: Added a new Video class with OpenCV writer and backend
…supervision into bug/process-video-audio
Hi @SkalskiP, I’ve addressed most of the features you mentioned, but I have some thoughts on a few aspects of the implementation:
|
process_video
Video
class
@@ -46,7 +46,8 @@ dependencies = [ | |||
"pillow>=9.4", | |||
"requests>=2.26.0", | |||
"tqdm>=4.62.3", | |||
"opencv-python>=4.5.5.64" | |||
"opencv-python>=4.5.5.64", | |||
"imageio-ffmpeg (>=0.6.0,<0.7.0)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not use imageio-ffmpeg
and use PyAV
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When adding PyAV
as dependency, make sure to make it optional. We don't want to require everyone to install it.
@@ -141,6 +673,7 @@ def _validate_and_setup_video( | |||
return video, start, end | |||
|
|||
|
|||
@DeprecationWarning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use deprecated
from supervision.utils.internal
. it is currently used in the codebase to mark several deprecations.
@@ -192,6 +725,7 @@ def get_video_frames_generator( | |||
video.release() | |||
|
|||
|
|||
@DeprecationWarning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use deprecated
from supervision.utils.internal
. it is currently used in the codebase to mark several deprecations.
@@ -117,6 +648,7 @@ def __exit__(self, exc_type, exc_value, exc_traceback): | |||
self.__writer.release() | |||
|
|||
|
|||
@DeprecationWarning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to mark private classes / functions as deprecated. We do it only for classes / functions in public supervision API.
) | ||
|
||
|
||
@DeprecationWarning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use deprecated
from supervision.utils.internal
. it is currently used in the codebase to mark several deprecations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Internals of this deprecated class should be now reimplemented using new Video
API.
@@ -141,6 +673,7 @@ def _validate_and_setup_video( | |||
return video, start, end | |||
|
|||
|
|||
@DeprecationWarning | |||
def get_video_frames_generator( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Internals of this deprecated function should be now reimplemented using new Video
API.
Description
This PR allows the
process_video
function to include the audio stream from the source video in the final annotated output. Previously, the function only rendered video frames and discarded the audio, resulting in silent output videos. This change ensures that the output video maintains both visual and audio components, addressing issue #1923.This PR requires the
imageio-ffmpeg
dependency, which enables audio stream handling during video writing. You can find it here: imageio-ffmpeg on PyPIType of change
How has this change been tested, please provide a testcase or example of how you tested the change?
Please refer to #1923
Any specific deployment considerations
Ensure that
imageio-ffmpeg
is installed in the environment.Docs