0

I transcoding mpeg2 data to h264 via libx264 codec and need to create the following GOP structure:

I(IDR) P I P

I try to perform it with the following command:

ffmpeg -i INPUT -vcodec libx264 -g 4 -bf 0 -refs 1 -acodec copy OUT.mpg

Check results via ffprobe:

ffprobe -i OUT.mpg -show_entries frame=key_frame,pict_type -select_streams v -of compact=p=0

And received the following output:

key_frame=1|pict_type=I
key_frame=0|pict_type=P
key_frame=0|pict_type=P
key_frame=0|pict_type=P

As you can see the GOP structure is:

I(IDR) P P P

I think -refs 1 key has no effect.
Please explain how correct transcode it to necessary GOP I(IDR)PIP ?

  • 1
    You may have to use x264 standalone encoder with qpfile option. – Gyan Feb 1 '17 at 11:24
  • 1
    -refs 1 means use (at most) 1 reference frame. P frames can reference P frames, so it will not affect GOP structure. You do set the GOP structure to 4 -g 4 and get a 4 frame GOP. So I'm not sure if i"m understanding the issue since -g 2 should be obvious. – SlimSCSI Feb 1 '17 at 17:07
  • Thanks to All for answers and explanations. But with -g 2. All I-frames will be IDR and we will receive I(IDR) P structure, but necessary structure is I(IDR) P I P. The third I-frame shouldn't be IDR. – Ivan Kolesnikov Feb 1 '17 at 20:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.