New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 596182 link

Starred by 3 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Feature



Sign in to add a comment

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)

 
Cc: cpaulin@chromium.org

Comment 2 by mcasas@chromium.org, 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
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

Comment 4 by mcasas@chromium.org, Mar 25 2016

Cc: niklase@chromium.org mcasas@chromium.org henrika@chromium.org
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

Comment 5 by mcasas@chromium.org, Mar 25 2016

Status: Unconfirmed (was: Available)

Comment 6 by mcasas@chromium.org, Mar 25 2016

Components: Blink>GetUserMedia>Mic
henrika@/niklase@ ping: #4
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.
Status: Available (was: Unconfirmed)
Cc: -henrika@chromium.org m...@chromium.org
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
Summary: MediaRecorder: stereo audio recording not working as expected (was: MediaRecorder: Enable stereo recording on videos)
Cc: tommi@chromium.org dalecur...@chromium.org
dalecurtis@/tommi@ does #10 coincide with your understanding?

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.
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.
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.
Components: -Blink>MediaStreamRecording Blink>MediaStream>Recording
Renamed component Blink>MediaStreamRecording to Blink>MediaStream>Recording. Moving issues to the new component. 
Cc: aluebs@chromium.org hlundin@chromium.org tlegrand@chromium.org
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.
Status: WontFix (was: Available)
Closing this issue per #10 and #17.
Components: Blink>MediaRecording
Components: -Blink>MediaStream>Recording

Sign in to add a comment