Opened 3 years ago

Closed 13 months ago

#9321 closed defect (invalid)

Wrong HLS segment duration on playlist rotation

Reported by: ohmerci Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: hls segment duration
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

Trying to output a HLS live stream with fixed segment duration (10s in this case).

video segmentation issue: when hls_list_size is reached, instead of a 10s video segment a 2s and 8s video segment are generated (durations of the parts is dependent on GOP length and hls_time value), and added to the video manifest.
After which output continues with 10s segments as expected.

Intitial full-lenght manifest:

#EXTM3U
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:2
#EXT-X-INDEPENDENT-SEGMENTS
#EXTINF:10,
#EXT-X-PROGRAM-DATE-TIME:2021-07-07T14:25:39.502+0200
video_2.ts
#EXTINF:10,
#EXT-X-PROGRAM-DATE-TIME:2021-07-07T14:25:49.502+0200
video_3.ts
#EXTINF:10,
#EXT-X-PROGRAM-DATE-TIME:2021-07-07T14:25:59.502+0200
video_4.ts
#EXTINF:10,
#EXT-X-PROGRAM-DATE-TIME:2021-07-07T14:26:09.502+0200
video_5.ts
#EXTINF:2,
#EXT-X-PROGRAM-DATE-TIME:2021-07-07T14:26:19.502+0200
video_6.ts

Next, the manifest file rotates for a first time and a 8s segment is added

#EXTINF:8,
#EXT-X-PROGRAM-DATE-TIME:2021-07-07T14:26:21.502+0200
video_7.ts

Next, 10s are generated and added to the manifest file again

#EXTINF:10,
#EXT-X-PROGRAM-DATE-TIME:2021-07-07T14:26:29.502+0200
video_8.ts

audio segmentation issue: when hls_list_size is reached a 0s audio segment is generated and added to the audio manifest file.

#EXTINF:0,
#EXT-X-PROGRAM-DATE-TIME:2021-07-07T14:28:54.484+0200
eng_audio_6.ts

Forcing 10s GOP -g:v 250 (and remove keyint=50:min-keyint=50:no-scenecut) , fixes the splitted video segment, but doesn't fix the 0s audio segment.


How to reproduce:

ffmpeg -re -fflags +genpts -i /data/str02/pseudo_src/devmul/ott-en-us.mp4 -map 0 -c:v libx264 -x264opts "keyint=50:min-keyint=50:no-scenecut" -b:v 2M -g:v 50 -r:v 25 -c:a aac -b:a 128k -f hls -hls_delete_threshold 20 -hls_segment_filename "hlsdir/%v_%d.ts" -hls_time 10 -hls_init_time 10 -hls_list_size 5 -master_pl_name master.m3u8 -var_stream_map "a:0,name:eng_audio,agroup:audio,language:ENG,default:YES v:0,name:video,agroup:audio" -hls_flags independent_segments+program_date_time+round_durations "hlsdir/%v.m3u8"

ffmpeg version:

ffmpeg version N-102852-g758e2da289 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --prefix=/data/local/home/ramdata/ffmpeg-master --enable-gpl --enable-version3 --enable-nonfree --enable-openssl --enable-postproc --enable-avfilter --enable-pthreads --enable-filter=movie --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libx264 --enable-libfdk-aac

Change History (1)

comment:1 by ohmerci, 13 months ago

Resolution: invalid
Status: newclosed

The changing segment duration during rotation is to be expected when using the hls_init_time parameter.

Note: See TracTickets for help on using tickets.