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

Access to metadata #52

Closed reinhrst closed 2 months ago

reinhrst commented 2 months ago

I was wondering if you have some insights on how to get to (ffmpeg) metadata on the files (metadata is added using ffmpeg convert: -metadata key=value.

I can see that libav.js can extract the metadata just fine (by default it's printed to the js console when running libav.ffmpeg(). However the normal way to get to it (using -f ffmetadata) is not supported (Requested output format 'ffmetadata' is not a suitable output format) -- as far as I understand, this output format is removed with the --disable-everything, and there is no custom tag to bring it back.

The alternative would be (I guess) to get the metadata directly from the AVFormatContext struct, but that is probably more complex.

Any suggestions would be appreciated!

Yahweasel commented 2 months ago

I don't provide any builds with the ffmetadata format built in, and I doubt if this is of such general utility that I could justify doing so, but you can make a build that has it. See https://github.com/Yahweasel/libav.js/blob/master/docs/CONFIG.md . You'll want to make a configuration that includes "muxer-ffmetadata" as well as everything else you need. Indeed, I'm not sure if I even provide the necessary accessors to get the metadata out of the format context, as nobody's asked yet :) . The accessors that are in libav.js are all there because somebody (usually me) needed them.

reinhrst commented 2 months ago

That was the easiest ever :). Recompiled with the muxer-ffmetadata, and works (I tried ffmetadata and metadata in that spot before, so I guess I was almost there :))