grill2010
grill2010

Reputation: 614

FFmpeg autogen in combination with openh264

I'm using FFmpeg autogen to stream images captured from the PC in realtime (60 or 30 fps) to an Android application. Everything is working perfectly as I used the h.264 encoding example provided by FFmpeg autogen.

As far as I have understood FFmpeg autogen is under the LGPL licence and if you are using custom FFmpeg libs compiled under LGPL licence like for example ffmpeg-win32 you can dynamically link to the FFmpeg autogen library without violating the LGPL licence if your project is for example closed source.

So I thought everything would be okay but then I figured out the the h.264 coded is patented in the US and MPEG LA represents the patent holders of AVC/H.264 technologies. If you are using it for free videos you can use h.264 codecs without paying royalties. Nevertheless, my Windows program which is using the encoder is free but my Android application is not free so I guess I have to pay royalties.

I have a few questions regarding this issue:

  1. Which encoder does the FFmpeg autogen use, because as far as I know x264 is under GPL licence. I assume that it will use some internal FFmpeg software encoder?

  2. You can't use any built in standard encoder from FFmpeg (x264 etc.) in projects which don't offer their encoded video stream for free without the need of paying royalties, right?

  3. After some researches I found openh264. This library is built by cisco and they will pay all the royalties but you are not allowed to bundle it with your application, it must be downloaded during the installation process. It also works with FFmpeg but how to I get it to work with FFmpeg autogen? Do I need a custom FFmpeg build which are using the openh264 lib from cisco?

I know this is not a lawyer forum but maybe someone has already dealt with all this issues or could at least answer the questions about FFmpeg autogen. I've searched a while now on the internet but unfortunately it seems that the licencing mechanism with h.264 is not so easy to understand.

Upvotes: 1

Views: 1576

Answers (1)

grill2010
grill2010

Reputation: 614

I almost forgot about this question but I think I've understood everything now so I will answer it by myself. Maybe it is helpful for someone. In case something is not correct please feel free to correct me.

As far as I have understood FFmpeg autogen is under the LGPL licence and if you are using custom FFmpeg libs compiled under LGPL licence like for example ffmpeg-win32 you can dynamically link to the FFmpeg autogen library without violating the LGPL licence if your project is for example closed source.

This is indeed correct. FFmpeg autogen is under LGPL licence but if you are just using the provided FFmpeg libraries from zeranoe you are out of luck because all this builds are under GPL licence. This means even if FFmpeg autogen is under LGPL your project still has to be published under GPL as well because of the FFmpeg GPL libraries.

Luckily you can just compile your own custom version of FFmpeg under LGPL but you will miss some features like x264 (basically all features which are not appropriate for LGPL). Compiling a custom version of FFmpeg could be pretty complex, however I found a nice project on github which is called media-autobuild_suite. These scripts basically compile FFmpeg for you and offer many customization features for all kind of FFmpeg features like openh264 and many more. I posted some more details here.

So I thought everything would be okay but then I figured out the the h.264 coded is patented in the US and MPEG LA represents the patent holders of AVC/H.264 technologies. If you are using it for free videos you can use h.264 codecs without paying royalties. Nevertheless, my Windows program which is using the encoder is free but my Android application is not free so I guess I have to pay royalties.

I contacted MPEG LA and it doesn't matter if your program is free if you want to be covered by the licence you have to contact MPEG LA and request a licence for your product. You don't have to pay anything though as long as your program will not be downloaded more than 100 000 times per year. You have to provide some reports once a year to MPEG LA which should contain all the information about the downloads. In case you have some questions just contact MPEG LA they are usually very responsive and will reply very fast.

  1. Which encoder does the FFmpeg autogen use, because as far as I know x264 is under GPL licence. I assume that it will use some internal FFmpeg software encoder?

FFmpeg autogen will use the x264 encoder if you are just using the zeranoe FFmpeg builds. But in general it depends how you have compiled FFmpeg. I compiled FFmpeg with openh264 in order to use openh264 encoder with FFmpeg autogen just load the encoder like this

ffmpeg.avcodec_find_encoder_by_name("libopenh264");
  1. You can't use any built in standard encoder from FFmpeg (x264 etc.) in projects which don't offer their encoded video stream for free without the need of paying royalties, right?

I don't know if this is correct for any other built in encoder in FFmpeg but you can't use x264 without requesting a licence from MPEG LA. Except openh264 because cisco will pay the royalties for you. Keep in mind that you can't bundle openh264 with your application because otherwise you are responsible to pay the royalties to MPEG LA and not cisco. You have to download openh264 during the installation process of your program or you can provide some download possibilities during the runtime of your program.

  1. After some researches I found openh264. This library is built by cisco and they will pay all the royalties but you are not allowed to bundle it with your application, it must be downloaded during the installation process. It also works with FFmpeg but how to I get it to work with FFmpeg autogen? Do I need a custom FFmpeg build which are using the openh264 lib from cisco?

Yes, you have to download it during the installation process or during the runtime of your program and yes, you need a custom FFmpeg LGPL build with openh264. You can easily compile your own version of FFmpeg with media-autobuild_suite.

Just one more thing, if you are using FFmpeg under LGPL keep in mind that there are some conditions that you have to consider, you can find them here. That's all for now. I hope these are some useful information.

Upvotes: 5

Related Questions