[FFmpeg-devel] [libav-devel] mpegts encoder not interleaving audio/video packets well

Mike Scheutzow mike.scheutzow at alcatel-lucent.com
Mon Jun 27 19:41:35 CEST 2011


Tony Strauss wrote:
> +    /*
> +     * Flush the audio packets once we've amassed a full PES payload or
> +     * once the stream has moved a certain amount of time past the first
> audio
> +     * packet in the buffer.
> +     */
> +    if ((ts_st->payload_index + size > DEFAULT_PES_PAYLOAD_SIZE) ||
> +        ((ts_st->payload_index > 0) && (dts - ts_st->payload_dts >
> max_delay))) {
> +        mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_index,
> +                         ts_st->payload_pts, ts_st->payload_dts);
> +        ts_st->payload_index = 0;
> +    }
> +
>      if (st->codec->codec_type != AVMEDIA_TYPE_AUDIO) {
>          // for video and subtitle, write a single pes packet
>          mpegts_write_pes(s, st, buf, size, pts, dts);


This implementation won't send the accumulated audio packet(s) until a 
newer audio packet is written.

This means the delay might be much longer than max_delay. Is that what 
you want?


Mike Scheutzow



More information about the ffmpeg-devel mailing list