The endless Os does not ship with the H.264 codec,and one needs to pay to get that. Is there any other way to either download the codec for free ?
Simply downloading the codec in binary form won't solve your problem, neither will plain FFmpeg solve the problem that you have in a way that's comfortable for you. So what is your specific problem? Did you download a file from somewhere to your hard drive and want to play it locally or did you visit a website in your browser that has a video which doesn't play?
Also in which country do you live? There is a valid reason why things are as they are:
Note: As a US company, Endless must pay patent license royalties to 3rd party license agencies when the above codecs are installed on an Endless system. These costs are included when you buy a system from Endless, and they are covered by the upgrade charge if you have downloaded Endless OS for free. This will also occur if you buy a computer that already comes with the Endless OS. Only when the manufacturer itself offers the codecs to its buyers, the computer will come with the CODECS.
How can I download the codecs to play more types of music and videos?
If you don't live in a country where these legal restrictions apply then you can download an application like VLC directly from the App Center in Endless OS to play local media files. I just tried it in my Endless OS VM with a movie trailer and it played fine. (Technically VLC comes with demuxers, decoders, ffmpeg and many more plugins to make media playback work and you can browse all the included modules but I couldn't find a good way to explain how to trace the
avcodec decoder to the correct module. Let's assume it's the ffmpeg decoder module.)
For videos on the web:
On computers with Intel, AMD or other x86-64 CPUs: from Endless OS 3.0.7 onwards, you can install Google Chrome from the App Center. Netflix and YouTube should work fully in Google Chrome. Depending on when you first installed Endless OS, it may already be your default browser.
On the Endless Mini or other computers with ARM CPUs: YouTube should work fully in the built-in browser but Netflix is not supported due to digital rights management.
Why can’t I watch Netflix or YouTube videos?
Firefox should also be able to play h.264 encoded videos though as it has shipped a such a codec too for a while now but my tests a few years back failed due to a missing audio codec. This may have been solved now, but I haven't checked yet due to time constraints.