Repository navigation
Fix mono audio levels, early clipping, and noisy mono mic recordings - #1132
Merged
Merged
Conversation
Mono sources mapped to stereo were 3 dB quieter than in other players, because FFmpeg's default mono to stereo mix lowers each side by 3 dB. FrameMapper and FFmpegWriter now copy mono to both sides at full level. FrameMapper and the first FFmpegWriter resample also converted audio to 16-bit integers, which clipped loud sources (above 0 dBFS) before clip volume and mixing were applied. Audio now stays float until the encoder needs a different sample format.
The EffectMask tests used Tracker and ObjectDetection classes, which are only built with OpenCV, so builds without OpenCV failed to compile the tests. Guard those includes, helpers and test cases with USE_OPENCV.
Mono recordings asked the audio device for a single channel. Some Windows drivers convert badly when asked for fewer channels than the device has, which a tester saw as loud noise in mono recordings while stereo worked. The recorder now opens stereo devices as stereo and keeps the first channel itself for mono recordings. Mono-only devices are still opened as mono (the audio backends clamp the request), and recording such a device in stereo now repeats its channel instead of leaving the right side silent. If a driver refuses to open as stereo, the requested channel count is used.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1132 +/- ##
===========================================
+ Coverage 73.91% 74.01% +0.10%
===========================================
Files 275 275
Lines 36995 37119 +124
===========================================
+ Hits 27344 27475 +131
+ Misses 9651 9644 -7 ☔ View full report in Codecov by Harness. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a few audio level problems that made mic recordings sound too quiet, and in some cases noisy.
FrameMapperandFFmpegWriter), matching normal media players. Mono mic recordings are the most common case.FrameMapperand the firstFFmpegWriterresample converted audio to 16-bit integers, which clipped loud sources (above 0 dBFS) before clip volume and mixing were applied. Audio now stays float until the encoder needs a different format.AudioRecordernow opens stereo devices as stereo and keeps the first channel itself. Mono-only devices still open as mono, and recording them in stereo now fills both sides instead of leaving the right side silent.EffectMasktests used OpenCV-only classes, so test builds without OpenCV failed. Those parts are now guarded withUSE_OPENCV.