3

I'm developing a commercial software that is not open source. It will use FFmpeg to export videos. The libx264 codec doesn't appear to be an option for me since I can only use LGPL for legal reasons. What is the best LGPL alternative to libx264? I'd like a codec that makes a good compromise between quality and file size as well as being supported by the majority of video players and video sharing sites such as YouTube. If I have to choose between lower quality and larger file size then I'd go with larger file size since videos can always be transcoded using other software if needed, but lossless formats such as Lagarith are still too large.

I see that libopenh264 may be an option, but is it supported by most players and video sharing websites? How does it compare to libx264 and is it LGPL?

XylemFlow
  • 963
  • 5
  • 12
  • If you choose VP8, you will not cover less consumers, and the quality won't be much worse. Alternatively, maybe your platform has a built-in h264 encoder (e.g. Windows, or Android, or macOS, or iOS). – Alex Cohn May 11 '21 at 19:11
  • @AlexCohn Thanks. I'll investigate VP8. Are you saying that Windows has a built in h264 encoder that I can call directly? Do you know where I can find the details and which versions of Windows support it? – XylemFlow May 12 '21 at 12:37
  • 1
    I found the info below regarding using built in Windows encoders, including h.264. This seems like the ideal solution to get best quality without paying for a license and also reduces the size of my software download. However, creating an interface to my Delphi application seems like a big job. https://learn.microsoft.com/en-us/windows/win32/medfound/overview-of-encoding-in-media-foundation – XylemFlow May 12 '21 at 13:05

2 Answers2

3

Consumers (players, platforms...) don't support encoders, they support codecs. And x264 and openh264 both encode H.264/AVC codec streams. You should be fine, technically, with libopenh264.

Gyan
  • 85,394
  • 9
  • 169
  • 201
  • 1
    Thanks. It seems that I need to build FFmpeg with --enable-libopenh264. Why isn't this enabled by default? Why would anyone use libx264 and not libopenh264 if the resulting files are essentially the same but with the extra legal restrictions? – XylemFlow May 11 '21 at 14:13
  • 2
    Both encoders produce standards-compliant streams but x264 is best-in-class encoder for H.264. Like two translators who both produce grammatically and semantically valid prose but one is better than the other. – Gyan May 11 '21 at 14:45
  • 1
    Thanks. I see now that OpenH64 supports only the baseline profile and not high profile. I guess this is the main limitation. Does anyone know if there are plans to add high profile at some stage? – XylemFlow May 11 '21 at 15:44
  • 3
    It hasn't happened for 5-6 years now. I wouldn't hold my breath. – Gyan May 11 '21 at 16:45
2

Purchase a commercial license for x264.

Then you won't be stuck with a sub-optimal encoder such as openh264 or have to use the GPL.

llogan
  • 121,796
  • 28
  • 232
  • 243
  • 2
    Thanks. I have contacted them through the website but haven't heard back yet. Do you know how much it is and what conditions there are? I'm not sure about the legal status for this because my software will be free (I earn through advertising). – XylemFlow May 11 '21 at 16:50
  • @XylemFlow Sorry, I don't know how much it is and I am not sure of the conditions. I you don't hear back there is another email address associated with commercial licensing shown [here](https://www.videolan.org/developers/x264.html). – llogan May 11 '21 at 16:55
  • Thanks. Do Video Lan own the rights would they just give me the link to the other website? – XylemFlow May 12 '21 at 12:34
  • @XylemFlow I'm unsure of the relationship, if any, of VideoLAN and x264 commercial licensing. – llogan May 12 '21 at 15:50