[FFmpeg-devel] Avoid MPEG-TS 1-cycle delay
Paolo Pr
paolopr976 at gmail.com
Wed Mar 27 15:50:49 EET 2019
Hello,
looking at the code of libavformat/mpegtsenc.c I experienced a 1-cycle
delay with the mpegts muxer that could be avoided (at least for Opus codec)
by putting the following lines:
( https://ffmpeg.org/doxygen/4.1/mpegtsenc_8c_source.html#l01777 )
memcpy(ts_st->payload + ts_st->payload_size, buf, size);
ts_st->payload_size += size;
ts_st->opus_queued_samples += opus_samples;
... just above this line (
https://ffmpeg.org/doxygen/4.1/mpegtsenc_8c_source.html#l01734 ):
if (pkt->dts != AV_NOPTS_VALUE) {
Otherwise, at the first muxing cycle, none of the blocks with
mpegts_write_pes() function is executed.
I did not write a patch for that because I don't know if it works with
other codecs as well and I'm not sure if there could be other consequent
issues, but given that Opus can be used with low-latency, it would be good
to consider this.
More information about the ffmpeg-devel
mailing list