beetbox / beetbox/mediafile

test/test_mediafile.py::OpusTest::test_read_audio_properties fails with mutagen 1.48.1

Open Beginner friendly
#109 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
120
Forks
41
PR merge metrics
No merged PRs in 30d

Description

On the [builds for the openSUSE Tumbleweed package](https://build.opensuse.org/package/show/openSUSE:Factory/python-mediafile) we have started to get an error on this test with the following message:
```
[ 16s] =================================== FAILURES ===================================
[ 16s] _____________________ OpusTest.test_read_audio_properties ______________________
[ 16s]
[ 16s] self =
[ 16s]
[ 16s] def test_read_audio_properties(self):
[ 16s] mediafile = self._mediafile_fixture("full")
[ 16s] for key, value in self.audio_properties.items():
[ 16s] if isinstance(value, float):
[ 16s] self.assertAlmostEqual(getattr(mediafile, key), value, delta=0.1)
[ 16s] else:
[ 16s] > self.assertEqual(getattr(mediafile, key), value)
[ 16s] E AssertionError: 52392 != 66792
[ 16s]
[ 16s] test/test_mediafile.py:455: AssertionError
[ 16s] =========================== short test summary info ============================
[ 16s] FAILED test/test_mediafile.py::OpusTest::test_read_audio_properties - AssertionError: 52392 != 66792
[ 16s] ============== 1 failed, 480 passed, 104 subtests passed in 1.30s ==============
```

On openSUSE We are using the version 1.48.1 of mutagen, which since version 1.48 provides the bitrate ( https://github.com/quodlibet/mutagen/pull/704 ) and from my reading of the [mediagen code](https://github.com/beetbox/mediafile/blob/faaf7444f1c58d6a39f0ba51dad8ea43a71fdf3a/mediafile/__init__.py#L925) it is being used instead of the one calculated by mutagen based on the file size.

I am going to modify the openSUSE package with the following patch:

```patch
Index: mediafile-0.17.0/test/test_mediafile.py
===================================================================
--- mediafile-0.17.0.orig/test/test_mediafile.py
+++ mediafile-0.17.0/test/test_mediafile.py
@@ -987,7 +987,7 @@ class OpusTest(ReadWriteTestBase, unitte
extension = "opus"
audio_properties = {
"length": 1.0,
- "bitrate": 66792,
+ "bitrate": 52392,
"bitrate_mode": "",
"encoder_info": "",
"encoder_settings": "",

```

Feel free to use it or if you think it should be fixed on mutage I can open a bug there.

Contributor guide

Open the contributing guide

Research direction

Open test/test_mediafile.py and inspect OpusTest.audio_properties, especially the expected bitrate for the full Opus fixture. Run test/test_mediafile.py::OpusTest::test_read_audio_properties with mutagen 1.48.1, then run the broader test suite. Done means the updated expectation reflects the reported bitrate and all tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
audio-video-rtc
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.