https://datatracker.ietf.org/doc/html/rfc8216#page-31
Signed-off-by: Arzet Ro <arze...@gmail.com> --- libavformat/hlsplaylist.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/libavformat/hlsplaylist.c b/libavformat/hlsplaylist.c index 0e1dcc087f..c3ec86f2ab 100644 --- a/libavformat/hlsplaylist.c +++ b/libavformat/hlsplaylist.c @@ -81,9 +81,32 @@ void ff_hls_write_stream_info(AVStream *st, AVIOContext *out, int bandwidth, } avio_printf(out, "#EXT-X-STREAM-INF:BANDWIDTH=%d", bandwidth); - if (st && st->codecpar->width > 0 && st->codecpar->height > 0) + if (st && st->codecpar->width > 0 && st->codecpar->height > 0) { avio_printf(out, ",RESOLUTION=%dx%d", st->codecpar->width, st->codecpar->height); + if (st->avg_frame_rate.num > 0) { + // In an ideal world #EXT-X-VERSION should be >=7 if we want FRAME-RATE + // according to + // https://developer.apple.com/documentation/http_live_streaming/about_the_ext-x-version_tag + // But we can ignore that because: + // https://datatracker.ietf.org/doc/html/rfc8216#section-6.3.1 + // "To support forward compatibility, when parsing Playlists, + // clients MUST ignore any attribute/value pair + // with an unrecognized AttributeName.". + + + // https://datatracker.ietf.org/doc/html/rfc8216#page-31 + // "The value is a decimal-floating-point describing the maximum frame + // rate for all the video in the Variant Stream, rounded to three + // decimal places." + + // Also, iOS and tvOS refuse to play the content if VIDEO-RANGE is + // present but FRAME-RATE is missing. + // Although at this moment + // VIDEO-RANGE attribute is not implemented in FFmpeg. + avio_printf(out, ",FRAME-RATE=%.3f", av_q2d(st->avg_frame_rate)); + } + } if (codecs && codecs[0]) avio_printf(out, ",CODECS=\"%s\"", codecs); if (agroup && agroup[0]) -- 2.32.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".