aboutsummaryrefslogtreecommitdiff
path: root/transcoder/src/fragment.rs
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 /transcoder/src/fragment.rs
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 'transcoder/src/fragment.rs')
-rw-r--r--transcoder/src/fragment.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/transcoder/src/fragment.rs b/transcoder/src/fragment.rs
index 3be7d39..7c5cadd 100644
--- a/transcoder/src/fragment.rs
+++ b/transcoder/src/fragment.rs
@@ -38,9 +38,9 @@ pub async fn transcode(
.unwrap_or("ffmpeg %a".to_owned());
let filter = match kind {
- TrackKind::Video => format!("-vf scale={}:-1", format.width.unwrap()),
- TrackKind::Audio => String::new(),
- TrackKind::Subtitle => String::new(),
+ TrackKind::Video => "-vf scale=%w:%h",
+ TrackKind::Audio => "",
+ TrackKind::Subtitle => "",
};
let typechar = match kind {
TrackKind::Video => "v",
@@ -61,8 +61,9 @@ pub async fn transcode(
.replace("%a", "-hide_banner %i %f %e %o")
.replace("%i", "-f matroska -i pipe:0 -copyts")
.replace("%o", "-f matroska pipe:1")
- .replace("%w", &format.width.unwrap_or_default().to_string())
.replace("%f", &filter)
+ .replace("%w", &format.width.unwrap_or_default().to_string())
+ .replace("%h", &format.height.unwrap_or_default().to_string())
.replace("%e", "-c:%t %c -b:%t %r")
.replace("%t", typechar)
.replace("%c", fallback_encoder)