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

torchaudio.info returns incorrect result for num_frames when input is a video #3731

Open
lematt1991 opened this issue Jan 16, 2024 · 1 comment

Comments

@lematt1991
Copy link

🐛 Describe the bug

If the input is a video, torchaudio.info(<path>).num_frames returns the incorrect result. For example:

import torchaudio
from subprocess import check_call

url = "https://download.pytorch.org/torchaudio/tutorial-assets/stream-api/NASAs_Most_Scientifically_Complex_Space_Observatory_Requires_Precision-MP4_small.mp4"
check_call(["wget", url, "-O", "sample_video.mp4"])

path = "sample_video.mp4"

wav, sr = torchaudio.load(path)
print(wav.shape)
print(torchaudio.info(path).num_frames)

Prints torch.Size([2, 9889792]) for wav.shape, but prints 9659 for torchaudio.info(path).num_frames. I'm guessing it's returning the number of video frames instead?

Versions

Collecting environment information...
PyTorch version: 2.1.0
Is debug build: False
CUDA used to build PyTorch: 11.8
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.6 LTS (x86_64)
GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Clang version: Could not collect
CMake version: version 3.27.7
Libc version: glibc-2.31

Python version: 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:40:32) [GCC 12.3.0] (64-bit runtime)
Python platform: Linux-5.15.0-1048-aws-x86_64-with-glibc2.31
Is CUDA available: False
CUDA runtime version: 11.8.89
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                       x86_64
CPU op-mode(s):                     32-bit, 64-bit
Byte Order:                         Little Endian
Address sizes:                      46 bits physical, 48 bits virtual
CPU(s):                             96
On-line CPU(s) list:                0-95
Thread(s) per core:                 2
Core(s) per socket:                 24
Socket(s):                          2
NUMA node(s):                       2
Vendor ID:                          GenuineIntel
CPU family:                         6
Model:                              85
Model name:                         Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
Stepping:                           7
CPU MHz:                            2499.998
BogoMIPS:                           4999.99
Hypervisor vendor:                  KVM
Virtualization type:                full
L1d cache:                          1.5 MiB
L1i cache:                          1.5 MiB
L2 cache:                           48 MiB
L3 cache:                           71.5 MiB
NUMA node0 CPU(s):                  0-23,48-71
NUMA node1 CPU(s):                  24-47,72-95
Vulnerability Gather data sampling: Unknown: Dependent on hypervisor status
Vulnerability Itlb multihit:        KVM: Mitigation: VMX unsupported
Vulnerability L1tf:                 Mitigation; PTE Inversion
Vulnerability Mds:                  Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
Vulnerability Meltdown:             Mitigation; PTI
Vulnerability Mmio stale data:      Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
Vulnerability Retbleed:             Vulnerable
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass:    Vulnerable
Vulnerability Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:           Mitigation; Retpolines, STIBP disabled, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds:                Not affected
Vulnerability Tsx async abort:      Not affected
Flags:                              fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves ida arat pku ospke

Versions of relevant libraries:
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.23.5
[pip3] perceiver-pytorch==0.8.8
[pip3] pytorch-lightning==2.1.2
[pip3] torch==2.1.0
[pip3] torch-fidelity==0.3.0
[pip3] torchaudio==2.1.0
[pip3] torchdiffeq==0.2.3
[pip3] torchlibrosa==0.1.0
[pip3] torchmetrics==1.2.0
[pip3] torchvision==0.16.0
[pip3] triton==2.1.0
[conda] blas                      2.116                       mkl  
[conda] blas-devel                3.9.0            16_linux64_mkl  
[conda] libblas                   3.9.0            16_linux64_mkl  
[conda] libcblas                  3.9.0            16_linux64_mkl  
[conda] liblapack                 3.9.0            16_linux64_mkl  
[conda] liblapacke                3.9.0            16_linux64_mkl  
[conda] mkl                       2022.1.0           h84fe81f_915  
[conda] mkl-devel                 2022.1.0           ha770c72_916  
[conda] mkl-include               2022.1.0           h84fe81f_915  
[conda] numpy                     1.23.5                   pypi_0    pypi
[conda] perceiver-pytorch         0.8.8                    pypi_0    pypi
[conda] pytorch                   2.1.0           aws_py3.10_cuda11.8_cudnn8.7.0_0  
[conda] pytorch-cuda              11.8                 h7e8668a_3  
[conda] pytorch-lightning         2.1.2                    pypi_0    pypi
[conda] pytorch-mutex             1.0                        cuda  
[conda] torch-fidelity            0.3.0                    pypi_0    pypi
[conda] torchaudio                2.1.0               py310_cu118  
[conda] torchdiffeq               0.2.3                    pypi_0    pypi
[conda] torchlibrosa              0.1.0                    pypi_0    pypi
[conda] torchmetrics              1.2.0                    pypi_0    pypi
[conda] torchtriton               2.1.0                     py310  
[conda] torchvision               0.16.0              py310_cu118 
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

No branches or pull requests

2 participants