Commit 0688863c authored by moto's avatar moto Committed by Facebook GitHub Bot
Browse files

Fix I/O test (#3568)

Summary:
Turned out FFmpeg 5 installed via conda reports video frame rate -1. FFmpeg 4 and 6 are fine. This is either a regression in FFmpeg or in the underlying decoding library.

Make the reference value adoptive.

Pull Request resolved: https://github.com/pytorch/audio/pull/3568

Reviewed By: huangruizhe

Differential Revision: D48499621

Pulled By: mthrok

fbshipit-source-id: fb64187bcf0dc57b753cb6c05f04d436238f5c51
parent a5da0a28
......@@ -259,6 +259,23 @@ class StreamReaderInterfaceTest(_MediaSourceMixin, TempDirMixin, TorchaudioTestC
s.add_video_stream(-1, filter_desc="fps=10")
s.add_video_stream(-1, filter_desc="format=rgb24")
s.add_video_stream(-1, filter_desc="scale=w=160:h=90")
# Note:
# Somehow only FFmpeg 5 reports invalid video frame rate. (24576/0)
# FFmpeg 4 and 6 work fine.
# Perhaps this is a regression in FFmpeg or it could actually originate
# from other libraries.
# It consistently fails with FFmpeg installed via conda, so we change
# the value based on FFmpeg version.
ver = torchaudio.utils.ffmpeg_utils.get_versions()["libavutil"]
print(ver)
major, minor, _ = ver
if major == 57:
video_frame_rate = -1
else:
video_frame_rate = 30000 / 1001
print(video_frame_rate)
expected = [
OutputAudioStream(
source_index=4,
......
......@@ -274,7 +274,6 @@ PYBIND11_MODULE(TORCHAUDIO_FFMPEG_EXT_NAME, m) {
"frame_rate", [](const OutputStreamInfo& o) -> double {
if (o.frame_rate.den == 0) {
TORCH_WARN(
o.frame_rate.den,
"Invalid frame rate is found: ",
o.frame_rate.num,
"/",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment