Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#9205 closed defect (duplicate)

Incorrect segment length in HLS child playlist with fmp4 segment format

Reported by: Yash Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: hls regression bounty
Cc: Steven Liu Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Yash)

Summary of the bug:

I am creating an HLS stream with two resolutions using NVIDIA x264 hardware encoder and FFmpeg is generating a segment with 0 bytes length after init segment in each video child playlist. An example of a child playlist is given below.
How to reproduce:

% ffmpeg -loglevel debug -vsync 0 -hwaccel cuvid -hwaccel_output_format cuda -c:v h264_cuvid -i wanted_1080p.mp4 -y -filter_complex "[0:v]hwdownload,format=nv12[0_v_cpu];[0_v_cpu]colorspace=irange=tv:range=tv:ispace=smpte170m:space=bt709:itrc=smpte170m:trc=bt709:iprimaries=smpte170m:primaries=bt709[init_processed];[init_processed]split=2[360p][720p];[360p]hwupload_cuda,scale_npp=640:360:interp_algo=lanczos[360pScaled];[720p]hwupload_cuda,scale_npp=1280:720:interp_algo=lanczos[720pScaled]" -hls_list_size 0 -hls_playlist_type vod -hls_flags single_file+independent_segments -hls_segment_type fmp4 -hls_segment_filename %v.mp4 -hls_time 2 -master_pl_name 1.m3u8 -preset:v slow -tune:v hq -qmin:v 0 -bf:v 3 -b_ref_mode:v 2 -temporal_aq:v 1 -i_qfactor:v 0.75 -b_qfactor:v 1.1 -color_primaries:v bt709 -color_trc:v bt709 -colorspace:v bt709 -color_range:v tv -g:v 48 -keyint_min:v 48 -forced-idr:v 1 -rc-lookahead:v 0 -no-scenecut:v 1 -map "[360pScaled]" -map "[720pScaled]" -map 0:a:0 -map 0:a:0 -c:v:0 h264_nvenc -c:v:1 h264_nvenc -b:v:0 1499k -b:v:1 2998k -maxrate:v:0 1499k -maxrate:v:1 2998k -bufsize:v:0 2998k -bufsize:v:1 5996k -c:a:0 aac -c:a:1 aac -b:a:0 96k -b:a:1 128k -var_stream_map "v:0,agroup:audio_96k,name:6088fbd10daf052b6b4770cb_0 v:1,agroup:audio_128k,name:6088fbd10daf052b6b4770cb_1 a:0,agroup:audio_96k,name:6088fbd10daf052b6b4770cb_en_96k,language:en a:1,agroup:audio_128k,name:6088fbd10daf052b6b4770cb_en_128k,language:en" -f hls %v.m3u8
ffmpeg version 4.4
built on ...
Ubuntu 20.04 5.8.0-50-generic
CUDA 11.1
Video Codec SDK version 11.0.10.
NVIDIA Driver Version: 460.73.01

6088fbd10daf052b6b4770cb_0.m3u8

#EXTM3U
#EXT-X-VERSION:7
#EXT-X-TARGETDURATION:2
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-MAP:URI="6088fbd10daf052b6b4770cb_0.mp4",BYTERANGE="450403@0"
#EXTINF:2.000000,
#EXT-X-BYTERANGE:0@450403
6088fbd10daf052b6b4770cb_0.mp4
#EXTINF:2.000000,
#EXT-X-BYTERANGE:359407@450403
6088fbd10daf052b6b4770cb_0.mp4

Truncated child playlist file, please find the whole file in the attachments.

Attachments (4)

debug.log (911.8 KB ) - added by Yash 4 years ago.
Debug log
6088fbd10daf052b6b4770cb_0.m3u8 (13.9 KB ) - added by Yash 4 years ago.
360p resolution child playlist
6088fbd10daf052b6b4770cb_1.m3u8 (14.0 KB ) - added by Yash 4 years ago.
720p resolution child playlist
git_head_debug.log (912.0 KB ) - added by Yash 4 years ago.
FFmpeg git head debug log

Download all attachments as: .zip

Change History (19)

by Yash, 4 years ago

Attachment: debug.log added

Debug log

by Yash, 4 years ago

360p resolution child playlist

by Yash, 4 years ago

720p resolution child playlist

comment:1 by Yash, 4 years ago

Description: modified (diff)

comment:2 by Carl Eugen Hoyos, 4 years ago

Keywords: hls added

Please test current FFmpeg git head and provide a log without -hide_banner to make this a valid ticket.

comment:3 by Yash, 4 years ago

Description: modified (diff)

by Yash, 4 years ago

Attachment: git_head_debug.log added

FFmpeg git head debug log

comment:4 by Yash, 4 years ago

removed '-hide_banner' and added FFmpeg git head command log in attachments.

comment:5 by Yash, 4 years ago

Also want to mention that the issue seems to be introduced in the 4.4 release, 4.3.2 doesn't have the issue and works perfectly fine (with the same video).

Last edited 4 years ago by Yash (previous) (diff)

comment:6 by Yash, 4 years ago

Summary: Incorrect segment length in HLS child playlistIncorrect segment length in HLS child playlist with fmp4 segment format

comment:7 by Jason, 4 years ago

This is likely the same bug and duplicate of this issue: https://trac.ffmpeg.org/ticket/9193

comment:10 by Yash, 4 years ago

Yes, reverting the mentioned commit resolves the issue.

comment:11 by Yash, 4 years ago

Resolution: fixed
Status: newclosed

comment:12 by Carl Eugen Hoyos, 4 years ago

Resolution: fixedduplicate

comment:14 by Carl Eugen Hoyos, 4 years ago

Keywords: regression added

comment:15 by nyanmisaka, 3 years ago

Hi Steven Liu, could you backport this patch to release/4.4 branch?

Note: See TracTickets for help on using tickets.