nathanbabcock / ffmpeg-sidecar

Wrap a standalone FFmpeg binary in an intuitive Iterator interface. 🏍
MIT License
238 stars 16 forks source link

consider downloading ffmpeg and ffprobe from https://github.com/eugeneware/ffmpeg-static #19

Open prabirshrestha opened 12 months ago

prabirshrestha commented 12 months ago

Use https://github.com/eugeneware/ffmpeg-static as it contains both ffmpeg and ffprobe and supports lot of different OS and architectures.

Currently it uses multiple domains. Having all from github.com would be great.

/// URL for the latest published FFmpeg release. The correct URL for the target
/// platform is baked in at compile time.
pub fn ffmpeg_download_url() -> Result<&'static str> {
  if cfg!(all(target_os = "windows", target_arch = "x86_64")) {
    Ok("https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip")
  } else if cfg!(all(target_os = "linux", target_arch = "x86_64")) {
    Ok("https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz")
  } else if cfg!(all(target_os = "macos", target_arch = "x86_64")) {
    Ok("https://evermeet.cx/ffmpeg/getrelease")
  } else if cfg!(all(target_os = "macos", target_arch = "aarch64")) {
    Ok("https://www.osxexperts.net/ffmpeg6arm.zip") // Mac M1
  } else {
    Err(Error::msg(
      "Unsupported platform; you can provide your own URL instead and call download_ffmpeg_package directly.",
    ))
  }
}
nathanbabcock commented 12 months ago

Great idea, I'm looking into this.

niraj-khatiwada commented 10 months ago

Hey @nathanbabcock I wanted to ask you about the licensing of FFMPEG. Is it legal to include static binaries of ffmpeg directly in our commercial product? I read the FFMPEG legal page but was not so sure about it. Since HypeTrigger also does similar kind of thing(including static binaries in the bundle), I wanted to ask you directly. Thanks

nathanbabcock commented 10 months ago

@niraj-khatiwada Great question and I'd encourage you to do your own research to be 100% sure for your own use case, but here is my understanding based on this official source: https://www.ffmpeg.org/legal.html.

  1. The core parts of FFmpeg are LGPL, which do allow for commercial use
  2. However, it may be compiled with extensions that are GPL (for example, certain proprietary codecs) which forbid commercial use

For a given FFmpeg binary, you can check which license applies to it by looking through the configuration flags that are printed out on every command, and check for --enable-gpl and/or --enable-nonfree.

As for ffmpeg-sidecar, some of the auto-downloaded binaries do include nonfree extensions (although the exact builds vary by platform). If you want to commercialize your product, you would want to replace these auto-download sources with your own custom build of FFmpeg that complies with the appropriate licensing terms. For example, if Hypetrigger introduced a paid plan in the future, we would do something similar.


As an aside — I actually think using the "sidecar" methodology offers some big advantages compared to other ways of using FFmpeg, such as static linking. In theory, you could skip bundling FFmpeg with your application entirely, and offer a step at runtime that guides the user to either download an official binary from a 3rd-party source, or provide their own. This would bypass most of the licensing constraints since you would be neither distributing nor linking against any part of the FFmpeg codebase. It would be more akin to the way a website is not bound by the licensing terms of any particular browser that opens it.

But to reiterate, if you are going to build a $10M startup that uses FFmpeg heavily, maybe check with an actual lawyer first :)

nathanbabcock commented 10 months ago

So to answer the question more directly:

Is it legal to include static binaries of ffmpeg directly in our commercial product?

Yes, if your app is non-commercial and you stick to an LGPL build of FFmpeg.

niraj-khatiwada commented 10 months ago

@niraj-khatiwada Great question and I'd encourage you to do your own research to be 100% sure for your own use case, but here is my understanding based on this official source: https://www.ffmpeg.org/legal.html.

  1. The core parts of FFmpeg are LGPL, which do allow for commercial use
  2. However, it may be compiled with extensions that are GPL (for example, certain proprietary codecs) which forbid commercial use

For a given FFmpeg binary, you can check which license applies to it by looking through the configuration flags that are printed out on every command, and check for --enable-gpl and/or --enable-nonfree.

As for ffmpeg-sidecar, some of the auto-downloaded binaries do include nonfree extensions (although the exact builds vary by platform). If you want to commercialize your product, you would want to replace these auto-download sources with your own custom build of FFmpeg that complies with the appropriate licensing terms. For example, if Hypetrigger introduced a paid plan in the future, we would do something similar.

As an aside — I actually think using the "sidecar" methodology offers some big advantages compared to other ways of using FFmpeg, such as static linking. In theory, you could skip bundling FFmpeg with your application entirely, and offer a step at runtime that guides the user to either download an official binary from a 3rd-party source, or provide their own. This would bypass most of the licensing constraints since you would be neither distributing nor linking against any part of the FFmpeg codebase. It would be more akin to the way a website is not bound by the licensing terms of any particular browser that opens it.

But to reiterate, if you are going to build a $10M startup that uses FFmpeg heavily, maybe check with an actual lawyer first :)

This was incredibly helpful Nathan. Thank you so much for your time and effort for this.