Yahweasel / libav.js

This is a compilation of the libraries associated with handling audio and video in ffmpeg—libavformat, libavcodec, libavfilter, libavutil, libswresample, and libswscale—for emscripten, and thus the web.
288 stars 18 forks source link

Custom Build Config for only Decoding VP8 #15

Closed waldobeest closed 1 year ago

waldobeest commented 1 year ago

Hi Yahweasel,

Once again, super project, thanks!

I have a question on a custom build config to reduce the library size for only needing to decode vp8 in the browser.

Some background on what I am trying to do, the videos I am decoding have no audio, so it needs no flac or ogg support. They are only a few resolutions needed, and I only need the decoding from vp8 webm done in the browser.

My build configs:

deps.txt
tmp-inst/@TARGET/lib/pkgconfig/vpx.pc
ffmpeg-config.txt
--enable-libvpx
--enable-decoder=libvpx_vp8
libs.txt
tmp-inst/@TARGET/lib/libvpx.a
link-flags.txt
-DLIBAVJS_WITH_SWSCALE=1

The builds are successful, and have reduced the size as needed, but in turn have some errors in processing in the browser.

image (98)

I also tried with:

ffmpeg-config.txt
--enable-protocol=data --enable-protocol=file
--enable-filter=aresample
--enable-libvpx
--enable-decoder=libvpx_vp8
--enable-encoder=libvpx_vp8

and getting:

image

Any way that you can see we can achieve this, or is the best way to roll with the config for the webm-flac-opus?

Yahweasel commented 1 year ago

It looks like you're using avformat_open_input_js, i.e., you're not just decoding VP8, you're also demuxing WebM. If you want to be able to demux WebM, you need to include the WebM format. You should create the configuration like so:

$ cd configs
$ ./mkconfig.js webm-decode '["webm","vpx","vp8"]'
Yahweasel commented 1 year ago

Closing as presumably complete.