[FFmpeg-devel] [PATCH] hlsenc: Only write PAT/PMT once per segment

Michael Niedermayer michael at niedermayer.cc
Mon Nov 2 00:55:16 CET 2015


On Sun, Nov 01, 2015 at 05:34:38PM +0000, Derek Buitenhuis wrote:
> This saves a lot of muxing overhead, especially on lower bitrate
> segments.
> 
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> ---
>  libavformat/hlsenc.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 8daf53f..d7884e5 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -560,8 +560,16 @@ static int hls_start(AVFormatContext *s)
>      }
>      av_dict_free(&options);
>  
> -    if (oc->oformat->priv_class && oc->priv_data)
> +    /* We only require one PAT/PMT per segment. */
> +    if (oc->oformat->priv_class && oc->priv_data) {
> +        char period[21];
> +
> +        snprintf(period, sizeof(period), "%d", (INT_MAX / 2) - 1);
> +
>          av_opt_set(oc->priv_data, "mpegts_flags", "resend_headers", 0);
> +        av_opt_set(oc->priv_data, "sdt_period", period, 0);
> +        av_opt_set(oc->priv_data, "pat_period", period, 0);

should be ok if tested with some hls player

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is what and why we do it that matters, not just one of them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151102/68ab50e7/attachment.sig>


More information about the ffmpeg-devel mailing list