<div dir="ltr">Hi,<br><br>I am trying to simulate two-pass encoding using FFmpeg libraries. Code I have so far is working fine for h264 codec, now I want it to work also for VP8. Normal encoding (i.e. single pass) works fine, both for mp4, and webm; but the changes in code for two pass works only for mp4s. I have tried to tally code from ffmpeg.c file, and add it up in my encoding routines.<br>
<br>Looking closer at different locations, developer logs, etc., I have come down to following possibilities:<br><br>- 'stats_out' buffer is never allocated (though documentation says it is allocated automatically for encoding)<br>
- avcodec_encode_video2(c, &pkt, frame, &got_output) never sets 'got_output' for first pass<br><br>Necessary bits of code:<br><br><a href="https://gist.github.com/anonymous/3e01cfdeb64fd577cc48">https://gist.github.com/anonymous/3e01cfdeb64fd577cc48</a><br>
<br>In above code, for CODEC_FLAG_PASS1, stats file is created, but stats_out is always NULL, and avcodec_encode_video2() never sets got_output, so code under it is never executed.<br><br>Apparently I have missed out something, but cannot understand what, exactly. Can anyone guide me towards my mistake?<br>
<br>Thanks!<br></div>