[Libav-user] How to set bit_rate for MPEG4/2
Harald Schlangmann
harry at gps-laptimer.de
Sun Apr 20 15:57:19 CEST 2014
Hi,
processing a video stream reported with
Stream #0:0(eng), 0, 1/25000: Video: h264 (avc1 / 0x31637661), 1920x1080, 0/1, 31992 kb/s, 25 fps, 25 tbr, 25k tbn (default)
setting the bit_rate for a MPEG4/2 encoder seems to have effect for me:
When initializing bit_rate in AVCodecContext with 7257 kb/s (i.e. 7257000) dumping the output format shows:
Stream #0:0, 0, 1/90000: Video: mpeg4, yuv420p, 1920x1080, 1/25, q=2-31, 7257 kb/s, 90k tbn, 25 tbc
but results in a file with size 501MB for 88.24 seconds which means a bit rate of 47628 kb/s (video + audio)…
When not initializing bit_rate in AVCodecContext dumping the output format shows:
Stream #0:0, 0, 1/90000: Video: mpeg4, yuv420p, 1920x1080, 1/25, q=2-31, 200 kb/s, 90k tbn, 25 tbc
and results in a file with size 498 MB for 88.24 seconds which means a bit rate of 47342 kb/s (video + audio)…
When initializing bit_rate in AVCodecContext with an obviously invalid value of 1, dumping the output format shows:
Bitrate 1 is extremely low, maybe you mean 1k (warning issued)
Stream #0:0, 0, 1/90000: Video: mpeg4, yuv420p, 1920x1080, 1/25, q=2-31, 0 kb/s, 90k tbn, 25 tbc
and results in a file with size 35.89 MB for 88.24 seconds which means a bit rate of 3412 kb/s (video + audio)…
So to make it easier to compare:
set bit_rate = 7257 kb/s -> dumped bit_rate = 7257 kb/s -> result bit_rate = 47628 kb/s (including audio)
set bit_rate = 0 kb/s -> dumped bit_rate = 200 kb/s -> result bit_rate = 47342 kb/s (including audio)
set bit_rate = 1 b/s -> dumped bit_rate = 0 kb/s -> result bit_rate = 3412 kb/s (including audio)
Looks I’m doing something fundamentally wrong here. Any hint on how to influence result file size for mpeg4?
The only other fields I initialize for AVCodecContext are width, height, time_base, pix_fmt,
Greetings Harald
-
Harald Schlangmann
Antwerpener Str. 52, 50672 Köln, Germany
+49 151 2265 4439
Harry at gps-laptimer.de
www.gps-laptimer.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4145 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20140420/9693918c/attachment.p7s>
More information about the Libav-user
mailing list