2014-12-11 127 views
1

我想通过FFMPEG C++ SDK设置x264编码设置, 我该如何设置它?C++ ffmpeg x264编码设置

现在,我使用av_opt_set函数,但它似乎不起作用。 (例如av_opt_set(c->priv_data, "cabac", "0", 0);

我想设置下面的设置。

cabac=1 ref=1 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 G...fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=1 keyint_minG...=1 scenecut=40 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 

有人知道吗?

回答

3

You're making the exact same mistake as this guy。我的答案与此处的答案相同:

请勿将c->priv_data传递给av_opt_set。通过上下文。如:

av_opt_set(c, "cabac", "0", 0); 

内部,av_opt_setwill cast the object to an AVClass*这是what holds all the options

但是你不必担心这一点。你只需要在上下文中调用av_opt_set,它将为你处理所有肮脏的细节。再说一遍,只需要拨打av_opt_set(c, "cabac", "0", 0);即可。

+1

哦,你救了我的一天!顺便说一句,为什么示例代码通过'c-> priv_data'而不是上下文? – Andy 2014-12-11 03:46:27

+1

@安迪:很高兴帮助!哪个示例代码? – Cornstalks 2014-12-11 04:16:11

+1

我从FFmpeg引用这个[document](https://www.ffmpeg.org/doxygen/trunk/decoding_encoding_8c-example.html)。 – Andy 2014-12-11 05:06:59