【GStreamer】在x264enc中设置profile级别

Serwa ·
更新时间:2024-09-20
· 622 次阅读

1、问题描述

在使用GStreamer生成h.264的rtmp流时,不知道怎么设置h.264的profile级别。默认一直是“hige”:

video/x-h264, ... profile=(string)high, ... 2、解决方法

查看官网手册中,有如下解释
The H264 profile that is eventually used depends on a few settings. If “dct8x8” is enabled, then High profile is used. Otherwise, if “cabac” entropy coding is enabled or “bframes” are allowed, then Main Profile is in effect, and otherwise Baseline profile applies. The high profile is imposed by default, which is fine for most software players and settings, but in some cases (e.g. hardware platforms) a more restricted profile/level may be necessary. The recommended way to set a profile is to set it in the downstream caps.
意思是h264的profile级别是由一些设置决定的。默认是high配置。
dct8x8 设置为false,可以将profile级别由 hige 降为 main。使用如下方法:

g_object_set(G_OBJECT(m_data.h264enc),"dct8x8", false,NULL);

打印结果:

video/x-h264, ... profile=(string)main, ...

但是安装手册说明,使用如下设置,将profile设置为baseline时,没有成功.

g_object_set(G_OBJECT(m_data.h264enc),"cabac", false,NULL); g_object_set(G_OBJECT(m_data.h264enc),"dct8x8", false,NULL); g_object_set(G_OBJECT(m_data.h264enc),"bframes", 0,NULL);
作者:郭老二



x2 gstreamer

需要 登录 后方可回复, 如果你还没有账号请 注册新账号