[FFmpeg-user] best FFMPEG encoding and encoding a file to fast start

Moritz Barsnick barsnick at gmx.net
Thu Jun 11 15:20:24 CEST 2015


On Tue, Jun 09, 2015 at 00:13:50 +0000, Dani A wrote:

> I am building a platform for users to uploap videos and I want to
> make sure all my files are converted to MP4, as I now it is the best
> for quality and size as I do not have unlimited space. And then
> online users can view those files on PC, IPAD, and mobile phones.
> Just like youtube.... So is libx264 the best encoding?

You want to build a video encoding/hosting site, but don't know much
about encoding - that's not a terribly good base.

You will find a lot of material "out there" (on the web) with regards
to compatibility of devices and browsers/players with video material.
And the game changes every few years. If you want to reinvent those
wheels, you need to try to leverage from that experience out there /but
not necessarily here).

You originaly wrote:
> Two questions, what is the best enconding to be used to convert a
> video file to lower size file while maintaining quality?

"Maintaining quality" is a fuzzy term. Re-encoding any video with a
lossy codec _reduces_ quality, there's nothing around that. What may be
maintained is the perceived quality, but that depends on the
expectations and the eyes and the device of the user (and the type of
video material).

I always try to describe encoding as a trade-off of three parameters
(which is slightly simplified):
- size (of the video, equivalent to bandwidth of a stream)
- quality (possibly incl. resolution)
- speed (of encoding, or required CPU power)

You can never have the best of all three!

libx264 has a number of nice presets which - while each providing the
same quality - trade speed for size. They go from "ultrafast" to
"veryslow" (or "placebo"). So if you have enough CPU and patience, you
can choose "veryslow". This makes the codec put more effort into
encoding, and to use more complex mechanisms. Other codecs also provide
varying mechanisms. But note that these mechanisms may not be supported
by certain players. H.264 categorizes the mechanisms in Profiles and
Levels for ease of compatibility definitions. The "Baseline" profile
Harald mentioned in his response may be the only profile compatible
with the widest range of mobile devices, but at the same time it isn't
very efficient. So there you go. You will have to do research and
experiments. Perhaps you quickly find a point of "good enough".

Good luck,
Moritz


More information about the ffmpeg-user mailing list