stream.m3u8 中没有 #EXT-X-ENDLIST

stream.m3u8 中没有 #EXT-X-ENDLIST

有一个持续时间为 60 秒的 ts 文件,并且此部分配置为rtsp-简单服务器

...
  ~archive/(.*)$:
    runOnDemand: ffmpeg -re -stream_loop 0 -i /cameras/$G1 -c copy -f rtsp rtsp://localhost:$RTSP_PORT/$RTSP_PATH
    runOnDemandStartTimeout: 10s

  archive-1151:
    runOnInit: ffmpeg -v warning -rtsp_transport tcp -i rtsp://*** -c copy -f segment -strftime 1 -segment_time 3600 -segment_format mpegts /cameras/1151/saved_%Y-%m-%d_%H-%M-%S.ts
...

玩家在 index.m3u8 中收到以下信息:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-INDEPENDENT-SEGMENTS

#EXT-X-STREAM-INF:BANDWIDTH=200000,CODECS="avc1.4d0016"
stream.m3u8

在 stream.m3u8 中:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-ALLOW-CACHE:NO
#EXT-X-TARGETDURATION:4
#EXT-X-MEDIA-SEQUENCE:0

#EXT-X-PROGRAM-DATE-TIME:2022-09-14T15:39:34.159Z
#EXTINF:4,
1663169974.ts

虽然我们正在流式传输具有确定持续时间的文件,但事实并非如此#EXT-X-ENDLIST。因此,播放器不会显示进度条,即无法快进或倒带视频。这只是一个实时流。

正如我们在下面看到的,输入流具有持续时间:

rtsp-server_1  | 2022/09/14 15:51:47 INF [HLS] [muxer archive/1151/saved_2022-09-14_14-09-14.ts] created (requested by 127.0.0.1)
rtsp-server_1  | 2022/09/14 15:51:47 INF [path archive/1151/saved_2022-09-14_14-09-14.ts] runOnDemand command started
rtsp-server_1  | ffmpeg version 5.0.1 Copyright (c) 2000-2022 the FFmpeg developers
rtsp-server_1  |   built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219
rtsp-server_1  |   configuration: --prefix=/usr --enable-avfilter --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libpulse --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-libdav1d --enable-lto --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --enable-librist --enable-libsrt --enable-libssh --enable-libvidstab --disable-stripping --disable-static --disable-librtmp --enable-libaom --enable-libopus --enable-libsoxr --enable-libwebp --enable-vaapi --enable-vdpau --enable-vulkan --enable-libdrm --disable-debug
rtsp-server_1  |   libavutil      57. 17.100 / 57. 17.100
rtsp-server_1  |   libavcodec     59. 18.100 / 59. 18.100
rtsp-server_1  |   libavformat    59. 16.100 / 59. 16.100
rtsp-server_1  |   libavdevice    59.  4.100 / 59.  4.100
rtsp-server_1  |   libavfilter     8. 24.100 /  8. 24.100
rtsp-server_1  |   libswscale      6.  4.100 /  6.  4.100
rtsp-server_1  |   libswresample   4.  3.100 /  4.  3.100
rtsp-server_1  |   libpostproc    56.  3.100 / 56.  3.100
rtsp-server_1  | Input #0, mpegts, from '/cameras/1151/saved_2022-09-14_14-09-14.ts':
rtsp-server_1  |   Duration: 00:01:00.00, start: 301.400000, bitrate: 15 kb/s
rtsp-server_1  |   Program 1
rtsp-server_1  |     Metadata:
rtsp-server_1  |       service_name    : Media Presentation
rtsp-server_1  |       service_provider: FFmpeg
rtsp-server_1  |   Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuvj420p(pc, bt709, progressive), 640x360, 1 fps, 1 tbr, 90k tbn
rtsp-server_1  | 2022/09/14 15:51:47 INF [RTSP] [conn 127.0.0.1:60454] opened
rtsp-server_1  | 2022/09/14 15:51:47 INF [RTSP] [session 822864230] created by 127.0.0.1:60454
rtsp-server_1  | 2022/09/14 15:51:47 INF [RTSP] [session 822864230] is publishing to path 'archive/1151/saved_2022-09-14_14-09-14.ts', with UDP, 1 track (H264)
rtsp-server_1  | 2022/09/14 15:51:47 INF [HLS] [muxer archive/1151/saved_2022-09-14_14-09-14.ts] is converting into HLS, 1 track (H264)
rtsp-server_1  | Output #0, rtsp, to 'rtsp://localhost:8554/archive/1151/saved_2022-09-14_14-09-14.ts':
rtsp-server_1  |   Metadata:
rtsp-server_1  |     encoder         : Lavf59.16.100
rtsp-server_1  |   Stream #0:0: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuvj420p(pc, bt709, progressive), 640x360, q=2-31, 1 fps, 1 tbr, 90k tbn
rtsp-server_1  | Stream mapping:
rtsp-server_1  |   Stream #0:0 -> #0:0 (copy)
rtsp-server_1  | Press [q] to stop, [?] for help

如何#EXT-X-ENDLIST向 stream.m3u8 添加标签/元素?

相关内容