[FFmpeg-devel] [PATCH] Calculate and store mov bitrate
haim alon
haim.alter
Wed Oct 7 08:21:41 CEST 2009
Hi,
On Sat, Sep 26, 2009 at 11:13 PM, Baptiste Coudurier <
baptiste.coudurier at gmail.com> wrote:
> Hi,
>
> On 08/20/2009 06:47 AM, haim alon wrote:
>
>> Hi,
>> This patch calculates the actual bitrate of a mov file and stores it in
>> the
>> AVCodecContext structure.
>> Regards
>> Haim.
>>
>>
>> ffmpeg.bitrate.patch
>>
>>
>> Index: libavformat/mov.c
>> ===================================================================
>> --- libavformat/mov.c (revision 19667)
>> +++ libavformat/mov.c (working copy)
>> @@ -1399,6 +1399,8 @@
>> unsigned int stss_index = 0;
>> unsigned int stps_index = 0;
>> unsigned int i, j;
>> + int64_t stream_size = 0;
>> + double duration;
>>
>> [...]
>>
> >
>
>> @@ -1468,6 +1471,8 @@
>> }
>> }
>> }
>> + duration = (st->duration/(double)mov->time_scale);
>> + st->codec->bit_rate = (stream_size*8.0)/duration;
>>
>
> You don't need a duration variable and mov->time_scale is wrong.
>
>
Can you recommend any alternative way to get the stream duration (in
seconds) ?
--
> Baptiste COUDURIER
> Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
> FFmpeg maintainer http://www.ffmpeg.org
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>
Thanks,
Haim.
More information about the ffmpeg-devel
mailing list