Skip to content

Close avio object *before* encode destruction. And flush, too. #773

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

NicolasHug
Copy link
Member

The Failed to open input buffer aren't resolved as they were visible in https://github.com/pytorch/torchcodec/actions/runs/16238309871/job/45851804069?pr=757.

So #724 is still a problem, and #755 wasn't a proper fix.

I hope this one is the one. It does 2 things:

  • We now call avio_close() at the end of encode(). Not just when the encoder is destructed. That makes sense.
  • We also now call avio_flush(), which was potentially needed. I'm not entirely sure, but it's probably needed. Or at least it's fairly clear that calling avio_close() isn't enough anyway, because we are seeing the error not just when relying on FFmpeg's default avio object, but also when using to_tensor(): https://github.com/pytorch/torchcodec/actions/runs/16238309871/job/45851804069?pr=757.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 12, 2025
@NicolasHug NicolasHug mentioned this pull request Jul 12, 2025
@NicolasHug
Copy link
Member Author

😭 😭 😭 😭 😭 😭 😭 😭 😭 😭 😭 😭 😭 😭 😭 😭 😭 😭 😭 😭 😭 😭 😭 😭 😭 😭 😭

https://github.com/pytorch/torchcodec/actions/runs/16241951867/job/45859651025?pr=773

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants