Thanks Kirili >The best way is to COPY packets to own thread-safe sequences (each sequence >per decoding thread). >I do that in my own application (one thread for reading packets, one thread >for decoding audio and two streams to decode the video) >and did not detect any thread errors in the FFmpeg itself.
I one thread I decode H264 by while ( av_read_frame(ic, pkt) >=0 ) { if(pkt->stream_index==video_stream) { AVFrame* tempFrame ; tempFrame = avcodec_alloc_frame(); avcodec_decode_video2(video_st->codec, tempFrame, &frameFinished, pkt); // error if(frameFinished) { av_picture_copy((AVPicture*)VideoBufLast->pFrame, (AVPicture*)tempFrame,video_st->codec->pix_fmt, video_st->codec->width, video_st->codec->height) etc And the other Thread use avcodec_decode_video2 too on mgeg2 but I got decode error in the while decoding MB 109 22 in the line //error I suspect I got the error because avcodec_decode_video2/mpeg2 How do you to COPY packets to own thread-safe sequences (each sequence per decoding thread) ? Regards Gilles -- View this message in context: http://libav-users.943685.n4.nabble.com/avcodec-decode-video2-in-several-Thread-tp3260222p3276289.html Sent from the libav-users mailing list archive at Nabble.com. _______________________________________________ libav-user mailing list libav-user@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/libav-user