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

Jeyapal, Karthick kjeyapal at akamai.com
Thu Jun 4 12:24:18 EEST 2020


On 6/4/20 1:29 PM, Przemysław Sobala wrote:
> On Tue, Jun 2, 2020 at 10:19 AM Przemysław Sobala <
> przemyslaw.sobala at gmail.com> wrote:
>
>> On Mon, Jun 1, 2020 at 3:30 PM Jeyapal, Karthick <kjeyapal at akamai.com>
>> wrote:
>>
>>>
>>> On 6/1/20 5:24 PM, Przemysław Sobala wrote:
>>>> On Mon, Jun 1, 2020 at 10:06 AM Anton Khirnov <anton at khirnov.net>
>>> wrote:
>>>>
>>>>> Quoting Przemysław Sobala (2020-05-27 17:07:22)
>>>>>> ---
>>>>>>  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;
>>>>>
>>>>> That does not look like an AVCodecContext
>>>>>
>>>>
>>>> Of course not. time_base is AVStream's field. I don't know why I wrote
>>>> AVCodecContext... Please amend that commit message if possible.
>>> Amended and Pushed!
>>>
>>> Thanks,
>>> Karthick
>>>
>>>
>> Thanks.
>> What do you think about computing an average bitrate for all segments, not
>> only the first one (in case of a static - not dynamic - DASH manifest), if
>> one would not want to specify bitrate while encoding using x264 CRF rate
>> control? I could prepare such a patch that, if bitrate is not specified,
>> it'd be computed at the end, for static manifest, for all segments. It'd be
>> more accurate comparing to the first segment's bitrate.
>>
>
> Any comments about that?
Any patch that fixes/improves the current behavior is always welcome :)
>
> --
> pozdrawiam
> Przemysław Sobala
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://urldefense.proofpoint.com/v2/url?u=https-3A__ffmpeg.org_mailman_listinfo_ffmpeg-2Ddevel&d=DwIGaQ&c=96ZbZZcaMF4w0F4jpN6LZg&r=xOoesbz-6ff1GPXp5Lg4jf1ZG99yp4a1qhxVn_YOwRU&m=q7hq8J8ltTngyTvXBudpQq8HN4Ure-eQJZiCG85-TgI&s=pM0LIY83Tgww_6eGlIuJe7lzdcfZcKoqyH2rMDz396E&e= 
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-devel mailing list