[FFmpeg-user] execute2 access violation

Robert Nagy ronag89 at gmail.com
Sat Dec 3 12:18:15 CET 2011

I'm moving this from ffmpeg-devel.

>On Fri, Dec 02, 2011 at 11:59:40PM +0100, Robert Nagy wrote:
>> Could anyone explain why the following code gets an access violation
>> trying to encode DNXHD.

>You should give a backtrace. And generally more information.

I'm on Windows, and haven't managed to build ffmpeg and therefore I have no
backtrace. Also I avent found any debug symbols from the
http://ffmpeg.zeranoe.com/builds/ builds.

>And I have some doubts this belongs on the dev list instead of some of
>the user lists.


>>     int ret = avcodec_open(avctx, codec);
>>     avctx->execute = thread_execute;
>>     avctx->execute2 = thread_execute2;

>Tried overwriting only execute2 and setting it to

int default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2,
void *arg2, int jobnr, int threadnr),void *arg, int *ret, int count)
    int i;

    for(i=0; i<count; i++){
        int r= func(c, arg, i, 0);
        if(ret) ret[i]= r;
    return 0;

int tbb_avcodec_open(AVCodecContext* avctx, AVCodec* codec)
auto ret = avcodec_open(avctx, codec);
avctx->execute2 = default_execute2;
return ret;

Same problem, access violation on i==0;

However, if i do

avctx->execute2 = avcodec_default_execute2;

It works. Which makes no sense to me, since default_execute2 is a copy
pasted avcodec_default_execute2.

>Also you should possibly try compiling without pthreads
>(if that's what it is using, you didn't even say what system
>you run on),

See above

>mixing threading implementations was never really intended,
>only implementing a threaded execute when FFmpeg was built
>without threading support.

This is just a simplified example that shows the problem.
I have successfully replaced execute and execute2  for decoding.
However, the dnxhd encoding doesn't seem to like something?

More information about the ffmpeg-user mailing list