0

I'm getting an invalid option result from avcodec_open2 in ffmpeg 3.1.6 with libopus 1.1.4. I've sorted through all the options and I cannot locate the offending option, I created a gist holding the relevant native code. I've searched all about the internet and cannot find anything helpful as of yet. I've also tried with and without the opts dictionary.

results = avcodec_open2(context, codec, &opts);

and

results = avcodec_open2(context, codec, 0);

All tests and variations return -22 (at line 51 in gist)

William Miller
  • 9,839
  • 3
  • 25
  • 46
Paul Gregoire
  • 9,715
  • 11
  • 67
  • 131

1 Answers1

1

memset(context, 0, sizeof(context));

That code needs to be removed. It will basically break everything. Specifically, it will unset all things set in avcodec_alloc_context3() based on the codec parameter, as well as more generally all codec-agnostic defaults.

(Note that it only zeroes the first 8 (on x86-64) bytes, since you used sizeof(context) instead of sizeof(*context)).

Ronald S. Bultje
  • 10,828
  • 26
  • 47