muaz-khan / Ffmpeg.js

Ffmpeg.js demos, both for browsers and node.js
https://www.webrtc-experiment.com/ffmpeg/
MIT License
487 stars 143 forks source link

Rewrap WebM/H.264 to MP4/H.264 #23

Open krean93 opened 4 years ago

krean93 commented 4 years ago

Is it possible to increase performance by recording in H.264 codec, then simply rewrapping with ffmpeg.js?

I'm experimenting with the following setup:

  1. Recording: video/webm;codecs=h264 recordVideo = RecordRTC(stream, { type: "video", mimeType: "video/webm;codecs=h264", });
  2. Copying codec, bypassing the transcoding overhead: -c:v copy worker.postMessage({ type: "command", arguments: "-i video.webm -c:v copy output.mp4".split(" "), files: [ { data: new Uint8Array(aab), name: "video.webm", }, ], });

Result: In theory it should work, but I'm getting a black screen s a result. I'm using the demo source (https://github.com/muaz-khan/Ffmpeg.js/blob/master/webm-to-mp4.html) with the above modifications.

patrickmatte commented 7 months ago

-i video.webm -c:v copy output.mp4 worked for me but I had to use the ffmpeg-all-codecs.js taken from http://bgrins.github.io/videoconverter.js/