[Ffmpeg-devel] h263+: size of encoded frames after opening ffmpeg

Martin marthi
Tue Jan 30 15:36:17 CET 2007


Hi,

Michael Niedermayer wrote:
> Hi
> 
> On Tue, Jan 30, 2007 at 02:21:19PM +0100, Martin wrote:
> 
>>Hi,
>>
>>Martin wrote:
>>
>>>Hi,
>>>
>>>Michael Niedermayer wrote:
>>>
>>>
>>>>Hi
>>>>
>>>>On Fri, Jan 19, 2007 at 11:23:59AM +0100, Martin wrote:
>>>>
>>>>
>>>>
>>>>>Hi,
>>>>>
>>>>>Michael Niedermayer wrote:
>>>>>
>>>>>
>>>>>
>>>>>>Hi
>>>>>>
>>>>>>On Wed, Jan 17, 2007 at 11:14:40AM +0100, Martin wrote:
>>>>>>[...]
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>>Even better, is there a
>>>>>>>>>possibility to change the bitrate without closing and reopening ffmpeg?
>>>>>>>>
>>>>>>>>
>>>>>>>>you can set the quality of frames which affects the bitrate,
>>>>>>>>closing and reopening within the same stream is generally not allowed
>>>>>>>>doing so means you are on your own
>>>>>>>
>>>>>>>Ok, how can I set the quality within the same stream without closing and
>>>>>>>reopening? I tried to set the AVCodecContext.crf parameter but it
>>>>>>>doesn't seem to have any effect on quality and size of outputted frames.
>>>>>>>Is there another parameter which I can use?
>>>>>>
>>>>>>
>>>>>>AVFrame.quality 
>>>>>>and set CODEC_FLAG_QSCALE
>>>>>
>>>>>Thank you very much, that worked. How is the relationship between
>>>>>quality and bitrate? Is there a formula which expresses it?
>>>>
>>>>
>>>>besides encode at quality X and look at the bitrate, no but theres some
>>>>approximation, and that is that quality and bitrate are approximatly
>>>>inversly proportional so double the quality variable and bitrate should
>>>>be approximately cut in half
>>>
>>>
>>>what I measured didn't give this behaviour (double quality -> half bitrate):
>>>I used a bitrate of 1280000 bits/sec in AVCodecContext. Measured Bitrate
>>>with different qualities:
>>>
>>>## Qual Bitrate
>>>1) 600: 3012856
>>>2) 1200: 1002368
>>>3) 2400: 556024
>>>4) 4800: 419112
>>>
>>>A function is inversely proportional if x*y = a, where a is some
>>>constant. So the products of quality and bitrate are:
>>>
>>>1) 1807713600
>>>2) 1202841600
>>>3) 1334457600
>>>4) 2011737600
>>>
>>>This is far from approximately constant. There must be some computation
>>>that you are doing to get a bitrate from quality, right? I really need
>>>to know how to compute it and appreciate any help on this!
> 
> 
> to find the exact bitrate for a frame at quality X you have to encode the
> frame at that quality

thanks for answering! I don't want to find out the exact bitrate of a
frame. I want, for example, to half the average bitrate. So the option
to set is quality. But if I don't know the relationship of quality and
bitrate, I can't half the average bitrate.

Martin




More information about the ffmpeg-devel mailing list