How to set the H.264 GOP length in x264enc?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to set the H.264 GOP length in x264enc?

Andres Gonzalez
Hi,

I have been tasked to test some decoders regarding how they respond to
different streams with various  GOP lengths (GOP length is the ratio of
Intracoded-to-Predictive or I-to-P frames). I am using several pipelines
with the x264enc plugin and all seems to be working fine. But in reviewing
the properties for x264enc, it is not clear to me how to configure x264enc
so I can nail it down for various GOP lengths. There are a lot of properties
related to B frames but not too many for I/P frames.
 
Two x264enc properties:
ip-factor: Quantizer factor between I- and P- frames     This appears to
relate to quantizing and not a ratio; plus it is only in the range of 0-2
 
key-int-max: Maximal distance between two key-frames     Again, only deals
with the frequency of I frames regardless of what kind of frames come
between them.

So, how can I configure x264enc for various GOP lengths like 1, 15, or 30?

Thanks,
-Andres



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to set the H.264 GOP length in x264enc?

Krzysztof Konopko-3
On Tue, 2018-03-27 at 15:11 -0700, Andres Gonzalez wrote:

> Hi,
>
> I have been tasked to test some decoders regarding how they respond
> to
> different streams with various  GOP lengths (GOP length is the ratio
> of
> Intracoded-to-Predictive or I-to-P frames). I am using several
> pipelines
> with the x264enc plugin and all seems to be working fine. But in
> reviewing
> the properties for x264enc, it is not clear to me how to configure
> x264enc
> so I can nail it down for various GOP lengths. There are a lot of
> properties
> related to B frames but not too many for I/P frames.
>  
> Two x264enc properties:
> ip-factor: Quantizer factor between I- and P- frames     This appears
> to
> relate to quantizing and not a ratio; plus it is only in the range of
> 0-2
>  
> key-int-max: Maximal distance between two key-frames     Again, only
> deals
> with the frequency of I frames regardless of what kind of frames come
> between them.
>
> So, how can I configure x264enc for various GOP lengths like 1, 15,
> or 30?
>

I'm not sure if this is the best way of achieving this, but in my test
app I had a pad probe on a source element and sent an event with
`gst_video_event_new_downstream_force_key_unit()` whenever I needed an
I-frame (close a GOP).  This was also nice to test fancy cases with
variable GOP lengths.

Kris
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to set the H.264 GOP length in x264enc?

Jan Alexander Steffens
In reply to this post by Andres Gonzalez
On Wed, Mar 28, 2018 at 12:12 AM Andres Gonzalez <[hidden email]> wrote:
Hi,

I have been tasked to test some decoders regarding how they respond to
different streams with various  GOP lengths (GOP length is the ratio of
Intracoded-to-Predictive or I-to-P frames). I am using several pipelines
with the x264enc plugin and all seems to be working fine. But in reviewing
the properties for x264enc, it is not clear to me how to configure x264enc
so I can nail it down for various GOP lengths. There are a lot of properties
related to B frames but not too many for I/P frames.

Two x264enc properties:
ip-factor: Quantizer factor between I- and P- frames     This appears to
relate to quantizing and not a ratio; plus it is only in the range of 0-2

key-int-max: Maximal distance between two key-frames     Again, only deals
with the frequency of I frames regardless of what kind of frames come
between them.

So, how can I configure x264enc for various GOP lengths like 1, 15, or 30?

Thanks,
-Andres

If you disable scene detection using option-string="scenecut=0", key-int-max will be your I frame interval. So for a I-to-P+B ratio of 1:15, set key-int-max=16.

 

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to set the H.264 GOP length in x264enc?

Andres Gonzalez
Thanks for your responses guys, those are interesting ideas that I will check
out.
-Andres



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel