[Ffmpeg-devel] Third Try: Set bit_rate for asf format

Michael Niedermayer michaelni
Sun Apr 15 23:30:11 CEST 2007


Hi

On Mon, Apr 02, 2007 at 01:26:40PM +0800, Zuxy Meng wrote:
> Hi,
> 
> 2007/3/31, Zuxy Meng <zuxy.meng at gmail.com>:
> >Hi,
> >
> >2007/3/30, Zuxy Meng <zuxy.meng at gmail.com>:
> >> Hi,
> >>
> >> 2007/3/30, Michael Niedermayer <michaelni at gmx.at>:
> >> > Hi
> >> >
> >> > still i have a bad feeling with setting it just for video knowing it
> >> > breakes audio if it would be set there too ...
> >>
> >> Me too. I'll dig into wma.c this weekend.
> >>
> >> > somehow this isnt a clean solution at all
> >
> >The reason is that for audio streams, there will be a wave header
> >defined at the asf container level, and get_wav_header will set
> >bit_rate as 8*nAvgBytesPerSec. So unlike video streams, we don't need
> >to look for the optional extended stream property object for bitrate.
> >
> >And something more about the fulltest: asf files used/generated in
> >fulltest don't contain extended stream property objects so bitrate[i]
> >== 0, and the subsequent assignment will effectively overwrite what
> >has been found in get_wav_header. This is absolutely my fault; I
> >forgot that such objects are optional, not mandatory.
> 
> Please take a look at this patch; hopefully this is cleaner. And it
> passes fulltest, too.
[...]
> @@ -500,11 +505,14 @@
>  
>      for(i=0; i<128; i++){
>          int stream_num= asf->asfid2avid[i];
> -        if(stream_num>=0 && dar[i].num>0 && dar[i].den>0){
> +        if(stream_num>=0){
>              AVCodecContext *codec= s->streams[stream_num]->codec;
> -            av_reduce(&codec->sample_aspect_ratio.num,
> -                    &codec->sample_aspect_ratio.den,
> -                    dar[i].num, dar[i].den, INT_MAX);
> +            if (bitrate[i])
> +                codec->bit_rate = bitrate[i];

this still overrides the bitrate and IMHO will break WMA like the previous
patches, its just that bitrate[i] is 0 during the regression tests but this
is not guranteed to be true for files in the wild

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

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070415/2eaf9050/attachment.pgp>



More information about the ffmpeg-devel mailing list