aboutsummaryrefslogtreecommitdiff
path: root/stream
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-04-21 09:52:11 +0200
committermetamuffin <metamuffin@disroot.org>2025-04-21 09:52:11 +0200
commit82fc75dcea8f26f23eec0c6e88244e41b401a826 (patch)
tree73c233d620cecf7f4e6be6519e41d0bf39024c4c /stream
parentb70f9d308c7074b51a0327e1fd6d62fc50c09c3b (diff)
downloadjellything-82fc75dcea8f26f23eec0c6e88244e41b401a826.tar
jellything-82fc75dcea8f26f23eec0c6e88244e41b401a826.tar.bz2
jellything-82fc75dcea8f26f23eec0c6e88244e41b401a826.tar.zst
change transcode bitrates and ensure even height for transcoding
Diffstat (limited to 'stream')
-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),