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

[torchcodec] add get_frames_at method to SimpleVideoDecoder #80

Closed
wants to merge 1 commit into from

Conversation

scotts
Copy link
Contributor

@scotts scotts commented Jul 16, 2024

Summary:
This diff does several things:

  1. Adds new method to SimpleVideoDecoder, with the signature:
    get_frames_at(
    self,
    start: int,
    stop: int,
    step: int = 1,
    ) -> Frames
  2. Adds the Frames dataclass as a part of the public API. It has stacked versions of all return values, and is a sibling to the Frame dataclass.
  3. Updates our testing framework so that we can systematically associate pts and duration metadata with a particular test file. In this diff we are hardcoding the metadata into the testing utils. In the future, we should read it from a checked-in JSON file we generate with ffprobe.

This diff is a partial implementation of the design in: https://fburl.com/gdoc/i6eqb634

Differential Revision: D59767617

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

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

Summary:
Pull Request resolved: #80

This diff does several things:
* Adds new method to `SimpleVideoDecoder`, with the signature:
    get_frames_at(
      self,
      start: int,
      stop: int,
      step: int = 1
    ) -> FrameBatch
* Adds the `FrameBatch` dataclass as a part of the public API. It has stacked version of the data, and pts and duration seconds are in N-dimensional tensors, where N is the size of the range.  It is a sibling to the `Frame` dataclass.
* Changes the return value of the core library function `get_frames_in_range()` as well as the underlying member function `VideoDecoder::getFramesInRange()` to return `Tuple[Tensor, Tensor, Tensor]`. The first value are the stacked frames, second is each pts in the range in a tensor, and third is each duration seconds in a tensor. This matches the new return type of `get_frame_at_index()`.
* Updates our testing framework so that we can systematically associate pts and duration metadata with a particular test file. In this diff we are hardcoding the metadata into the testing utils. In the future, we should read it from a checked-in JSON file we generate with ffprobe.

This diff is a partial implementation of the design in: https://fburl.com/gdoc/i6eqb634

Reviewed By: ahmadsharif1

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

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

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 13aadea.

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 Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants