[FFmpeg-user] encoding H264 from pictures, encoding values manipulation

Moritz Barsnick barsnick at gmx.net
Wed Nov 20 18:39:21 EET 2019


On Wed, Nov 20, 2019 at 16:38:49 +0100, Jorge Mas wrote:
>   ./ffmpeg.exe -framerate 25 -i $picture%04d.jpg -g 1 -c:v libx264
> -profile:v baseline -level 4.0 -crf 20 -pix_fmt yuv420p $picture.mp4
>   ./ffmpeg.exe -i $picture.mp4 -vcodec copy -vbsf h264_mp4toannexb -an
> $picture.mp4.h264

You don't need to do this in two steps.

> after analyzing both of videos with a tool named  SpecialVH264, several
> parameters differ between both videos, i.e:
> constraint_set0_flag in the original video is 0, but in the one that im
> generating the value is 1.

You should also show us the difference of the console outputs of
$ ffmpeg -i inputvideo
$ ffmpeg -i outputvideo

You should also show us the complete, uncut console output of your
conversion.

> is there a way that i can manipulate that constraint_set0_flag parameter?

If I understand correctly, the flag says something about the profile.
Indeed, libx264 has these code lines:
https://github.com/mirror/x264/blob/d4099dd4c722f52c4f3c14575d7d39eb8fadb97f/encoder/set.c#L129

> sps->b_constraint_set0  = sps->i_profile_idc == PROFILE_BASELINE;
> sps->b_constraint_set1  = sps->i_profile_idc <= PROFILE_MAIN;

So it seems your video is created with the Baseline profile. (We would
be able to see if you provided those outputs.)

Basically, choose a higher profile, e.g. by adding the encoder option
  -profile:v Main
or
  -profile:v High

(It depends what you want constraint_set1_flag to be.)

Cheers,
Moritz


More information about the ffmpeg-user mailing list