Skip to content

[torchcodec] Return subsequent frame if FFMPEG seeks past end of the frame #178

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 1 commit into from
Aug 14, 2024

Conversation

ahmadsharif1
Copy link
Contributor

Summary:
The way get_frame_displayed_at works is as follows:

We call avformat_seek_file with:

min_ts=-inf ts=timestamp max_ts=timestamp

https://ffmpeg.org/doxygen/7.0/group__lavf__decoding.html#ga3b40fc8d2fda6992ae6ea2567d71ba30

This should in theory never seek past our timestamp.

However for some videos ffmpeg does seek past our timestamp.

And that causes us to never return a valid frame in that case.

The fix is to warn the user and return the first frame after the timestamp if this ever happens.

Differential Revision: D61139386

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 12, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D61139386

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D61139386

ahmadsharif1 added a commit to ahmadsharif1/torchcodec that referenced this pull request Aug 12, 2024
…frame (pytorch#178)

Summary:
Pull Request resolved: pytorch#178

The way get_frame_displayed_at works is as follows:

We call avformat_seek_file with:

`min_ts=-inf ts=timestamp max_ts=timestamp`

https://ffmpeg.org/doxygen/7.0/group__lavf__decoding.html#ga3b40fc8d2fda6992ae6ea2567d71ba30

This should in theory never seek past our timestamp.

However for some videos ffmpeg does seek past our timestamp.

And that causes us to never return a valid frame in that case.

The fix is to warn the user and return the first frame after the timestamp if this ever happens.

Differential Revision: D61139386
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D61139386

ahmadsharif1 added a commit to ahmadsharif1/torchcodec that referenced this pull request Aug 12, 2024
…frame (pytorch#178)

Summary:
Pull Request resolved: pytorch#178

The way get_frame_displayed_at works is as follows:

We call avformat_seek_file with:

`min_ts=-inf ts=timestamp max_ts=timestamp`

https://ffmpeg.org/doxygen/7.0/group__lavf__decoding.html#ga3b40fc8d2fda6992ae6ea2567d71ba30

This should in theory never seek past our timestamp.

However for some videos ffmpeg does seek past our timestamp.

And that causes us to never return a valid frame in that case.

The fix is to warn the user and return the first frame after the timestamp if this ever happens.

Differential Revision: D61139386
ahmadsharif1 added a commit to ahmadsharif1/torchcodec that referenced this pull request Aug 12, 2024
…frame (pytorch#178)

Summary:
Pull Request resolved: pytorch#178

The way get_frame_displayed_at works is as follows:

We call avformat_seek_file with:

`min_ts=-inf ts=timestamp max_ts=timestamp`

https://ffmpeg.org/doxygen/7.0/group__lavf__decoding.html#ga3b40fc8d2fda6992ae6ea2567d71ba30

This should in theory never seek past our timestamp.

However for some videos ffmpeg does seek past our timestamp.

And that causes us to never return a valid frame in that case.

The fix is to warn the user and return the first frame after the timestamp if this ever happens.

Differential Revision: D61139386
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D61139386

1 similar comment
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D61139386

ahmadsharif1 added a commit to ahmadsharif1/torchcodec that referenced this pull request Aug 12, 2024
…frame (pytorch#178)

Summary:
Pull Request resolved: pytorch#178

The way get_frame_displayed_at works is as follows:

We call avformat_seek_file with:

`min_ts=-inf ts=timestamp max_ts=timestamp`

https://ffmpeg.org/doxygen/7.0/group__lavf__decoding.html#ga3b40fc8d2fda6992ae6ea2567d71ba30

This should in theory never seek past our timestamp.

However for some videos ffmpeg does seek past our timestamp.

And that causes us to never return a valid frame in that case.

The fix is to warn the user and return the first frame after the timestamp if this ever happens.

Differential Revision: D61139386
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D61139386

ahmadsharif1 added a commit to ahmadsharif1/torchcodec that referenced this pull request Aug 12, 2024
…frame (pytorch#178)

Summary:
Pull Request resolved: pytorch#178

The way get_frame_displayed_at works is as follows:

We call avformat_seek_file with:

`min_ts=-inf ts=timestamp max_ts=timestamp`

https://ffmpeg.org/doxygen/7.0/group__lavf__decoding.html#ga3b40fc8d2fda6992ae6ea2567d71ba30

This should in theory never seek past our timestamp.

However for some videos ffmpeg does seek past our timestamp.

And that causes us to never return a valid frame in that case.

The fix is to warn the user and return the first frame after the timestamp if this ever happens.

Differential Revision: D61139386
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D61139386

ahmadsharif1 added a commit to ahmadsharif1/torchcodec that referenced this pull request Aug 12, 2024
…frame (pytorch#178)

Summary:
Pull Request resolved: pytorch#178

The way get_frame_displayed_at works is as follows:

We call avformat_seek_file with:

`min_ts=-inf ts=timestamp max_ts=timestamp`

https://ffmpeg.org/doxygen/7.0/group__lavf__decoding.html#ga3b40fc8d2fda6992ae6ea2567d71ba30

This should in theory never seek past our timestamp.

However for some videos ffmpeg does seek past our timestamp.

And that causes us to never return a valid frame in that case.

The fix is to warn the user and return the first frame after the timestamp if this ever happens.

Differential Revision: D61139386
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D61139386

ahmadsharif1 added a commit to ahmadsharif1/torchcodec that referenced this pull request Aug 13, 2024
…frame (pytorch#178)

Summary:
Pull Request resolved: pytorch#178

The way get_frame_displayed_at works is as follows:

We call avformat_seek_file with:

`min_ts=-inf ts=timestamp max_ts=timestamp`

https://ffmpeg.org/doxygen/7.0/group__lavf__decoding.html#ga3b40fc8d2fda6992ae6ea2567d71ba30

This should in theory never seek past our timestamp.

However for some videos ffmpeg does seek past our timestamp.

And that causes us to never return a valid frame in that case.

The fix is to warn the user and return the first frame after the timestamp if this ever happens.

Differential Revision: D61139386
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D61139386

ahmadsharif1 added a commit to ahmadsharif1/torchcodec that referenced this pull request Aug 13, 2024
…frame (pytorch#178)

Summary:
Pull Request resolved: pytorch#178

The way get_frame_displayed_at works is as follows:

We call avformat_seek_file with:

`min_ts=-inf ts=timestamp max_ts=timestamp`

https://ffmpeg.org/doxygen/7.0/group__lavf__decoding.html#ga3b40fc8d2fda6992ae6ea2567d71ba30

This should in theory never seek past our timestamp.

However for some videos ffmpeg does seek past our timestamp.

And that causes us to never return a valid frame in that case.

The fix is to warn the user and return the first frame after the timestamp if this ever happens.

Differential Revision: D61139386
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D61139386

ahmadsharif1 added a commit to ahmadsharif1/torchcodec that referenced this pull request Aug 13, 2024
…frame (pytorch#178)

Summary:
Pull Request resolved: pytorch#178

The way get_frame_displayed_at works is as follows:

We call avformat_seek_file with:

`min_ts=-inf ts=timestamp max_ts=timestamp`

https://ffmpeg.org/doxygen/7.0/group__lavf__decoding.html#ga3b40fc8d2fda6992ae6ea2567d71ba30

This should in theory never seek past our timestamp.

However for some videos ffmpeg does seek past our timestamp.

And that causes us to never return a valid frame in that case.

The fix is to warn the user and return the first frame after the timestamp if this ever happens.

Reviewed By: NicolasHug

Differential Revision: D61139386
ahmadsharif1 added a commit to ahmadsharif1/torchcodec that referenced this pull request Aug 13, 2024
…frame (pytorch#178)

Summary:
Pull Request resolved: pytorch#178

The way get_frame_displayed_at works is as follows:

We call avformat_seek_file with:

`min_ts=-inf ts=timestamp max_ts=timestamp`

https://ffmpeg.org/doxygen/7.0/group__lavf__decoding.html#ga3b40fc8d2fda6992ae6ea2567d71ba30

This should in theory never seek past our timestamp.

However for some videos ffmpeg does seek past our timestamp.

And that causes us to never return a valid frame in that case.

The fix is to warn the user and return the first frame after the timestamp if this ever happens.

Reviewed By: NicolasHug

Differential Revision: D61139386
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D61139386

1 similar comment
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D61139386

ahmadsharif1 added a commit to ahmadsharif1/torchcodec that referenced this pull request Aug 13, 2024
…frame (pytorch#178)

Summary:
Pull Request resolved: pytorch#178

The way get_frame_displayed_at works is as follows:

We call avformat_seek_file with:

`min_ts=-inf ts=timestamp max_ts=timestamp`

https://ffmpeg.org/doxygen/7.0/group__lavf__decoding.html#ga3b40fc8d2fda6992ae6ea2567d71ba30

This should in theory never seek past our timestamp.

However for some videos ffmpeg does seek past our timestamp.

And that causes us to never return a valid frame in that case.

The fix is to warn the user and return the first frame after the timestamp if this ever happens.

Reviewed By: NicolasHug

Differential Revision: D61139386
…frame (pytorch#178)

Summary:
Pull Request resolved: pytorch#178

The way get_frame_displayed_at works is as follows:

We call avformat_seek_file with:

`min_ts=-inf ts=timestamp max_ts=timestamp`

https://ffmpeg.org/doxygen/7.0/group__lavf__decoding.html#ga3b40fc8d2fda6992ae6ea2567d71ba30

This should in theory never seek past our timestamp.

However for some videos ffmpeg does seek past our timestamp.

And that causes us to never return a valid frame in that case.

The fix is to warn the user and return the first frame after the timestamp if this ever happens.

Reviewed By: NicolasHug

Differential Revision: D61139386
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D61139386

@facebook-github-bot facebook-github-bot merged commit 9fb4035 into pytorch:main Aug 14, 2024
11 of 12 checks passed
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. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants