3

Is there a way to mux a video file (VP9) with an audio file (VORBIS or OPUS) using nothing but JS?

I was reading the WebM Project website and it seems that it's based on Python?

I did come across this Git repository. But I'm kind of struggling to understand the documentation; and from my digging I don't believe mp4 is compatible with VP9.

So, yeah, does there happen to be a way to mux a video file (VP9) with an audio file (VORBIS or OPUS) using nothing but JS? Or a way to at least transmux those formats into formats which can be muxed using JS?

I also just found this other Git Repository, but I'm not sure yet whether or not it does what I'm looking for.

blackgreen
  • 34,072
  • 23
  • 111
  • 129
oldboy
  • 5,729
  • 6
  • 38
  • 86
  • 1
    afaik, not really. i've meant to get around to playing with an ASM or WA ported ffmpeg to see if it can be done, but that's obciously pretty hacky and would be a proof of concept at this point, not something i would want in production... – dandavis Jul 25 '17 at 22:35
  • In order to save the file or just to play it ? And where do this media come from? – Kaiido Jul 25 '17 at 23:05
  • 1
    Might interest : https://stackoverflow.com/questions/39302814/mediastream-capture-canvas-and-audio-simultaneously/39302994#39302994 though it does only live recording (at playback speed) – Kaiido Jul 25 '17 at 23:19
  • @Kaiido files come from YT. and to save it locally to your PC – oldboy Jul 25 '17 at 23:39
  • 1
    And YT gives access to its files now ? And it allows audio only files ? I probably need an update ;-) But then, MediaRecorder option will be an overkill. One hypothetically possible way could be to port this [node-js EBML Parser](https://github.com/themasch/node-ebml) to front, and try to append your audio source from there. Never tested, don't even know if it would be feasible. Or, as proposed by @dandavis to port ffmpeg to WebAssembly, but I wonder if it is feasible, if so, that would be a great solution for a lot of similar problems ;-) – Kaiido Jul 26 '17 at 00:33
  • @Kaiido no, they don't readily give access to it. and, no, they create both audio and video files, but split them into separate files ;) i'm a massive n00b when it comes to the backend. i know very basic PHP and i'm familiar with AJAX (which i believe might be another way to accomplish that which i want to accomplish:) maybe host a muxer on one of my domains and just do all the muxing there and serve from there. what is ffmpeg, it keeps popping up? also, what's webassembly? lol – oldboy Jul 26 '17 at 00:46
  • 1
    [WA or WebAssembly](https://developer.mozilla.org/en-US/docs/WebAssembly) could allow the execution of C/Assembly code in the browser. [ffmpeg](https://www.ffmpeg.org/), the graal(?) of open source media encoding, which is written in C/Assembly. Yes, if installed on your server, you could just send both files there, and use ffmpeg to do the muxing. – Kaiido Jul 26 '17 at 01:13
  • @Kaiido sweet. thanks for all of the info. i'll check it out :) will i need to know much about the back end in order to achieve this? or whaddya mean by porting ffmpeg to WA, like what would that entail? – oldboy Jul 26 '17 at 01:27
  • 1
    Yes, you'll have to learn some basics backend operations, like create a function, call a command, send a response etc. All should be quite documented though. For porting ffmpeg to WA might be an harder job (if it is even possible) : you'd need to know basics of WA, and its restrictions (I myself don't fit already), know C/Assembly code to be able to actually port and to debug potential issues take the time to port all its dependencies beforehand. – Kaiido Jul 26 '17 at 01:35
  • 1
    you can use keepvid.com or (another rehoster) to get downloadable YT audio and video files from any video they host. you could scrape that mirror and do something with the data, but i doubt user-land JS can "ajax" those urls because of SOP... – dandavis Jul 26 '17 at 01:44
  • @dandavid omg i didn't even think of simply downloading it from a site and than "forwarding" it. what is SOP? – oldboy Jul 26 '17 at 02:38
  • @dandavis wayyy too complicated. every site i've come across uses server side scripts and they have 10k+ lines of JS – oldboy Jul 27 '17 at 19:01
  • @Kaiido check out https://github.com/ffmpegwasm/ffmpeg.wasm for browser-based video editing – Crashalot Dec 24 '20 at 19:49

0 Answers0