[FFmpeg-devel] [PATCH] flv duration

Michael Niedermayer michaelni
Sat Apr 10 23:15:39 CEST 2010


On Sat, Apr 10, 2010 at 09:19:41AM -0700, Howard Chu wrote:
> Michael Niedermayer wrote:
>> On Wed, Apr 07, 2010 at 08:28:51AM -0700, Howard Chu wrote:
>>> Michael Niedermayer wrote:
>>>> I see nothing in this patch that is correct.
>>>
>>> You should have said that up front and saved us both a lot of time.
>>>
>>>> Hiding a warning about estimated bitrate&duration by explicitly setting
>>>> the bitrate incorrectly and thus changing a "might be wrong to a is 
>>>> wrong"
>>>> isnt really an improvment.
>>>
>>> The patch sets the bitrate based on the metadata of the stream. You're
>>> saying the metadata can't be trusted?
>>
>> iam saying the weight of a car is larger than the sum of its passangers
>> weights, the car itself has weight too.
>> Its the same with bitrates
>
> Fair enough. Still, since you're setting the vcodec bitrate, it seems you 
> ought to also be setting the acodec bitrate.
>
> -- 
>   -- Howard Chu
>   CTO, Symas Corp.           http://www.symas.com
>   Director, Highland Sun     http://highlandsun.com/hyc/
>   Chief Architect, OpenLDAP  http://www.openldap.org/project/

> Index: libavformat/flvdec.c
> ===================================================================
> --- libavformat/flvdec.c	(revision 22813)
> +++ libavformat/flvdec.c	(working copy)
> @@ -192,9 +192,11 @@
>          } else if(amf_type == AMF_DATA_TYPE_NUMBER) {
>              snprintf(str_val, sizeof(str_val), "%.f", num_val);
>              av_metadata_set(&s->metadata, key, str_val);
> -            if(!strcmp(key, "duration")) s->duration = num_val * AV_TIME_BASE;
> +            if(!strcmp(key, "duration")) s->streams[0]->duration = num_val * 1000;
>              else if(!strcmp(key, "videodatarate") && vcodec && 0 <= (int)(num_val * 1024.0))

not ok


>                  vcodec->bit_rate = num_val * 1024.0;
> +            else if(!strcmp(key, "audiodatarate") && acodec && 0 <= (int)(num_val * 1024.0))
> +                acodec->bit_rate = num_val * 1024.0;
>          } else if (amf_type == AMF_DATA_TYPE_STRING)

ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100410/b1459127/attachment.pgp>



More information about the ffmpeg-devel mailing list