meta-pytorch / meta-pytorch/torchcodec
FFmpeg 5 on Windows errors in AudioEncoder's `avcodec_open2` when passing bad parameters
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 125
- Avg merge
- 22h 47m
- Merged PRs (30d)
- 54
Description
We're getting segfaults or Windows fatal exception: access violation errors on Windows, with FFmpeg5, on the test_bad_input() abd test_bad_input_parametrized() tests of the AudioEncoder.
These tests purposefuly pass wrong parameter values for e.g. sample_rate or bit_rate. The error happens internally within the call to avcodec_open2():
I can validate that avCodecContext_, avCodecContext_.get() and avCodec are all non-null pointers before calling this. The error really seems to be within avcodec_open2() and not later, and not in the destructor either.
I'm not sure what's going on but I can reproduce the problem on different FFmpeg 5 versions. However, all of 4, 6, and 7 work fine.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with test/test_encoders.py at test_bad_input() and test_bad_input_parametrized(), then inspect src/torchcodec/_core/Encoder.cpp around the avcodec_open2() call. Reproduce the failures with FFmpeg 5 and compare behavior with FFmpeg 4, 6, and 7; done means the bad-parameter tests no longer crash on supported Windows configurations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- audio-video-rtc
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100