0

Sample Command:

-map 0:0 -f mp4 -vcodec libx264 -preset slow -profile:v main -vf scale="640:trunc(ow/a/2)*2" -vb 700k -minrate 650k -maxrate 750k -bufsize 10000k -an -g 48 -x264opts keyint=48:min-keyint=10:scenecut=40 -flags +cgop -sc_threshold 40 -pix_fmt yuv420p -threads 0 -y

There is as such no error in encoding, But I wanted to understand following points-

1) the above command will ensure that range of GOP size is {10,48}, and if any scene change value (frame1 to fame2) is >40%, then a keyframe is introduced there?

2) So that means in a 3 hours of source video, there is no guarantee that GOP size will remain same

3) No consider, I am creating 7 MP4 files each with different bitrate and resolution. (These Mp4s will be encoded to smooth in later stage). Hence i am targeting adaptive streaming. But when I did that, I found that if GOP sizes were not consistent across each bitrates. What I mean by this is, for ex: if in Bitrate1 - GOP size is like 10, 20, 48 and so on, in other bitrates it wasnt in the same sequence. I hope my question makes sense.

So is there a way to ensure that GOP size may vary across one single output. But it should be consistent across each bitrate provided that the source is same?

Also for adaptive streaming Is scenecut detection advisable?

Tarun
  • 517
  • 4
  • 9
  • 24

1 Answers1

0

You are right on the point 1) and 2) BUT in your point 3) you say that you are changing bit-rate AND video resolution. In fact when using x264 for ABR, the only way to keep all encode using the same GOP structure is to (3 possibilities):

  • only change the bit rate, and it will be ok
  • use a 2-step approach, run an encode with --pass 1, at max resolution and bit-rate (faster I think ...) writing out a stats file, then re-use this stats file for all your different bitrates and resolution via --pass 3
  • disable the scene cut detection with --scenecut -1 and encode with fixed GOP.
alexbuisson
  • 7,699
  • 3
  • 31
  • 44