Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RecordRTC Audio into Ogg Chrome #58

Closed
pitrackster opened this issue Nov 6, 2015 · 8 comments
Closed

RecordRTC Audio into Ogg Chrome #58

pitrackster opened this issue Nov 6, 2015 · 8 comments

Comments

@pitrackster
Copy link

Hi !

First thanks a lot for all the work done.

When I use RecordRTC demo in Chrome (v 43.0.2357.81 - 64bits) with Audio into OGG selected, the downloaded file is in WAV format.

Is that normal ? Is it possible to record audio in OGG with Chrome ?

I tried to set the options like this :

var options = {
    mimeType : 'audio/ogg',
    bitsPerSecond: 128000
};

But this is not working...

Regards

@muaz-khan
Copy link
Owner

MediaRecorder API are implemented in Chrome DEV/CANARY, but that API currently supporting only video-recording. Audio-recording is work-in-progress.

Also, MediaRecorder API in Chrome are still behind a flag.

Here is an alternative solution for converting WAV into Ogg: https://github.com/muaz-khan/Ffmpeg.js/blob/master/wav-to-ogg.html

@pitrackster
Copy link
Author

Hi Muaz-Khan !

Thank you very much for your reply.
I've seen the ffmpeg.js librarie, but it's size (18Mb) makes it not very usefull in my context...

I'll take a look at Chrome Dev/Canary to see if they scheduled a date for AudioRecording support.

Thanks again!

@amallecourt
Copy link

Is it still not supported in Chrome today ?
I didn't manage to do it.

@muaz-khan
Copy link
Owner

Regarding CODECS:

  • Chrome supports VP9+VP8 along with opus vorbis audio (48kHz). PS: H.264 coming soon.
  • Firefox supports VP8 along with opus vorbis audio (44.1 kHz).

Regarding CONTAINER_FORMATS,

  • Chrome supports audio/webm, video/webm, video/webm;codecs=vp8 and video/webm;codecs=vp9
  • Firefox supports audio/webm, audio/ogg, video/webm, video/mp4 and video/webm;codecs=vp8

Regarding BITRATES:

  • Chrome supports opus_MIN 6kbps and opus_MAX 128kbps
  • Chrome supports VPX_MIN 100kbps and no max limit
  • Firefox supports VPX_default 2.5Mbps however audio default is adaptive dependant on the sample rate and number of audio channels

So you'll always get audio/webm in Chrome rather than audio/ogg. You can change the file-extension (mp3/ogg) or file-type (audio/mp3 or audio/ogg) however Audio_RAW_DATA headers will be using audio/webm


Nowadays both Chrome+Firefox are accepting audioBitsPerSecond, videoBitsPerSecond as well as bitsPerSecond optional values (as 2nd-parameter over MediaRecorder API).

@amallecourt
Copy link

Ok, thanks.
But now I wonder what is the best way to have a compressed (or minimum size) audio file with recordRTC in Chrome ? What do you think about it ? Because I would like to record conferences which can last more than 1 hour. After 20 minutes of recording, the wav file is already way to large and the browser can't manage it. If I record it, and then compress it, it takes too much time for a userfriendly experience. (I already affected numberOfAudioChannels to 1)

@thijstriemstra
Copy link
Contributor

You could also use libvorbis.js if you're recording audio-only.

@hexadecy
Copy link

hexadecy commented Jan 2, 2017

Tested on

Windows 10 + Chrome 55 and Firefox 50

Media Stream options

type: "audio"

As a workaround change that part in RecordRTC.js

Firefox will record in audio/ogg
Chrome will record in audio/webm

function GetRecorderType(mediaStream, config) {    
//...
    if (isMediaRecorderCompatible() && recorder !== CanvasRecorder && recorder !== GifRecorder && typeof MediaRecorder !== 'undefined' && 'requestData' in MediaRecorder.prototype) {
        if (mediaStream.getVideoTracks().length || (mediaStream.getAudioTracks().length && MediaRecorder.isTypeSupported('audio/webm'))) {
        recorder = MediaStreamRecorder;
        }
    }
//...

Pull request

How many previous version we want to support in this lib? Chrome 46, 47-48, 49.... ?
I think it's better to check for MediaRecorder type support than specific version of Chrome like version 49 in isMediaRecorderCompatible().
ref: https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/isTypeSupported

@Chauncy-Chen
Copy link

audio/webm

Do you know how to record audio/webm format in Firefox

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants