I would like to use h.264 as the codec inside .mp4 container for my user uploaded videos for my website. But I saw somewhere that h.264 is non free. I am unsure whether I can use this technology or not. My question whether I can use it to compress my user uploaded videos in my website? If yes, then its great. And if no, what other solution can I go with? Thank you.

3 Answers 3


You are correct: h.264 is non-free and content producers as well as developers are obliged to pay royalties to MPEGLA for its use - but only if they are charging for their content, and the volume goes over the threshold MPEGLA sets (which is in the order of 100,000 paying subscribers or > 12 minutes in length if charging title-by-title). Thjey have also said that they will never charge for h.264 video that is freely distributed.

See MP4 / h.264 patent issues? for more info.

TL;DR if your video is free to view, then h.264 is free for you to use, and as @LordNeckbeard points out, it's a ripper of a codec, so knock yourself out.

  • Just to be more clear, it will be a video sharing website like keek or youtube, and I won't take any fees from the users, just will show ads. Therefore just to be on the safer side, following your answer, I don't have to pay even if my users are more that 100,000 right?
    – Robin
    Commented Feb 18, 2015 at 6:01
  • Remember rhat my legal advice is worth all the money you're paying me. To be "on the safer side" I'd get a lawyer once your user base > 100,000. But there's links to the MPEGLA terms in the other question I mentioned, if you want to judge for yourself.
    – stib
    Commented Feb 18, 2015 at 6:13
  • Yeah, I've seen people ask before if making money from adds still counts as free. The consensus on the doom9.org thread was that it's fine, you only need to pay the MPEG-LA if you're requiring money for content. (So I think even free but donation-supported would be ok.) Commented Feb 26, 2015 at 6:01

Use it. Nothing else can provide the the same quality per bitrate as x264 (the top-class H.264 encoder) while not taking 10,000 years to encode (x265 'n VP9).

Some tips:

  • Use a recent ffmpeg build since development is so active. Static builds are available and easy.

  • Add -movflags +faststart to your command. Once encoding is finished this option will relocate the moov atom to the beginning of the file allowing playback to begin for your viewer before the file is completely downloaded.

  • Because ffmpeg attempts to avoid chroma subsampling using -pix_fmt yuv420p is recommended to ensure a widely compatible pixel format.

  • Some devices may require you to use a more restrictive profile and level. You can do this with the -profile:v and -level options. Be aware of attempting to force a specific level on outputs that will not conform (such as trying to force -level 3 on a 1920x1080 video). ffmpeg will give level limit warnings in the console output if this is the case.

  • See the H.264 and AAC encoding guides for more info.

  • Very informative! Thank you. I can't accept the answer as it does not state much regarding my question, but I have vote your answer. Thank you again for such an informative answer!
    – Robin
    Commented Feb 18, 2015 at 5:59
  • VP9 does required 10,000 years to encode , while x265 able to do mealtime encoding even on my weak VPS for SD format which is impossible with VP9
    – Salem F
    Commented Jun 13, 2018 at 23:13
  • @SalemF Looks like x265 may have gotten faster since this answer was written. I'll have to give it a try and maybe update this answer. Now there is an even slower newcomer, AV1, which when stable will put the others to shame in this slow race.
    – llogan
    Commented Jun 13, 2018 at 23:33
  • Offtopic can you take look at my question here as it on of HEVC downside it's harder to create live broadcast using current tools 'that's mostly support H264 with FLV container'
    – Salem F
    Commented Jun 13, 2018 at 23:49

If I am right, HTML5 supports H.264 codec with mp4 container. In this case the company which developed the browser has paid it's license.

You can also use video servers for VOD playing, like Wowza Streaming Engine.

  • 2
    That's not true. Although the software has paid a license, if you are charging viewers for the content and you go above the threshold for number of subscribers you owe MPEGLA royalty fees for using the codec.
    – stib
    Commented Feb 16, 2015 at 3:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.