[FFmpeg-user] Request for pointers on how to figure out the spec for transcoding profile for output video from ffmpeg

Moritz Barsnick barsnick at gmx.net
Mon Jul 1 15:52:52 EEST 2019

On Mon, Jul 01, 2019 at 17:54:08 +0530, Aameer Rafiq Wani wrote:
> I went through some docs but I am not sure if I was able to comprehend it
> in its entirety. I am have a some hard time to figure out the details of
> it.

Some of it depends on how ffmpeg's integration of x264 works, and some
of it on how x264 internally maps the profiles and levels to actual
encoding options. These may even differ from version to version.

The default encoding quality, for example, is chosen by ffmpeg, and
it's CRF 23. The parameters for each profile are chosen by libx264, as
far as I am aware.

> What I want to know is what the transcoding profile in above command
> is?

Unfortunately, even with increased verbosity, libx264 doesn't give us a
message with the encoding details. But it does put those details into
the actual H.264 stream.

What you can do is to pipe a bit of the raw video to a filter and look
at the string libx264 inserts:

$ ffmpeg -i $INPUT_VIDEO_FILE -codec:v libx264 \
  -x264opts "keyint=24:min-keyint=24:no-scenecut" \
  -profile:v baseline -level 4.0 -vf "scale=-2:1080" \
  -t 1 -f rawvideo - | strings | grep x264

(Or you can look at the actual resulting file, after your conversion.)
And you get something like this:

x264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=0 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=24 keyint_min=13 scenecut=0 intra_refresh=0 rc_lookahead=24 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00

(Note that, in this case, it doesn't seem to accept your min-keyint: it
tunes it to something else. Your other specific options to have an
effect though.)

That output should contain all the details. It doesn't mean you should
tweak those encoding defaults yourself. ;-) Unless you know really
really well what you are doing.


More information about the ffmpeg-user mailing list