MathewSachin / Captura

Capture Screen, Audio, Cursor, Mouse Clicks and Keystrokes
https://mathewsachin.github.io/Captura/
MIT License
9.7k stars 1.81k forks source link

Evaluation of gifski #457

Open pr8x opened 4 years ago

pr8x commented 4 years ago

If you're fine with the license one could consider integrating Gifski. The current gif encoding is really unoptimized and produces giant files.

vatterspun commented 4 years ago

fine with the license

As far as I'm aware, MIT and AGPL are compatible, both being on the more permissive end of the spectrum. IIRC, using code from the Gifski program would mean you'd need to to add that to your license notice.

pr8x commented 4 years ago

I can actually look into implementing this. Shouldn't be too hard, tbh.

MathewSachin commented 4 years ago

@pr8x I'd be happy to accept your contribution.

It seems easy to implement but there are a few things to take care of:

  1. We need the project to be as modular as possible. So, start by creating a new .NET C# project in the solution folder, preferably named Captura.Gifski.

  2. Include the license file in the licenses folder. I'm still not sure about license compatibility though.

  3. We'll be using Gifski as an executable and not as a library to avoid licensing issues. An option is needed to specify the path to gifski.exe which fallbacks to some defaults if not specified like what we have for FFmpeg.

  4. We'll not be distributing Gifski with Captura to avoid increasing download sizes. Optionally, we could implement a Gifski downloader, as we have done for FFmpeg.

  5. Now, getting to the implementation. Start by inheriting from the IVideoConverter interface. See FFmpegVideoConverter for example.

    We'll follow the usage mentioned on Gifski README.

    Use ffmpeg command to convert any video to PNG frames:

    ffmpeg -i video.webm frame%04d.png

    and then make the GIF from the frames:

    gifski -o anim.gif frame*.png
  6. Parsing the Gifski output to report progress from within IVideoConverter.

  7. There might be some things that I missed but these are the ones I feel are the most important to get started. I'll update if anything else comes to mind.

PS: I'm a bit busy with my studies right now, this being my pre-final year and all. But, I'll try to help you to the best of my ability as time permits.