Skip to content

Tests: fix tests if running with self-built ffmpeg #812

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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions test/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
create_from_file,
get_container_metadata,
get_container_metadata_from_header,
get_ffmpeg_library_versions,
VideoStreamMetadata,
)
from torchcodec.decoders import AudioDecoder, VideoDecoder
Expand Down Expand Up @@ -78,9 +77,7 @@ def test_get_metadata(metadata_getter):
with pytest.raises(NotImplementedError, match="Decide on logic"):
metadata.bit_rate

ffmpeg_major_version = int(
get_ffmpeg_library_versions()["ffmpeg_version"].split(".")[0]
)
ffmpeg_major_version = get_ffmpeg_major_version()
if ffmpeg_major_version <= 5:
expected_duration_seconds_from_header = 16.57
expected_bit_rate_from_header = 324915
Expand Down
5 changes: 4 additions & 1 deletion test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ def cpu_and_cuda():


def get_ffmpeg_major_version():
return int(get_ffmpeg_library_versions()["ffmpeg_version"].split(".")[0])
ffmpeg_version = get_ffmpeg_library_versions()["ffmpeg_version"]
if ffmpeg_version.startswith("n"):
ffmpeg_version = ffmpeg_version.removeprefix("n")
return int(ffmpeg_version.split(".")[0])


# For use with decoded data frames. On CPU Linux, we expect exact, bit-for-bit
Expand Down