Skip to content
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

Add DASH support back in #1

Closed
davedoesdev opened this issue Oct 6, 2021 · 21 comments
Closed

Add DASH support back in #1

davedoesdev opened this issue Oct 6, 2021 · 21 comments

Comments

@davedoesdev
Copy link
Owner

See early commits on Kagami#166

@rafael2k
Copy link

rafael2k commented Oct 7, 2021

Thanks David! So I should compile this (your) branch, right?

Already started compiling and it seems to be going all good! Just typed "make"!

@rafael2k
Copy link

rafael2k commented Oct 7, 2021

Arrived to the first error:
make[1]: Leaving directory '/home/rafael2k/files/dw/ffmpeg.js/build/ffmpeg-webm'
emcc build/ffmpeg-webm/ffmpeg.bc build/opus/dist/lib/libopus.so build/libvpx/dist/lib/libvpx.so
--post-js build/post-sync.js
-O3 --closure 1 --memory-init-file 0 -s WASM_ASYNC_COMPILATION=0 -s ASSERTIONS=0 -s EXIT_RUNTIME=1 -s TOTAL_MEMORY=67108864 --pre-js build/pre.js -o ffmpeg-webm.js -s NODEJS_CATCH_EXIT=0 -s NODEJS_CATCH_REJECTION=0 -lnodefs.js -lworkerfs.js -s WASM=0
Traceback (most recent call last):
File "/usr/share/emscripten/emcc.py", line 3292, in
sys.exit(main(sys.argv))
File "/usr/share/emscripten/emcc.py", line 3285, in main
ret = run(args)
File "/usr/share/emscripten/emcc.py", line 2156, in run
post_link(options, wasm_target, wasm_target, target)
File "/usr/share/emscripten/emcc.py", line 2253, in post_link
do_binaryen(target, options, wasm_target)
File "/usr/share/emscripten/emcc.py", line 2774, in do_binaryen
run_closure_compiler()
File "/usr/share/emscripten/emcc.py", line 2769, in run_closure_compiler
final_js = building.closure_compiler(final_js, pretty=not minify_whitespace(),
File "/usr/share/emscripten/tools/building.py", line 1027, in closure_compiler
proc = run_process(cmd, stderr=PIPE, check=False, env=env)
File "/usr/share/emscripten/tools/shared.py", line 94, in run_process
ret = subprocess.run(cmd, check=check, input=input, *args, **kw)
File "/usr/lib/python3.9/subprocess.py", line 505, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.9/subprocess.py", line 951, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '--max_old_space_size=8192'
make: *** [Makefile:278: ffmpeg-webm.js] Error 1

@davedoesdev
Copy link
Owner Author

Are you compiling with separate emsdk? https://emscripten.org/docs/getting_started/downloads.html
It looks like your version of Node doesn't support that argument.

Another way would be to use the Docker image - see https://emscripten.org/docs/getting_started/downloads.html but use davedoesdev/ffmpeg.js instead of kagamihi/ffmpeg.js.

@davedoesdev
Copy link
Owner Author

@rafael2k by the way, the example is now up: https://github.com/davedoesdev/streamana

@rafael2k
Copy link

rafael2k commented Oct 8, 2021

Are you compiling with separate emsdk? https://emscripten.org/docs/getting_started/downloads.html It looks like your version of Node doesn't support that argument.

Another way would be to use the Docker image - see https://emscripten.org/docs/getting_started/downloads.html but use davedoesdev/ffmpeg.js instead of kagamihi/ffmpeg.js.

@davedoesdev, I'm compiling with stock versions from Debian 11 repository.

@rafael2k
Copy link

rafael2k commented Oct 8, 2021

@rafael2k by the way, the example is now up: https://github.com/davedoesdev/streamana

Cool, thanks! I'll try with the binaries for now.

@davedoesdev
Copy link
Owner Author

davedoesdev commented Oct 8, 2021

OK cool. The stock version from Debian is probably behind quite a bit. emsdk comes with it's own version of Node, for instance.

@davedoesdev
Copy link
Owner Author

I'll think about how best to put dash in

@rafael2k
Copy link

rafael2k commented Oct 12, 2021

Yay! I'll update just my node and see if compilation finishes (or try to patch the source).

@davedoesdev
Copy link
Owner Author

@rafael2k how are you testing DASH ingestion? Is there an open source server I can test against?

@rafael2k
Copy link

In my current DASH workflow I contribute (upload) the live stream to icecast2, then I make ffmpeg connect to it and create the DASH manifest and files on the fly.

@davedoesdev
Copy link
Owner Author

Hmm, at the moment I've only tested streaming the generated DASH files to an ingestion URL (like YouTube).
I guess that's not your use case?

@davedoesdev
Copy link
Owner Author

davedoesdev commented Oct 17, 2021

I suppose if you had a local web server which accepted POST (or PUT) of the generated DASH files then that might work?

@davedoesdev
Copy link
Owner Author

I'll have a look at setting one up locally when I get time.
I should also look at how streaming from the server to the browser works :)

@davedoesdev
Copy link
Owner Author

Btw, I merged DASH support into master and streamana

I'll need to test it by ingesting it into a local http server and then playing out the files in a browser

@rafael2k
Copy link

rafael2k commented Oct 17, 2021

Great! Indeed, icecast2 works this way [1] - a PUT to the server. In case of DASH, I think the ingest will be similar, but instead of just one PUT, it will be one PUT per chunk, I think.
[1] https://github.com/social-dist0rtion-protocol/wasm-stream/blob/master/src/icecast.js

@davedoesdev
Copy link
Owner Author

@rafael2k in your workflow, where is the desired destination of the DASH files?

@rafael2k
Copy link

The desired destination would be a server which can later serve the encoded DASH formatted media through a webserver. But I'm not totally sure yet. The "push" protocol can be REST based, or not. A simple network socket pushing the media to the server would be enough already.

@davedoesdev
Copy link
Owner Author

@rafael2k this is now in the UI. You can select DASH or HLS, POST or PUT and the CORS mode.

I tested it PUTting to a local Apache server which I enabled WebDAV on and it worked fine - I could stream the DASH files into a <video> element from a different browser.

@rafael2k
Copy link

rafael2k commented Oct 21, 2021

This is wonderful David. I'll test soon. Cheers!
(And will also try to finally fix my build setup, which is almost there - .wasm gets created and the fail is just for the .js creation)

@davedoesdev
Copy link
Owner Author

@rafael2k how did you get on?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants