Hello,
Do I need to do any other things to get this patch accepted?
Best Regards,
Somsak
soms...@gmail.com
On Fri, Apr 20, 2018 at 5:05 PM, Somsak Sriprayoonsakul
wrote:
> (Sorry for spamming, forgot the sign off part)
>
> This patch make ffmpeg able to create a single HLS m3u8 with different
> duration in the same manifest for VOD playlist ype.
>
> This has benefit on optimizing HLS stream to start faster, having
> initially shorter duration. The later part of the
> stream could have longer duration, which lower server load (less number
> of files, less
> connection initiation needed on server side which is very significant in
> this HTTPS era).
>
> The similar capability was already exists in ffmpeg hlsenc.c, but only
> for
> live playlist. I just fix it a little bit to make it support VOD
> playlist..
>
> To create such VOD stream
>
> ffmpeg -i input -c:v libx264 -c:a aac \
> -hls_init_time 2 -hls_time 8 \
> -hls_list_size 5 -hls_playlist_type vod \
> -f hls output_vod.m3u8
>
> VOD playlist will use hls_list_size as the intended number of chunk to
> use the hls_init_time.
>
> Signed-off-by: Somsak Sriprayoonsakul
> ---
> libavformat/hlsenc.c | 30 --
> 1 file changed, 16 insertions(+), 14 deletions(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index c27a66ea79..b6260b262d 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -1026,26 +1026,28 @@ static int hls_append_segment(struct
> AVFormatContext *s, HLSContext *hls,
>
> vs->last_segment = en;
>
> -// EVENT or VOD playlists imply sliding window cannot be used
> -if (hls->pl_type != PLAYLIST_TYPE_NONE)
> +// EVENT playlists imply sliding window cannot be used
> +if ( (hls->pl_type == PLAYLIST_TYPE_EVENT) || (hls->pl_type ==
> PLAYLIST_TYPE_NB) )
> hls->max_nb_segments = 0;
>
> if (hls->max_nb_segments && vs->nb_entries >= hls->max_nb_segments) {
> -en = vs->segments;
> -vs->initial_prog_date_time += en->duration;
> -vs->segments = en->next;
> -if (en && hls->flags & HLS_DELETE_SEGMENTS &&
> +if( hls->pl_type != PLAYLIST_TYPE_VOD ) {
> +en = vs->segments;
> +vs->initial_prog_date_time += en->duration;
> +vs->segments = en->next;
> +if (en && hls->flags & HLS_DELETE_SEGMENTS &&
> #if FF_API_HLS_WRAP
> -!(hls->flags & HLS_SINGLE_FILE || hls->wrap)) {
> +!(hls->flags & HLS_SINGLE_FILE || hls->wrap)) {
> #else
> -!(hls->flags & HLS_SINGLE_FILE)) {
> +!(hls->flags & HLS_SINGLE_FILE)) {
> #endif
> -en->next = vs->old_segments;
> -vs->old_segments = en;
> -if ((ret = hls_delete_old_segments(s, hls, vs)) < 0)
> -return ret;
> -} else
> -av_free(en);
> +en->next = vs->old_segments;
> +vs->old_segments = en;
> +if ((ret = hls_delete_old_segments(s, hls, vs)) < 0)
> +return ret;
> +} else
> +av_free(en);
> +}
> } else
> vs->nb_entries++;
>
> --
> 2.14.1
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel