diff mbox series

[FFmpeg-devel] avformat/movenc: fix safari cannot play generated hls due to empty sdtp atom

Message ID 20231118102635.750620-1-wangyoucao577@gmail.com
State New
Headers show
Series [FFmpeg-devel] avformat/movenc: fix safari cannot play generated hls due to empty sdtp atom | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Jay Zhang Nov. 18, 2023, 10:26 a.m. UTC
This issue can be reproduced by command 'ffmpeg -i small_bunny_1080p_60fps.mp4 -an  -c:v libx265 -tag:v hvc1 -f hls -hls_segment_type fmp4  out.m3u8'. After remove the empty sdtp atom, safari can play the out.m3u8 properly.

Signed-off-by: Jay Zhang <wangyoucao577@gmail.com>
---
 libavformat/movenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jay Zhang Nov. 29, 2023, 12:19 a.m. UTC | #1
Hello,

    Is there any one can help to review this? Thanks!

On Sat, Nov 18, 2023 at 6:26 PM Jay Zhang <wangyoucao577@gmail.com> wrote:

> This issue can be reproduced by command 'ffmpeg -i
> small_bunny_1080p_60fps.mp4 -an  -c:v libx265 -tag:v hvc1 -f hls
> -hls_segment_type fmp4  out.m3u8'. After remove the empty sdtp atom, safari
> can play the out.m3u8 properly.
>
> Signed-off-by: Jay Zhang <wangyoucao577@gmail.com>
> ---
>  libavformat/movenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index e39f1ac987..34ac7e9dcc 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -2827,7 +2827,7 @@ static int mov_write_stbl_tag(AVFormatContext *s,
> AVIOContext *pb, MOVMuxContext
>           track->par->codec_tag == MKTAG('r','t','p',' ')) &&
>          track->has_keyframes && track->has_keyframes < track->entry)
>          mov_write_stss_tag(pb, track, MOV_SYNC_SAMPLE);
> -    if (track->par->codec_type == AVMEDIA_TYPE_VIDEO &&
> track->has_disposable)
> +    if (track->par->codec_type == AVMEDIA_TYPE_VIDEO &&
> track->has_disposable && track->entry)
>          mov_write_sdtp_tag(pb, track);
>      if (track->mode == MODE_MOV && track->flags & MOV_TRACK_STPS)
>          mov_write_stss_tag(pb, track, MOV_PARTIAL_SYNC_SAMPLE);
> --
> 2.34.1
>
>
diff mbox series

Patch

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index e39f1ac987..34ac7e9dcc 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2827,7 +2827,7 @@  static int mov_write_stbl_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext
          track->par->codec_tag == MKTAG('r','t','p',' ')) &&
         track->has_keyframes && track->has_keyframes < track->entry)
         mov_write_stss_tag(pb, track, MOV_SYNC_SAMPLE);
-    if (track->par->codec_type == AVMEDIA_TYPE_VIDEO && track->has_disposable)
+    if (track->par->codec_type == AVMEDIA_TYPE_VIDEO && track->has_disposable && track->entry)
         mov_write_sdtp_tag(pb, track);
     if (track->mode == MODE_MOV && track->flags & MOV_TRACK_STPS)
         mov_write_stss_tag(pb, track, MOV_PARTIAL_SYNC_SAMPLE);