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

Question about sources #48

Closed trevorgithub closed 5 months ago

trevorgithub commented 5 months ago

Apologies if this is the wrong forum to ask a question (as opposed to an issue).

I stumbled across libav.js recently. It seems (at least superficially) somewhat similar to another project, ffmpegwasm. In that project, it appears that the C source code is included in one of the repos, and that source is derived from the parent ffmpeg project and customized to make it work with webassembly.

My question is, does libav.js have the same strategy - does it fork the source of the ffmpeg, customizing it as needed for webassembly? I don't see the C code anywhere in this repo. I'm wondering if a different approach is taken here for libav.js, so that it's not necessary to fork the source ffmpeg project repo.

Yahweasel commented 5 months ago

There is no full fork of ffmpeg, as the changes are small and maintaining a per-se fork for such minor changes isn't worth the effort. Rather, patches/ffmpeg is a quilt patchset, with a few contrivances so it can work with ffmpeg 4, 5, or 6.

trevorgithub commented 5 months ago

Thanks for the quick reply. I had to look up quilt patchset. Please forgive me if my next question is ignorant.

It looks like patchset is relative to some base release. So, I guess you've got different major versions of ffmpeg you have quilt patchsets for; am I correct in understanding that the patchset is relative to a particular index/commit of the source library?

For example, I imagine that this patch:

https://github.com/Yahweasel/libav.js/blob/master/patches/ffmpeg/05-fftools.diff

Is relative to the ffmpeg-6.0.1. I see ffmpeg 6.1.1 is available now at ffmpeg.org. ffmpeg is a moving target as the upstream project continues to change. Is it correct that the patches would work against a certain point of time in the source project (e.g. 6.0.1)?

Yahweasel commented 5 months ago

The whole reason to use a patchset is that generally, it works against most versions. While ffmpeg is a moving target, the changes we need are so small and so localized, most of the time, it works against a wide range of versions. That being said, it's only tested against whatever version is currently being used in libav.js, and occasionally the latest release from every earlier major.

That being said, due to a quite major change in the organization of the UI tools (ffmpeg and ffprobe themselves), right now, the patchset doesn't work against 6.1 and later. It is of course on the checklist to get it updated, I just haven't had time yet, and it hasn't been a major priority. Most of the time, when ffmpeg updates, no changes whatsoever are required to the patchset.

trevorgithub commented 5 months ago

Thanks for the fast, complete response (and the education!).