[+] Encoding::execute
This commit is contained in:
@@ -2,12 +2,12 @@ processes = 2
|
||||
|
||||
[[encoders]]
|
||||
name = "H264 Full VBR35"
|
||||
cmd = "ffmpeg -i %i -c:v h264_nvenc -cq:v 35 -rc:v vbr -c:a aac -pix_fmt yuv420p -color_primaries 1 -color_trc 1 -colorspace 1 -movflags +faststart %o"
|
||||
cmd = "ffmpeg -i {{INPUT}} -c:v h264_nvenc -cq:v 35 -rc:v vbr -c:a aac -pix_fmt yuv420p -color_primaries 1 -color_trc 1 -colorspace 1 -movflags +faststart {{OUTPUT}}"
|
||||
suffix = "h264-vbr35.mp4"
|
||||
|
||||
[[encoders]]
|
||||
name = "AV1 Full CRF38"
|
||||
cmd = "ffmpeg -i %i -c:v libsvtav1 -crf 38 -c:a aac -pix_fmt yuv420p -color_primaries 1 -color_trc 1 -colorspace 1 -movflags +faststart %o"
|
||||
cmd = "ffmpeg -i {{INPUT}} -c:v libsvtav1 -crf 38 -c:a aac -pix_fmt yuv420p -color_primaries 1 -color_trc 1 -colorspace 1 -movflags +faststart {{OUTPUT}}"
|
||||
suffix = "av1-crf38.mp4"
|
||||
|
||||
#[[encoders]]
|
||||
|
||||
+12
-1
@@ -1,6 +1,9 @@
|
||||
use std::{env, fs};
|
||||
use std::path::Path;
|
||||
use std::process::{Command, Output};
|
||||
use serde::{Deserialize};
|
||||
use anyhow::{Result};
|
||||
use anyhow::{Context, Result};
|
||||
use crate::utils::run_cmd;
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
pub struct Encoder {
|
||||
@@ -15,6 +18,14 @@ pub struct Encoders {
|
||||
encoders: Vec<Encoder>
|
||||
}
|
||||
|
||||
impl Encoder {
|
||||
pub fn execute(&self, orig: &str, out: &str) -> Result<Output> {
|
||||
run_cmd(&*self.cmd
|
||||
.replace("{{INPUT}}", &*shlex::quote(orig))
|
||||
.replace("{{OUTPUT}}", &*shlex::quote(out)))
|
||||
}
|
||||
}
|
||||
|
||||
impl Encoders {
|
||||
pub fn load() -> Result<Encoders> {
|
||||
let file = env::var("MEOW_ENCODING_FILE").unwrap_or("encoding.toml".to_string());
|
||||
|
||||
Reference in New Issue
Block a user