aboutsummaryrefslogtreecommitdiff
path: root/stream/src/stream_info.rs
diff options
context:
space:
mode:
Diffstat (limited to 'stream/src/stream_info.rs')
-rw-r--r--stream/src/stream_info.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/stream/src/stream_info.rs b/stream/src/stream_info.rs
index 8592bc4..43d9289 100644
--- a/stream/src/stream_info.rs
+++ b/stream/src/stream_info.rs
@@ -105,11 +105,19 @@ fn stream_formats(t: &TrackEntry, remux_bitrate: f64) -> Vec<StreamFormatInfo> {
1 => {
let sw = t.video.as_ref().unwrap().pixel_width;
let sh = t.video.as_ref().unwrap().pixel_height;
- for (w, br) in [(3840, 8e6), (1920, 5e6), (1280, 3e6), (640, 1e6)] {
+ for (w, br) in [
+ (3840, 6000e3),
+ (1920, 5000e3),
+ (1920, 2000e3),
+ (1280, 1500e3),
+ (640, 800e3),
+ (320, 200e3),
+ ] {
if w > sw {
continue;
}
- let h = (w * sh) / sw;
+ // most codecs use chroma subsampling that requires even dims
+ let h = ((w * sh) / sw) & !1; // clear last bit to ensure even height.
for (cid, enable) in [
("V_AV1", CONF.encoders.av1.is_some()),
("V_VP8", CONF.encoders.vp8.is_some()),
@@ -120,7 +128,7 @@ fn stream_formats(t: &TrackEntry, remux_bitrate: f64) -> Vec<StreamFormatInfo> {
if enable {
formats.push(StreamFormatInfo {
codec: cid.to_string(),
- bitrate: br,
+ bitrate: remux_bitrate.max(br),
remux: false,
containers: containers_by_codec(cid),
width: Some(w),