Open samleoqh opened 7 years ago
test 2 solutions 1) remove the "zerolatency" setting of "tune", call av_opt_set() 2) or set thread = 1, prevent multi thread, ctx->thread_count=1
also try to call avcodec_flush_buffers(vidCodeCtx) before encode, seemed not work.
useful link: http://stackoverflow.com/questions/33624016/why-sliced-thread-affect-so-much-on-realtime-encoding-using-ffmpeg-x264 i just guess it's the thread conflict caused the stuck inside avcodec_encode_video2(),
when i fix the thread_count =1, no stuck happened, but the encoding speed become lower
static int x264_param_apply_tune( x264_param_t param, const char tune ) { ....
else if( !strncasecmp( s, "zerolatency", 11 ) )//关闭b帧
{
param->rc.i_lookahead = 0;
param->i_sync_lookahead = 0;
param->i_bframe = 0; // 关闭b帧
param->b_sliced_threads = 1; // 限制slice thread
param->b_vfr_input = 0;
param->rc.b_mb_tree = 0;
}
}
during encoding frame, when calling coding avcodec_encode_video2() , it hangs sometimes / freezed at random position (#500 to #30000 frame), not every time, no any regulation, just stop there not any return, stuck this function call. win10 64bit, ffmpeg latest version