[FFmpeg-user] HLS Streaming - FFMPEG: Program date time of older segment also changing in playlist.m3u8 when re-streaming after discontinuity.
Vignesh Ravichandran
vignesh.ravichandran02 at gmail.com
Fri Nov 13 08:43:56 EET 2020
andrei ka wrote
> you mean the names of segments are the same, not "program time"... would
> make sense to me if the idea was related to kicking the last couple of ts
> out from caches (you may need to read src code for understanding why it's
> happening)... what if you delete all m3u8 before restart... ?
>
> &rei
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user@
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request@
> with subject "unsubscribe".
*Did some digging into the code base and found the below behavior:*
1. The initial_prog_date_time gets set to the current local time
2. The existing playlist (.m3u8) file gets parsed and the segments present
are added to the variant stream
3. The new segment is created and added to the variant stream
4. The existing segments and the new segment are written to the playlist
file.
The initial_prog_date_time from point 1 is used for calculating
"#EXT-X-PROGRAM-DATE-TIME" for the segments,
which results in incorrect "#EXT-X-PROGRAM-DATE-TIME" values for existing
segments
*Contents of playlist file (.m3u8) used for debugging:*
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:4
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-DISCONTINUITY
#EXTINF:4.000000,
#EXT-X-PROGRAM-DATE-TIME:2020-11-12T19:31:50.104+0530
20201112T193150+0530.ts
#EXTINF:4.000000,
#EXT-X-PROGRAM-DATE-TIME:2020-11-12T19:31:54.104+0530
20201112T193154+0530.ts
#EXTINF:0.900000,
#EXT-X-PROGRAM-DATE-TIME:2020-11-12T19:31:58.104+0530
20201112T193158+0530.ts
#EXT-X-ENDLIST
*Logs (Added more logs to hlsenc.c and hlsplaylist.c to produce the below):*
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_videotoolbox))
Press [q] to stop, [?] for help
[hls muxer @ 0x7fd19e80b200] parse_playlist(): Parsing
20201112T193150+0530.ts
[hls muxer @ 0x7fd19e80b200] parse_playlist(): Parsing
20201112T193154+0530.ts
[hls muxer @ 0x7fd19e80b200] parse_playlist(): Parsing
20201112T193158+0530.ts
[hls muxer @ 0x7fd19e80b200] parse_playlist(): Initial program date time:
1605247848.848017 *// This Epoch second is equal to
2020-11-13T11:40:48.848+0530*
[hls muxer @ 0x7fd19e80b200] parse_playlist(): Parsing complete. 3 segments
added to vs->segments
Output #0, hls, to 'playlist.m3u8':
Metadata:
encoder : Lavf58.64.100
Stream #0:0: Video: h264 (h264_videotoolbox), yuv420p(tv, progressive),
1280x720, q=2-31, 200 kb/s, 30 fps, 90k tbn, 30 tbc
Metadata:
encoder : Lavc58.112.102 h264_videotoolbox
[hls @ 0x7fd19e81c000] Opening '20201113T114057+0530.ts' for writing=72
drop=0 speed=0.974x
[hls @ 0x7fd19e81c000] Opening 'playlist.m3u8.tmp' for writing
ff_hls_write_file_entry(): Writing 20201112T193150+0530.ts with
program_datetime 2020-11-13T11:40:48.848+0530
ff_hls_write_file_entry(): Writing 20201112T193154+0530.ts with
program_datetime 2020-11-13T11:40:52.848+0530
ff_hls_write_file_entry(): Writing 20201112T193158+0530.ts with
program_datetime 2020-11-13T11:40:56.848+0530
ff_hls_write_file_entry(): Writing 20201113T114057+0530.ts with
program_datetime 2020-11-13T11:40:57.748+0530
[hls @ 0x7fd19e81c000] Opening '20201113T114101+0530.ts' for writing=146
drop=0 speed=0.984x
[hls @ 0x7fd19e81c000] Opening 'playlist.m3u8.tmp' for writing
ff_hls_write_file_entry(): Writing 20201112T193150+0530.ts with
program_datetime 2020-11-13T11:40:48.848+0530
ff_hls_write_file_entry(): Writing 20201112T193154+0530.ts with
program_datetime 2020-11-13T11:40:52.848+0530
ff_hls_write_file_entry(): Writing 20201112T193158+0530.ts with
program_datetime 2020-11-13T11:40:56.848+0530
ff_hls_write_file_entry(): Writing 20201113T114057+0530.ts with
program_datetime 2020-11-13T11:40:57.748+0530
ff_hls_write_file_entry(): Writing 20201113T114101+0530.ts with
program_datetime 2020-11-13T11:41:01.748+0530
[hls @ 0x7fd19e81c000] Opening '20201113T114105+0530.ts' for writing=155
drop=0 speed=0.984x
[hls @ 0x7fd19e81c000] Opening 'playlist.m3u8.tmp' for writing
ff_hls_write_file_entry(): Writing 20201112T193150+0530.ts with
program_datetime 2020-11-13T11:40:48.848+0530
ff_hls_write_file_entry(): Writing 20201112T193154+0530.ts with
program_datetime 2020-11-13T11:40:52.848+0530
ff_hls_write_file_entry(): Writing 20201112T193158+0530.ts with
program_datetime 2020-11-13T11:40:56.848+0530
ff_hls_write_file_entry(): Writing 20201113T114057+0530.ts with
program_datetime 2020-11-13T11:40:57.748+0530
ff_hls_write_file_entry(): Writing 20201113T114101+0530.ts with
program_datetime 2020-11-13T11:41:01.748+0530
ff_hls_write_file_entry(): Writing 20201113T114105+0530.ts with
program_datetime 2020-11-13T11:41:05.748+0530
frame= 264 fps= 30 q=-0.0 Lsize=N/A time=00:00:08.80 bitrate=N/A dup=159
drop=0 speed=1.01x
video:222kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown
Hope this helps
-----
Vignesh
--
Sent from: http://www.ffmpeg-archive.org/
More information about the ffmpeg-user
mailing list