Kagami / ffmpeg.js

Port of FFmpeg with Emscripten
Other
3.24k stars 329 forks source link

HLS (HTTP Live Streaming) and DASH support #166

Open davedoesdev opened 2 years ago

davedoesdev commented 2 years ago

Add support for streaming (POST) via HLS and DASH. Uses asyncify and wasm.

Also updates FFmpeg to n4.4

davedoesdev commented 2 years ago

Docker image for buliding is available as davedoesdev/ffmpeg.js

davedoesdev commented 2 years ago

That's a good idea, it should be possible to postMessage it back to the main app.

On Wed, 10 Nov 2021 at 16:25, Banou @.***> wrote:

@davedoesdev https://github.com/davedoesdev Is it possible to get back the result without having it POSTed ? e.g getting it back from the memory via some emscripten mem calls ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Kagami/ffmpeg.js/pull/166#issuecomment-965510638, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARYYU5N7ZFK6GKVKHJNVYLULKMHJANCNFSM5FLCSLCQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

davedoesdev commented 2 years ago

I opened an issue for this: https://github.com/davedoesdev/ffmpeg.js/issues/2

On Wed, 10 Nov 2021 at 18:48, David Halls @.***> wrote:

That's a good idea, it should be possible to postMessage it back to the main app.

On Wed, 10 Nov 2021 at 16:25, Banou @.***> wrote:

@davedoesdev https://github.com/davedoesdev Is it possible to get back the result without having it POSTed ? e.g getting it back from the memory via some emscripten mem calls ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Kagami/ffmpeg.js/pull/166#issuecomment-965510638, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARYYU5N7ZFK6GKVKHJNVYLULKMHJANCNFSM5FLCSLCQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Banou26 commented 2 years ago

@davedoesdev Yeah i was just asking if there was a way to not POST the result buffers, but i just looked at the files you have and quickly found https://github.com/Kagami/ffmpeg.js/pull/166/files#diff-422ddc10e000c1fc59beea711ad0f2643abd420405c383c377b11227c0e58776 which i can modify to get back the array buffers without POSTing anything, so i deleted the message BTW thanks for this, pretty hyped to see what we can do with it

davedoesdev commented 2 years ago

@Banou26 yes that's the file that needs modifying. If I get time I'll see about adding an option to do this.

davedoesdev commented 2 years ago

@Banou26 see https://github.com/davedoesdev/ffmpeg.js/issues/2

Banou26 commented 1 year ago

Is this fork able to use async/await for input IO, would i be able to make similar changes in libav to get async/await working ? I've tried to use avformat demuxer/muxer with asyncify but it resulted in errors like

Uncaught (in promise) RuntimeError: null function or function signature mismatch
    at 00aa48d6:0x1051e8
    at 00aa48d6:0xb58ba
    at 00aa48d6:0xb6e58
    at 00aa48d6:0x1bda07
    at 00aa48d6:0x1be4a8
    at 00aa48d6:0x1a14c8
    at ret.<computed> (libav.js:9:3812847)
    at dynCallLegacy (libav.js:9:3807081)
    at dynCall (libav.js:9:3807167)
    at libav.js:9:3807319

When used in coordination with stuff like avio_alloc_context, which allows for custom input/output functions(more detailed example here https://github.com/emscripten-core/emscripten/issues/16686)

If i had async/await working for pulling data that'd make my life and code way easier

Basically any async/await in the main program(my own c++ code calling libav) loop worked fine, but if it was called from a libav callback(libav calling back my functions), async/await completly broke