1

I want to set the x264 encoding settings via FFMPEG C++ SDK, how can I set it?

Now, I use the av_opt_set function but it seems not work. (ex. av_opt_set(c->priv_data, "cabac", "0", 0);)

I want to set the settings in below.

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

Does anybody know?

Andy
  • 407
  • 2
  • 14
  • 30

1 Answers1

4

You're making the exact same mistake as this guy. And my answer is the same here as it was there:

Don't pass c->priv_data to av_opt_set. Pass the context. As in:

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

Internally, av_opt_set will cast the object to an AVClass* which is what holds all the options.

But you don't have to worry about any of that. You just need to call av_opt_set with the context, and it will handle all the dirty details for you. Again, just to be clear, you should just be calling av_opt_set(c, "cabac", "0", 0);.

Community
  • 1
  • 1
Cornstalks
  • 37,137
  • 18
  • 79
  • 144