aboutsummaryrefslogtreecommitdiff
path: root/transcoder/src
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-04-14 14:33:52 +0200
committermetamuffin <metamuffin@disroot.org>2025-04-14 14:33:52 +0200
commit4a36d9e96853bf04d17f8377a7fbf862d108b9f1 (patch)
tree525ace312985400eb36ad942b52bb5505f30944f /transcoder/src
parent92b119f95dd1cb24054f2440533208c140b66e46 (diff)
downloadjellything-4a36d9e96853bf04d17f8377a7fbf862d108b9f1.tar
jellything-4a36d9e96853bf04d17f8377a7fbf862d108b9f1.tar.bz2
jellything-4a36d9e96853bf04d17f8377a7fbf862d108b9f1.tar.zst
start transcoding refactor
Diffstat (limited to 'transcoder/src')
-rw-r--r--transcoder/src/fragment.rs94
1 files changed, 47 insertions, 47 deletions
diff --git a/transcoder/src/fragment.rs b/transcoder/src/fragment.rs
index ff6a9db..b88339c 100644
--- a/transcoder/src/fragment.rs
+++ b/transcoder/src/fragment.rs
@@ -7,7 +7,7 @@
use crate::LOCAL_VIDEO_TRANSCODING_TASKS;
use jellybase::{
cache::{async_cache_file, CachePath},
- common::jhls::EncodingProfile,
+ common::stream::StreamFormatInfo,
};
use log::{debug, info};
use std::process::Stdio;
@@ -21,7 +21,7 @@ use tokio::{
pub async fn transcode(
key: &str,
- enc: &EncodingProfile,
+ enc: &StreamFormatInfo,
input: impl FnOnce(ChildStdin),
) -> anyhow::Result<CachePath> {
async_cache_file(
@@ -30,51 +30,51 @@ pub async fn transcode(
let _permit = LOCAL_VIDEO_TRANSCODING_TASKS.acquire().await?;
debug!("transcoding fragment with {enc:?}");
- let mut args = Vec::new();
- match enc {
- EncodingProfile::Video {
- codec,
- preset,
- bitrate,
- width,
- } => {
- if let Some(width) = width {
- args.push("-vf".to_string());
- args.push(format!("scale={width}:-1"));
- }
- args.push("-c:v".to_string());
- args.push(codec.to_string());
- if let Some(preset) = preset {
- args.push("-preset".to_string());
- args.push(format!("{preset}"));
- }
- args.push("-b:v".to_string());
- args.push(format!("{bitrate}"));
- }
- EncodingProfile::Audio {
- codec,
- bitrate,
- sample_rate,
- channels,
- } => {
- if let Some(channels) = channels {
- args.push("-ac".to_string());
- args.push(format!("{channels}"))
- }
- if let Some(sample_rate) = sample_rate {
- args.push("-ar".to_string());
- args.push(format!("{sample_rate}"))
- }
- args.push("-c:a".to_string());
- args.push(codec.to_string());
- args.push("-b:a".to_string());
- args.push(format!("{bitrate}"));
- }
- EncodingProfile::Subtitles { codec } => {
- args.push("-c:s".to_string());
- args.push(codec.to_string());
- }
- };
+ let mut args = Vec::<String>::new();
+ // match enc {
+ // EncodingProfile::Video {
+ // codec,
+ // preset,
+ // bitrate,
+ // width,
+ // } => {
+ // if let Some(width) = width {
+ // args.push("-vf".to_string());
+ // args.push(format!("scale={width}:-1"));
+ // }
+ // args.push("-c:v".to_string());
+ // args.push(codec.to_string());
+ // if let Some(preset) = preset {
+ // args.push("-preset".to_string());
+ // args.push(format!("{preset}"));
+ // }
+ // args.push("-b:v".to_string());
+ // args.push(format!("{bitrate}"));
+ // }
+ // EncodingProfile::Audio {
+ // codec,
+ // bitrate,
+ // sample_rate,
+ // channels,
+ // } => {
+ // if let Some(channels) = channels {
+ // args.push("-ac".to_string());
+ // args.push(format!("{channels}"))
+ // }
+ // if let Some(sample_rate) = sample_rate {
+ // args.push("-ar".to_string());
+ // args.push(format!("{sample_rate}"))
+ // }
+ // args.push("-c:a".to_string());
+ // args.push(codec.to_string());
+ // args.push("-b:a".to_string());
+ // args.push(format!("{bitrate}"));
+ // }
+ // EncodingProfile::Subtitles { codec } => {
+ // args.push("-c:s".to_string());
+ // args.push(codec.to_string());
+ // }
+ // };
info!("encoding with {:?}", args.join(" "));
let mut proc = Command::new("ffmpeg")