<p>Use</p>

<pre><code>ffmpeg -i INPUT -vcodec libx264 -g 2 -acodec copy -y out.mpg
</code></pre>

<hr>

<p>As per the x264 docs, <code>scenecut=0</code> disables scenecut evaluation.</p>

CC BY-SA 3.0
2017-01-31T16:55:27.503Z
Thanks for the quick answer. I tried it, but received the same result.
Ivan Kolesnikov
CC BY-SA 3.0
2017-01-31T16:59:31.930Z
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
CC BY-SA 3.0
2017-01-31T17:09:55.400Z
Much Appreciated!
Ivan Kolesnikov
CC BY-SA 3.0
2017-01-31T16:30:32.700Z
2017-01-31T16:30:32.700Z
Gyan
<p>I need to transcode mpeg2 video via H264 codec and GOP structure should be IP.
I use the following command for this:</p>

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

<p>Then checked it with ffprobe:</p>

<blockquote>
  <p>ffprobe -i out.mpg -show_frames | grep key_frame</p>
</blockquote>

<p>And received the following results:</p>

<blockquote>
  <p>key_frame=1 <br>key_frame=1 <br>key_frame=1 <br>key_frame=1 <br>key_frame=1<br>
  key_frame=1<br> key_frame=1<br> key_frame=1<br> key_frame=0<br> key_frame=1<br>
  key_frame=0 <br>key_frame=1<br> key_frame=0 <br>key_frame=1 <br>key_frame=0<br>
  key_frame=1<br> key_frame=0 <br>key_frame=1<br> key_frame=1<br> key_frame=1<br>
  key_frame=1 <br>key_frame=0 <br>key_frame=1<br> key_frame=1<br> key_frame=1<br>
  key_frame=1 <br>key_frame=1</p>
</blockquote>

<p>Can you please explain how to correct transcoding H264 and set GOP IP Pattern? </p>

<ffmpeg><transcoding><h.264><gop>
FFmpeg transcoding GOP pattern IP
Ivan Kolesnikov
# FFmpeg transcoding GOP pattern IP

(Asked by: username_0 on 2017-01-31)

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?

**Tags:** ffmpeg, transcoding, h.264, gop


---

## 1 answers

### Answer by username_1 on 2017-01-31. Score: 2 | Accepted answer

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


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

> **Comments:**
> **username_0**: Thanks for the quick answer. I tried it, but received the same result.  
> **username_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.  
> **username_0**: Much Appreciated!  

---

