MediaRecorder: stereo audio recording not working as expected
Reported by
cpaulin@chromium.org,
Mar 18 2016
|
|||||||||||||
Issue description
Right now MediaStream recorder records an audio+video stream in mono instead of stereo. As getUserMedia supports stereo, it would be nice if we could record the videos in stereo.
Example output from ffprobe:
Input #0, matroska,webm, from 'testX.webm':
Metadata:
encoder : Chrome
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0(eng): Audio: opus, 48000 Hz, mono, fltp (default)
Stream #0:1(eng): Video: vp9 (Profile 0), yuv420p(tv), 640x480, SAR 1:1 DAR 4:3, 30 fps, 30 tbr, 1k tbn, 1k tbc (default)
,
Mar 21 2016
I think we support up to two audio channels input both at the recorder level [1] and at the WebM muxer [2]. Could you produce an html/js reproducing a stereo input that is recorded as mono? [1] https://code.google.com/p/chromium/codesearch#chromium/src/content/renderer/media/audio_track_recorder.cc&sq=package:chromium&type=cs&q=audiotrackrecorder&l=191 [2] https://code.google.com/p/chromium/codesearch#chromium/src/media/muxers/webm_muxer.cc&sq=package:chromium&type=cs&l=222&rcl=1458502138
,
Mar 21 2016
I am using linux machine with a stereo logitech webcam and the media recorder manual test page in [1] I also tried on Macbook Pro, which also sports a stereo mic with camera. I could not get a stereo recording, just mono. I also tried recording an audio only gUM stream with the same results. I know that by itself, media recorder can record a 2Ch audio as tested in [2], the problem is in the pipeline from GetUserMedia to MediaRecorder. [1] https://cdn.rawgit.com/cricdecyan/mediarecorder/master/manualtest/index.html [2] https://code.google.com/p/chromium/codesearch#chromium/src/content/test/data/media/mediarecorder_test.html&l=490
,
Mar 25 2016
In all likelihood this is caused by GetUserMedia() itself, i.e. seems like there is an inherent limitation: [1] henrika@/niklase@ do you know more about this? [1] https://bugs.chromium.org/p/chromium/issues/detail?id=453876#c9
,
Mar 25 2016
,
Mar 25 2016
,
Apr 1 2016
henrika@/niklase@ ping: #4
,
Apr 1 2016
Don't think so. I tested on my mac by playing a local MediaStream without any audio constraints - you get stereo. Same scenario with MediaStreamRecorder - not stereo.
,
Apr 1 2016
,
Apr 2 2016
It seems like the MediaStreamProcessor referenced by
WebRtcAudioCapturer sees the correct channels (and
sample rate) but is configured to produce mono
@48Ksamples/s, see my ad-hoc logs (using the MBP camera).
[2547:36103:0401/171902:VERBOSE1:webrtc_audio_capturer.cc(483)] format: 1 channel_layout: 3 channels: 2 sample_rate: 44100 bits_per_sample: 16 frames_per_buffer: 441 effects: 0 mic_positions:
[2547:36103:0401/171902:VERBOSE1:webrtc_audio_capturer.cc(484)] format: 1 channel_layout: 2 channels: 1 sample_rate: 48000 bits_per_sample: 16 frames_per_buffer: 480 effects: 0 mic_positions:
I think this in caused, in turn, by the call to
MediaStreamAudioProcessor::InitializeCaptureFifo(),
l.597-599 [1] :
media::ChannelLayout output_channel_layout = audio_processing_ ?
media::GuessChannelLayout(kAudioProcessingNumberOfChannels) :
input_format.channel_layout();
that basically states that if the MSAudioProcessor has
|audio_processing_|, then the output format of the
processor is forced to be mono, since
|kAudioProcessingNumberOfChannels| = 1.
miu@ does this coincide with your understanding?
[1] https://code.google.com/p/chromium/codesearch#chromium/src/content/renderer/media/media_stream_audio_processor.cc&sq=package:chromium&type=cs&l=597&q=MediaStreamAudioProcessor::InitializeCaptureFifo
,
Apr 2 2016
,
Apr 5 2016
dalecurtis@/tommi@ does #10 coincide with your understanding?
,
Apr 15 2016
I always thought the second mic on the MBP/Air and on the Logitech C920 were used for noise cancelling and this answer confirms that http://apple.stackexchange.com/questions/93655/what-is-the-advantage-of-dual-microphones After all the OS sees only 1 mic. One could duplicate of the same sound data and obtain *stereo*. For example the PhotoBooth app produces *stereo* sound regardless of the mic selected (duals on C920, duals internal, single headphone external) but it does that by duplicating the mono sound that comes from the mics. There's no spatiality about it and you can test by recording a moving sound source. When you play it back it sounds mono.
,
Apr 15 2016
Re #13, that is correct when it comes to MBP mics, but not for Logitech C920. Record are stereo stream from a C920 using Audacity for example and you will get true stereo input.
,
Apr 19 2016
Thanks for the heads up. I just tested and I can confirm. Recording through Audacity with C920 really does produce 2 different sound channels. I also tested the Microsoft Lifecam Cinema (mono) and the dual Macbook Air mics which when selected in Audacity it gives you the option to record to 2 channels but in reality produce 2 channels of the same sound.
,
May 24 2016
Renamed component Blink>MediaStreamRecording to Blink>MediaStream>Recording. Moving issues to the new component.
,
Jul 27 2016
The AudioProcessing module has been working exclusively in mono in Chromium since I can remember (at least 3 years ago?) and git blame can confirm. In theory it should support multiple channels, but I don't think it has been tested properly in some time. The WebRTC audio people (CCd) should know better than me.
,
Sep 6 2016
Closing this issue per #10 and #17.
,
Jan 18 2017
,
Jan 18 2017
,
Mar 28 2017
https://bugs.chromium.org/p/chromium/issues/detail?id=706013 is a follow-up. |
|||||||||||||
►
Sign in to add a comment |
|||||||||||||
Comment 1 by cpaulin@chromium.org
, Mar 18 2016