[FFmpeg-devel] [PATCH] avformat/dashenc: use AVCodecContext timebase when computing missing bitrate

Jeyapal, Karthick kjeyapal at akamai.com
Fri May 29 08:58:39 EEST 2020


On 5/27/20 8:37 PM, Przemysław Sobala wrote:
> ---
>  libavformat/dashenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index 0cf0df50ef..00a37b175d 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -1959,7 +1959,7 @@ static int dash_flush(AVFormatContext *s, int final, int stream)
>  
>          if (!os->bit_rate) {
>              // calculate average bitrate of first segment
> -            int64_t bitrate = (int64_t) range_length * 8 * AV_TIME_BASE / duration;
> +            int64_t bitrate = (int64_t) range_length * 8 * (c->use_timeline ? os->ctx->streams[0]->time_base.den : AV_TIME_BASE) / duration;
>              if (bitrate >= 0)
>                  os->bit_rate = bitrate;
>          }
LGTM. Thanks.



More information about the ffmpeg-devel mailing list