Thank you for this information that I'll keep in mind. However the issue was in the way I set the pts and dts of frames: av_rescale_q_rnd(orig_pkt.pts, in_stream->time_base, out_stream->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
Using the av_packet_rescale_ts() function instead solved the problem but I don't understand why it works better than the previous way of managing timestamps. I still have some issues with some of input videos (all video frames plays in a snap, sound is OK). I assume it is because of the way timestamps (or no timestampsat all) are set in the original vid. Thank you again, François-Xavier Talgorn. Le 18 juin 2015 à 08:07, Carl Eugen Hoyos <[email protected]> a écrit : > Mohamed Moanis <mohamed_moanis@...> writes: > >> The problem is that avcodec_encode_video2 produce >> delayed frames. I am expecting to give it a frame >> and take a frame back as a result >> So my question is basically, is there a way to to >> turn around the flushing and the delay. > > The delay is unavoidable with the default settings > (b-frames). There should be no delay with b-frames > turned off. > > Carl Eugen > _______________________________________________ > Libav-user mailing list > [email protected] > http://ffmpeg.org/mailman/listinfo/libav-user _______________________________________________ Libav-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/libav-user
