Skip to content

test(video): add test cases for variable framerate videos #669

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 1 commit into
base: main
Choose a base branch
from

Conversation

XueSongTap
Copy link

Add comprehensive unit tests for variable framerate video decoding functionality:

  • Test basic decoding of variable framerate content
  • Verify exact seeking mode works correctly with variable frame rates
  • Compare exact vs approximate seeking behavior
  • Validate frame timing patterns match expected variable rate
  • Test sequential decoding with monotonically increasing timestamps
  • Ensure batch frame retrieval works with variable durations

These tests ensure the decoder properly handles videos where the frame rate
changes throughout the content, particularly during seek operations.

Related to #653

selt test:

(torchcodec-env) yxc@yxc-MS-7B89:~/code/2504/torchcodec_dev$ pytest test/test_variable_fps_video.py -v
=============================================== test session starts ===============================================
platform linux -- Python 3.10.17, pytest-8.3.5, pluggy-1.5.0 -- /home/yxc/.local/share/mamba/envs/torchcodec-env/bin/python3.10
cachedir: .pytest_cache
rootdir: /home/yxc/code/2504/torchcodec_dev
configfile: pyproject.toml
collected 12 items

test/test_variable_fps_video.py::TestVariableFPSVideoDecoder::test_basic_decoding[cpu] PASSED               [  8%]
test/test_variable_fps_video.py::TestVariableFPSVideoDecoder::test_basic_decoding[cuda] SKIPPED (CUDA n...) [ 16%]
test/test_variable_fps_video.py::TestVariableFPSVideoDecoder::test_exact_seeking_mode[cpu] PASSED           [ 25%]
test/test_variable_fps_video.py::TestVariableFPSVideoDecoder::test_exact_seeking_mode[cuda] SKIPPED (CU...) [ 33%]
test/test_variable_fps_video.py::TestVariableFPSVideoDecoder::test_approximate_seeking_mode_behavior[cpu] PASSED [ 41%]
test/test_variable_fps_video.py::TestVariableFPSVideoDecoder::test_approximate_seeking_mode_behavior[cuda] SKIPPED [ 50%]
test/test_variable_fps_video.py::TestVariableFPSVideoDecoder::test_frame_timing_pattern[cpu] PASSED         [ 58%]
test/test_variable_fps_video.py::TestVariableFPSVideoDecoder::test_frame_timing_pattern[cuda] SKIPPED (...) [ 66%]
test/test_variable_fps_video.py::TestVariableFPSVideoDecoder::test_sequential_decoding[cpu] PASSED          [ 75%]
test/test_variable_fps_video.py::TestVariableFPSVideoDecoder::test_sequential_decoding[cuda] SKIPPED (C...) [ 83%]
test/test_variable_fps_video.py::TestVariableFPSVideoDecoder::test_frames_in_range[cpu] PASSED              [ 91%]
test/test_variable_fps_video.py::TestVariableFPSVideoDecoder::test_frames_in_range[cuda] SKIPPED (CUDA ...) [100%]

================================================ warnings summary =================================================
test/utils.py:99
  /home/yxc/code/2504/torchcodec_dev/test/utils.py:99: PytestCollectionWarning: cannot collect test class 'TestVideoStreamInfo' because it has a __init__ constructor (from: test/test_variable_fps_video.py)
    @dataclass

test/utils.py:93
  /home/yxc/code/2504/torchcodec_dev/test/utils.py:93: PytestCollectionWarning: cannot collect test class 'TestFrameInfo' because it has a __init__ constructor (from: test/test_variable_fps_video.py)
    @dataclass

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
==================================== 6 passed, 6 skipped, 2 warnings in 0.77s =====================================

due to lack of cuda device, cuda device test may need help

Signed-off-by: yexiaochuan <tap91624@gmail.com>
@facebook-github-bot
Copy link
Contributor

Hi @XueSongTap!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

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

Successfully merging this pull request may close these issues.

2 participants