Skip to content
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

PyAV decoding backend no longer works #563

Closed
datumbox opened this issue Jul 4, 2022 · 3 comments
Closed

PyAV decoding backend no longer works #563

datumbox opened this issue Jul 4, 2022 · 3 comments

Comments

@datumbox
Copy link

datumbox commented Jul 4, 2022

The PyAV video decoding backend no longer works. I believe this can be tracked back to commit 99a655b. Though the implementation of the torchvision_decode backend was updated to receive lists for some arguments and return more parameters, the one at pyav_decode wasn't, leading to a runtime error.

A quick and dirty workaround is to apply the following patch, though this causes the entire video to be read hence it's slow:

diff --git a/slowfast/datasets/decoder.py b/slowfast/datasets/decoder.py
index 7ebf713..231c76b 100644
--- a/slowfast/datasets/decoder.py
+++ b/slowfast/datasets/decoder.py
@@ -414,6 +414,7 @@ def pyav_decode(
     fps = float(container.streams.video[0].average_rate)
     frames_length = container.streams.video[0].frames
     duration = container.streams.video[0].duration
+    start_end_delta_time = duration = None
 
     if duration is None:
         # If failed to fetch the decoding information, decode the entire video.
@@ -450,7 +451,7 @@ def pyav_decode(
 
         frames = [frame.to_rgb().to_ndarray() for frame in video_frames]
         frames = torch.as_tensor(np.stack(frames))
-    return frames, fps, decode_all_video
+    return [frames], fps, decode_all_video, start_end_delta_time
 
 
 def decode(
@@ -513,7 +514,7 @@ def decode(
             assert (
                 min_delta == -math.inf and max_delta == math.inf
             ), "delta sampling not supported in pyav"
-            frames_decoded, fps, decode_all_video = pyav_decode(
+            frames_decoded, fps, decode_all_video, start_end_delta_time = pyav_decode(
                 container,
                 sampling_rate,
                 num_frames,
@lyttonhao
Copy link
Contributor

Thanks for summarizing the issue and sharing workaround. We have ongoing PR to solve this PyAV issue here

@datumbox
Copy link
Author

datumbox commented Jul 6, 2022

@lyttonhao oh sorry. Sounds like this issue is duplicate. Feel free to close if you track it elsewhere!

@lyttonhao
Copy link
Contributor

Close it as it's tracked in #541

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants