On 03.03.2017 16:14, Michael Niedermayer wrote:
On Mon, Feb 06, 2017 at 01:33:19PM +0100, Tobias Rapp wrote:
Allows to get a more realistic total bitrate (and estimated file size)
in avi_write_header. Previously a static default value of 200k was
assumed.
Signed-off-by: Tobias Rapp <t.r...@noa-archive.com>
---
[...]
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 35f54c6..7138cc0 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -894,6 +894,10 @@ slices_ok:
}
}
+ // estimate bitrate assuming 40% compression
+ avctx->bit_rate = ff_guess_coded_bitrate(avctx) * 2 / 5;
+ avctx->bit_rate_tolerance = avctx->bit_rate;
+
return 0;
}
diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c
index 89639b7..8911408 100644
--- a/libavcodec/huffyuvenc.c
+++ b/libavcodec/huffyuvenc.c
@@ -446,6 +446,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
s->picture_number=0;
+ // estimate bitrate assuming 60% compression
+ avctx->bit_rate = ff_guess_coded_bitrate(avctx) * 3 / 5;
+ avctx->bit_rate_tolerance = avctx->bit_rate;
these violate the API
See avcodec.h:
/**
* number of bits the bitstream is allowed to diverge from the reference.
* the reference can be CBR (for CBR pass1) or VBR (for pass2)
* - encoding: Set by user; unused for constant quantizer encoding.
* - decoding: unused
*/
int bit_rate_tolerance;
also the compression rate depends on the material these numbers are
basically random
I agree that the bitrate can vary much depending on the type of video
material (animation, film scanning, noise, etc) and my intent was to
signal that with +/- bit_rate_tolerance. Anyway the 40%/60% compression
numbers roughly match my experience with analogue ingest.
Will post version 3 of the patch-set without updates to bit_rate_tolerance.
Regards,
Tobias
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel