Skip to content

Fixed missing audio with pyav backend #4064

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

Merged
merged 4 commits into from
Jul 25, 2021

Conversation

prabhat00155
Copy link
Contributor

Resolves #3779.

_align_audio_frames() expects start_pts and end_pts passed in pts. If we pass non-default start_pts and end_pts values, this causes the issue.
Another problem that's fixed here happens when passing start_pts and end_pts in pts. In the current implementation, this would lead to incorrectly reading the audio stream between video stream's start_pts and end_pts.
Fix:

  • Populate audio timebase and convert start_pts and end_pts from sec to pts unit before calling _align_audio_frames().
  • Rename start_pts_sec and end_pts_sec to start_pts and end_pts as this is to be used outside the try block.

Copy link
Contributor

@datumbox datumbox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR Prabhat. I left a comment in relation to the way we test the changes, let me know what you think.

Copy link
Contributor

@bjuncek bjuncek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.
Thanks @prabhat00155 for the good work.

@datumbox does my comment addresses your reservations?

@prabhat00155
Copy link
Contributor Author

Thanks @bjuncek and @datumbox!

@prabhat00155 prabhat00155 merged commit 693e0ae into pytorch:master Jul 25, 2021
@prabhat00155 prabhat00155 deleted the prabhat00155/fix_audio_pyav branch July 25, 2021 10:22
facebook-github-bot pushed a commit that referenced this pull request Jul 27, 2021
Reviewed By: fmassa

Differential Revision: D29932691

fbshipit-source-id: 1edbf407c2c8b08dd7df693da5ca3ae0d7da6d3b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing audio after calling read_video() with sec as unit
4 participants