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

Chrome h264 support #97

Closed
thijstriemstra opened this issue Mar 1, 2016 · 14 comments
Closed

Chrome h264 support #97

thijstriemstra opened this issue Mar 1, 2016 · 14 comments

Comments

@thijstriemstra
Copy link
Contributor

Chrome 50 supports h264 encoding/decoding: https://groups.google.com/forum/#!topic/discuss-webrtc/8ov4YW6HLgo

@muaz-khan
Copy link
Owner

We may need to pass mimeType: 'video/mp4; codecs="mpeg4, aac"'

var recorder = RecordRTC(mediaStream, {
    type: 'video',
    mimeType: 'video/mp4; codecs="mpeg4, aac"'
});

@thijstriemstra
Copy link
Contributor Author

thijstriemstra commented Sep 28, 2016

I've tried this on Chrome/54.0.2840.41 on Ubuntu 16.04 but ffprobe keeps saying it's webm vp8 although it's available in Chrome since v52:

Input #0, matroska,webm, from '/home/thijs/Downloads/RecordRTC(3).webm':
  Metadata:
    encoder         : QTmuxingAppLibWebM-0.0.1
  Duration: N/A, start: 0.001000, bitrate: N/A
    Stream #0:0(eng): Video: vp8, yuv420p, 640x480, SAR 1:1 DAR 4:3, 30 fps, 30 tbr, 1k tbn, 1k tbc (default)
    Stream #0:1(eng): Audio: opus, 48000 Hz, mono, fltp (default)

Same with Firefox 49 on the same platform (both 'video/mp4; codecs="mpeg4, aac"' and 'video/mp4').

Recording log:

started recording video stream.
Using recorderType: MediaStreamRecorder
Passing following config over MediaRecorder API. Object {type: "video", video: Object, canvas: Object, frameInterval: 10, disableLogs: false…}
Initialized recorderType: MediaStreamRecorder for output-type: video
Stopped recording video
 finished recording:  Blob {lastModifiedDate: Wed Sep 28 2016 23:45:21 GMT+0200 (CEST), name: "1475099121959.mp4; codecs="mpeg4, aac"", size: 568617, type: "video/mp4; codecs="mpeg4, aac""}
video/mp4; codecs="mpeg4, aac" -> 569 KB

@thijstriemstra
Copy link
Contributor Author

thijstriemstra commented Sep 28, 2016

When using the mime type video/webm;codecs=H264 it correctly creates an H264 file (in a webm container) on Chrome (but this does not work on Firefox):

ffprobe output:

Input #0, matroska,webm, from 'index.mp4':
  Metadata:
    encoder         : Chrome
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0(eng): Video: h264 (Constrained Baseline), yuv420p, 640x480, SAR 1:1 DAR 4:3, 30 fps, 30 tbr, 1k tbn, 2k tbc (default)

A list of all available mime types in Chrome is listed here.

@bsinghpratap
Copy link

Hi,

So can I also pass other audio formats for webm file?

I passed this: mimeType: 'video/webm; codecs="VP9, wav"'

But it gave an error on browser end, in the console this appears multiple times:

Blob encoder did not yet finished its job.

@thijstriemstra
Copy link
Contributor Author

@bsinghpratap
Copy link

Here it is mentioned that along with video, only OPUS is the acceptable audio codec.

But for one of my project I need video in h264 and audio in wav or flac (because I need lossless data). Can I achieve this by parallely running two recorders one of audio and one of video?

Thanks.

@thijstriemstra
Copy link
Contributor Author

No idea.

@notsoluckycharm
Copy link

@thijstriemstra
Were you ever able to fix/generate Duration: N/A, start: 0.000000, bitrate: N/A from RecordRTC? I'm stuck on trying to generate this data without uploading it to the server to run ffmpeg, otherwise this solution is essentially a waste. Because this data is missing it is impossible to scrub the video or determine the length without downloading the entirety of a video file and playing it through,

@muaz-khan
Copy link
Owner

@bhanu-mnit You can initiate many parallel recorders:

var h264Recorder = RecordRTC(videoOnlyStream, {
    type: 'video',
    mimeType: 'video/webm\;codecs=h264'
});

var wavRecorder = RecordRTC(stream, {
    type: 'audio',
    recorderType: StereoAudioRecorder
});

Or use ffmpeg.js to convert into AAC.

@hoangbienit
Copy link

hoangbienit commented Apr 23, 2017

Dear Muaz Khan & all,
I can't pass record video H264 with the codes mediaRecorder.mimeType: 'video/mp4; codecs="mpeg4, aac"'; or mediaRecorder.mimeType: 'video/webm;codecs=h264';:
`if (recorderType === 'WebP encoding into WebM') {
mediaRecorder.recorderType = WhammyRecorder;
}

if(recorderType === 'mp4'){
    mediaRecorder.mimeType = 'video/mp4';
}

//mediaRecorder.mimeType: 'video/mp4; codecs="mpeg4, aac"';
mediaRecorder.mimeType: 'video/webm\;codecs=h264';`

The error is "Uncaught SyntaxError: Unexpected token :" at the line code: mediaRecorder.mimeType: 'video/webm;codecs=h264';

Please help me, What wrong in may code? How to fix it?
Thank you so much,

@mssodhi
Copy link

mssodhi commented Sep 10, 2018

@hoangbienit change to mediaRecorder.mimeType = 'video/webm\;codecs=h264';

@thijstriemstra
Copy link
Contributor Author

New demo for supported types on https://www.webrtc-experiment.com/RecordRTC/simple-demos/isTypeSupported.html

@guest271314
Copy link

Technically WebM container should contain only VP8, VP9, Vorbis, and Opus codecs. See https://bugzilla.mozilla.org/show_bug.cgi?id=1562862, https://bugs.chromium.org/p/chromium/issues/detail?id=980822

./mkvmerge -o full.webm 0.webm + 1.mp4
mkvmerge v35.0.0 ('All The Love In The World') 32-bit
Automatically enabling WebM compliance mode due to destination file name extension.
'0.webm': Using the demultiplexer for the format 'Matroska'.
'1.mp4': Using the demultiplexer for the format 'QuickTime/MP4'.
'0.webm' track 0: Using the output module for the format 'VP8/VP9'.
'1.webm' track 1: Using the output module for the format 'Opus'.
Error: The codec type 'AVC/h.264' cannot be used in a WebM compliant file.

@gautamgireesh
Copy link

Hi,

So can I also pass other audio formats for webm file?

I passed this: mimeType: 'video/webm; codecs="VP9, wav"'

But it gave an error on browser end, in the console this appears multiple times:

Blob encoder did not yet finished its job.

Getting the same error, have you managed to fix this?

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

8 participants