Closed weituotian closed 5 years ago
i am using this lib in chrome.
function mergeVideoAudio(videoFile, audioFule) { var worker = new Worker("ffmpeg-worker-mp4.js"); var videoFileName = 'video1'; var audioFileName = 'audio1'; worker.onmessage = function (e) { var msg = e.data; switch (msg.type) { case "ready": worker.postMessage( { type: "run", // arguments: ["-version"] arguments: [ '-y', '-i', videoFileName, '-i', audioFileName, '-map', '0:v', '-c:v', 'copy', '-map', '1:0', '-c:a', 'copy', 'output.mp4' ], MEMFS: [ { data: videoFile, name: videoFileName }, { data: audioFule, name: audioFileName } ] }); break; case "stdout": stdout += msg.data + "\n"; break; case "stderr": stderr += msg.data + "\n"; break; case "exit": console.log(stdout); console.log(stderr); debugger; console.log("Process exited with code " + msg.data); worker.terminate(); var h2 = document.createElement('h2'); h2.innerHTML = '<a href="' + URL.createObjectURL(msg.data) + '" target="_blank" download="Play mp4 in VLC Player.mp4" style="font-size:200%;color:red;">Download Converted mp4 and play in VLC player!</a>'; document.appendChild(h2); break; } }; }
so how to get result data(the content of output.mp4) from msg obj?
It would be nice if you can share your fixed version.
confused.I still can't get result data.
i am using this lib in chrome.
so how to get result data(the content of output.mp4) from msg obj?