Opened 18 months ago

Last modified 18 months ago

#10098 new defect

ffmpeg ignores -hls_time if -hls_init_time is set

Reported by: brunoais Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: hls
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
If you try to remux an mp4 file and you provide both -hls_time and -hls_init_time with different values, apparently -hls_time is ignored.

How to reproduce:

% ffmpeg -i "video.mp4"  -f hls -start_number 0 -hls_list_size 0 -hls_playlist 1 -hls_init_time 10 -hls_time 60 -strftime 1  -hls_flags second_level_segment_index -hls_segment_filename '%%03d.ts' -c copy -copyts -hls_playlist_type vod out.m3u8

ffmpeg version 5.1.1-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg


With my ~2:11:10 file:

If I use -hls_init_time 60 and -hls_time 60, it produces up to Opening '153.ts' for writing
If I use -hls_init_time 10 and -hls_time 60, it produces up to Opening '981.ts' for writing

I'd expect the first one to produce 153 files and the 2nd to produce 154 or 155 files.

Change History (5)

comment:1 by Steven Liu, 18 months ago

hls_init_time should be used in -hls_list_size > 0

https://patchwork.ffmpeg.org/project/ffmpeg/patch/20221209043736.29531-1-lq@chinaffmpeg.org/

Try this patch please.

Last edited 18 months ago by Steven Liu (previous) (diff)

in reply to:  1 ; comment:2 by brunoais, 18 months ago

Replying to Steven Liu:

hls_init_time should be used in -hls_list_size > 0

https://patchwork.ffmpeg.org/project/ffmpeg/patch/20221209043736.29531-1-lq@chinaffmpeg.org/

Try this patch please.

Thank you very much for such fast reply!

If I don't change any options, with this, hls_init_time is being ignored.

Should documentation be changed to clarify for non-native english speakers? If so I just don't use this option and take the performance optimization loss.

OR

Would it be feasible to change ffmpeg to support this option when -hls_list_size is 0?

in reply to:  2 ; comment:3 by Steven Liu, 18 months ago

Replying to brunoais:

Replying to Steven Liu:

hls_init_time should be used in -hls_list_size > 0

https://patchwork.ffmpeg.org/project/ffmpeg/patch/20221209043736.29531-1-lq@chinaffmpeg.org/

Try this patch please.

Thank you very much for such fast reply!

If I don't change any options, with this, hls_init_time is being ignored.

Should documentation be changed to clarify for non-native english speakers? If so I just don't use this option and take the performance optimization loss.

OR

Would it be feasible to change ffmpeg to support this option when -hls_list_size is 0?

The above patch is used for fix the problem.

in reply to:  3 comment:4 by brunoais, 18 months ago

Replying to Steven Liu:

The above patch is used for fix the problem.

Your answer is ambiguous to me. So I need clarification.

Do you mean:

  1. The above patch is to provide support for a different length for the first file using hls_init_time, even when running with -hls_list_size 0 and -hls_playlist_type vod?
  2. Don't let hls_init_time override hls_time?

It achieved the 2nd one, not the first one.

comment:5 by Carl Eugen Hoyos, 18 months ago

Component: undeterminedavformat
Keywords: hls added
Version: unspecifiedgit-master
Note: See TracTickets for help on using tickets.