Discussion:
[libav-user] How to set correct bit-rate
Kulti
2010-09-14 09:26:39 UTC
Permalink
Hi, all.

I used add_video_stream() function from output_example.c for
tuning AVCodecContext. bit_rate field is set to some value, but I can't
understand what value I need? How to calculate output bit-rate for my
concrete format and width x hight?

May be ffmpeg can automatically set optimal bit-rate? I try to set this
field to 0, but it was not work.
Benjamin Gretsch
2010-09-14 09:46:38 UTC
Permalink
For average to good quality you should have between 0.15 and 0.22 bits/pixel
(bpp).
Use the formula
bpp = bps / (width * height * fps)
<=> bps = bpp * width * height * fps

bps is bits/s (bitrate), fps is frames/s
Post by Kulti
Hi, all.
I used add_video_stream() function from output_example.c for
tuning AVCodecContext. bit_rate field is set to some value, but I can't
understand what value I need? How to calculate output bit-rate for my
concrete format and width x hight?
May be ffmpeg can automatically set optimal bit-rate? I try to set this
field to 0, but it was not work.
_______________________________________________
libav-user mailing list
libav-user at mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
Kulti
2010-09-14 18:40:03 UTC
Permalink
Thank you, Benjamin!

I was doing any similar, but used 3 bits/pixel instead 0.22. At now I try to
0.22 and quality is very bad. As I understand optimal bpp depends on
compression format. For uncompressed RGB needed 24 bpp, but how to know,
what's optimal for concreate codec?
Post by Benjamin Gretsch
For average to good quality you should have between 0.15 and 0.22 bits/pixel
(bpp).
Use the formula
bpp = bps / (width * height * fps)
<=> bps = bpp * width * height * fps
bps is bits/s (bitrate), fps is frames/s
Post by Kulti
Hi, all.
I used add_video_stream() function from output_example.c for
tuning AVCodecContext. bit_rate field is set to some value, but I can't
understand what value I need? How to calculate output bit-rate for my
concrete format and width x hight?
May be ffmpeg can automatically set optimal bit-rate? I try to set this
field to 0, but it was not work.
_______________________________________________
libav-user mailing list
libav-user at mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
_______________________________________________
libav-user mailing list
libav-user at mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
Benjamin Gretsch
2010-09-15 09:35:03 UTC
Permalink
What I wrote is for xvid and x264 (x264 need slightly less than xvid)
Post by Kulti
Thank you, Benjamin!
I was doing any similar, but used 3 bits/pixel instead 0.22. At now I try to
0.22 and quality is very bad. As I understand optimal bpp depends on
compression format. For uncompressed RGB needed 24 bpp, but how to know,
what's optimal for concreate codec?
Post by Benjamin Gretsch
For average to good quality you should have between 0.15 and 0.22 bits/pixel
(bpp).
Use the formula
bpp = bps / (width * height * fps)
<=> bps = bpp * width * height * fps
bps is bits/s (bitrate), fps is frames/s
Post by Kulti
Hi, all.
I used add_video_stream() function from output_example.c for
tuning AVCodecContext. bit_rate field is set to some value, but I can't
understand what value I need? How to calculate output bit-rate for my
concrete format and width x hight?
May be ffmpeg can automatically set optimal bit-rate? I try to set this
field to 0, but it was not work.
_______________________________________________
libav-user mailing list
libav-user at mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
_______________________________________________
libav-user mailing list
libav-user at mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
_______________________________________________
libav-user mailing list
libav-user at mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
Loading...