0

I need to transcode mpeg2 video via H264 codec and GOP structure should be IP. I use the following command for this:

ffmpeg -i INPUT -vcodec libx264 -x264-params keyint=2:scenecut=-1:ref=1 -acodec copy -y out.mpg

Then checked it with ffprobe:

ffprobe -i out.mpg -show_frames | grep key_frame

And received the following results:

key_frame=1
key_frame=1
key_frame=1
key_frame=1
key_frame=1
key_frame=1
key_frame=1
key_frame=1
key_frame=0
key_frame=1
key_frame=0
key_frame=1
key_frame=0
key_frame=1
key_frame=0
key_frame=1
key_frame=0
key_frame=1
key_frame=1
key_frame=1
key_frame=1
key_frame=0
key_frame=1
key_frame=1
key_frame=1
key_frame=1
key_frame=1

Can you please explain how to correct transcoding H264 and set GOP IP Pattern?

1 Answer 1

2

Use

ffmpeg -i INPUT -vcodec libx264 -g 2 -acodec copy -y out.mpg

As per the x264 docs, scenecut=0 disables scenecut evaluation.

3
  • Thanks for the quick answer. I tried it, but received the same result. Jan 31, 2017 at 16:55
  • 1
    Works here. Run ffprobe out.mpg -show_entries frame=key_frame -select_streams v -of compact=p=0. Audio frames are also reported in your command.
    – Gyan
    Jan 31, 2017 at 16:59
  • Much Appreciated! Jan 31, 2017 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.