[FFmpeg-devel] [PATCH] Calculate and store mov bitrate.
Baptiste Coudurier
baptiste.coudurier
Thu Feb 26 20:11:20 CET 2009
On 2/26/2009 7:17 AM, Haim Alon wrote:
> Hi,
>
> This patch calculates and mov bitrate and stores it in AVCodecContext
> structure.
> Regards,
> Haim.
>
>
>
>
> ------------------------------------------------------------------------
>
> Index: libavformat/mov.c
> ===================================================================
> --- libavformat/mov.c (revision 17613)
> +++ libavformat/mov.c (working copy)
> @@ -1236,6 +1236,7 @@
> unsigned int stsc_index = 0;
> unsigned int stss_index = 0;
> unsigned int i, j;
> + int64_t stream_size = 0;
>
> /* adjust first dts according to edit list */
> if (sc->time_offset) {
> @@ -1279,6 +1280,7 @@
> current_offset, current_dts, sample_size, distance, keyframe);
> }
> current_offset += sample_size;
> + stream_size += sample_size;
> assert(sc->stts_data[stts_index].duration % sc->time_rate == 0);
> current_dts += sc->stts_data[stts_index].duration / sc->time_rate;
> distance++;
> @@ -1290,6 +1292,8 @@
> }
> }
> }
> + double duration = (mov->duration/(double)mov->time_scale);
> + st->codec->bit_rate = (stream_size*8.0)/duration;
This is wrong, stream duration must be used, not mov->duration.
--
Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA
Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
checking for life_signs in -lkenny... no
FFmpeg maintainer http://www.ffmpeg.org
More information about the ffmpeg-devel
mailing list