Message ID | 20200717082142.678533-1-dongwon00.kim@gmail.com |
---|---|
State | Superseded |
Headers | show |
Series | [FFmpeg-devel] avformat/utils fix calculating wrong bitrate on HLS, DASH stream | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
"filesize" variable is size of MPD file(MPEG-DASH) or M3U8 playlist file(HLS). So, the bitrate is calculated deviding size of playlist or manifest file(not segment files) by duration. On Fri, Jul 17, 2020 at 05:21:42PM +0900, Dongwon Kim wrote: > Signed-off-by: Dongwon Kim <dongwon.kim@sk.com> > Signed-off-by: Dongwon Kim <dongwon00.kim@gmail.com> > --- > libavformat/utils.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/libavformat/utils.c b/libavformat/utils.c > index 807d9f10cb..e90467e2e0 100644 > --- a/libavformat/utils.c > +++ b/libavformat/utils.c > @@ -2715,7 +2715,8 @@ static void update_stream_timings(AVFormatContext *ic) > if (duration != INT64_MIN && duration > 0 && ic->duration == AV_NOPTS_VALUE) { > ic->duration = duration; > } > - if (ic->pb && (filesize = avio_size(ic->pb)) > 0 && ic->duration > 0) { > + if (ic->pb && (filesize = avio_size(ic->pb)) > 0 && ic->duration > 0 > + && strcmp(ic->iformat->name, "hls") && strcmp(ic->iformat->name, "dash")) { > /* compute the bitrate */ > double bitrate = (double) filesize * 8.0 * AV_TIME_BASE / > (double) ic->duration; > -- > 2.25.1 >
diff --git a/libavformat/utils.c b/libavformat/utils.c index 807d9f10cb..e90467e2e0 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2715,7 +2715,8 @@ static void update_stream_timings(AVFormatContext *ic) if (duration != INT64_MIN && duration > 0 && ic->duration == AV_NOPTS_VALUE) { ic->duration = duration; } - if (ic->pb && (filesize = avio_size(ic->pb)) > 0 && ic->duration > 0) { + if (ic->pb && (filesize = avio_size(ic->pb)) > 0 && ic->duration > 0 + && strcmp(ic->iformat->name, "hls") && strcmp(ic->iformat->name, "dash")) { /* compute the bitrate */ double bitrate = (double) filesize * 8.0 * AV_TIME_BASE / (double) ic->duration;