[Libav-user] Scaled down h264 video has almost same size as normal sized video; why?

Alex Cohn alexcohn at netvision.net.il
Wed Dec 19 09:02:35 CET 2012

On Tue, Dec 18, 2012 at 1:07 PM, Taha Ansari <mtaha.ansari at gmail.com> wrote:
> After first run, if we change
> #define ENCODER_WIDTH 640
> #define ENCODER_HEIGHT 480
> to
> #define ENCODER_WIDTH 160
> #define ENCODER_HEIGHT 120
> and run again, file size is almost the same. Question now is why? shouldn't
> smaller sized video be taking up much lesser space than the original sized
> video?

Note that you have the encoder bit rate hard coded:

> c->bit_rate = 400000;

... so, one would expect a well-tempered encoder to produce same
encoded frame sizes. You could try to compare the resulting video
quality in two cases. E.g., decode the two streams and display them at
160x120. You are expected to see very similar images. If you increase
the requested bit rate, the VGA stream will still be improving, but
the 160x120 stream is probably saturated. You can consult the "video
bitrate calculator" at http://www.dr-lex.be/info-stuff/videocalc.html
to find the optimal bit rate - it would be more than 1Mbps for VGA at
25 FPS.


More information about the Libav-user mailing list