2014-12-11 125 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