-
Notifications
You must be signed in to change notification settings - Fork 31
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
Example showing WebM to MP4 transmuxing #55
Comments
I wish people would stop justifying their use of Misanthropic Patent Extortion Gang garbage to me. I get it. I live in the same world as you do. I just feel that it's important to point out that they're evil and terrible and to avoid their evil and terrible shit when possible. libav.js supports the CLI, and the files used by the CLI can be devices, just like the files used from the rest of the API. So, why not build the input and output device files, then Alternatively, to do it by hand, you'd do exactly what you're doing, and mux in a fairly usual way. The important detail is that You're correct that there's no demo or example of that right now. Turns out the only test that transmuxes uses the low-level libav API (it's just a conversion of an existing libav test) rather than the high(er)-level libav.js API. libav.js is as complete and as documented as I've made it (or have been paid to make it), and anticipating uses that I don't have is beyond that scope. If you end up writing a transmuxer you're happy with and would like to add it, PRs are welcome. Ultimately, though, transmuxing in this way is probably fairly pointless when you can just use the CLI, as mentioned above :) . Doing it through the CLI will also be faster as less data is moved into and out of JavaScript. I'm curious... do you find that your Misanthropic Patent Extortion Gang files with VP9 in them actually... work? There are standards for storing non–Misanthropic Patent Extortion Gang codecs in ISOBMF files, but in my experience, the actual support for playing such files is a bit dodgy. Though, my experience is olde, so perhaps that's changed. |
I hear you and heed your warning but as you're saying, sometimes it's inevitable. The CLI! Oh man, it was so easy all along. Just so I could figure things out I used the Oh yeah VP9 MP4 barely play anywhere. Surprisingly even trusty VLC shits the bed but MP4Box.js and Chrome deal with them just fine which is what I need for this particular use case. For user-facing video files I record a WebM with H.264 (eek, sorry) and transmux to MP4. |
Yeah, to get a CLI that has (exactly) what you need you'll need to build it; there's no CLI version provided that does exactly that. But, AFAIK, it should work. You can grab webcodecs' config out of |
After many attempts I have managed to build my WASM Factory file: |
What version of Emscripten are you running? |
|
It appears that that bug is in fact upstream. The question is, why is the modular version working at all 🤪 . I suspect that this is an environment problem. I doubt if I ever tested the modular version on the web, and in Node it may not use that code. Investigating. |
Looks like Emscripten changed this name between 3.1.55 (which was used in the github tests and my own builds) and 3.1.60. Rather than trying to support every version imaginable, I've just bumped things to be compatible with 3.1.60. Hopefully if you pull and rebuild, it should work. |
When using browser machinery such as
getDisplayMedia
andMediaRecorder
to record a screen, tab, etc, it is not possible to produce MP4 files, only WebM.MP4 is still the container format that is expected by most users/applications and so tansmuxing the WebM to MP4 is commonly handled with ffmpeg.wasm (
await ffmpeg.exec(['-i', 'input.webm', '-c', 'copy', 'output.mp4'])
).ffmpeg.wasm is a fantastic tool but it has one major limitation: it keeps the entire input and output files in virtual file system (MEMFS) which is limited to 2GB. It lacks streaming support and with WORKERFS it's possible to stream the input in, but the output is still written to MEMFS which suffers from the 2GB limitation.
For this reason I am trying to use libav.js to transmux my VP9-encoded WebM to MP4 without transcoding it.
I have no prior experience dealing with
ffmpeg
and itslibav
libraries and have been toiling away for the past two days trying to figure this out. I have managed to demux the WebM but can't for the life of me figure out the muxing to MP4. All samples I have found in the libav.js, libavjs-webcodecs-bridge and libavjs-webcodecs-polyfill repos are focused on encoding, decoding or transcoding.I do understand that muxing follows after encoding and hence all these examples do show muxing but I still haven't been able to figure out how to mux without decoding and re-encoding.
Is it possible to add an example showing WebM -> MP4 transmuxing?
Below is the code I have so far for demuxing the WebM file.
The text was updated successfully, but these errors were encountered: