0.11.0 WIP
Former-commit-id: 94fcad7d7cf1f7733a2f773572c1b0990a31232d
This commit is contained in:
parent
121b1df927
commit
6e89300675
12
src/main.rs
12
src/main.rs
@ -19,7 +19,7 @@ mod workunit;
|
||||
use workunit::WUnit;
|
||||
use workunit::EStatus;
|
||||
|
||||
const VERSION: &str = "0.10.0";
|
||||
const VERSION: &str = "0.11.0";
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
struct SharedState {
|
||||
@ -30,7 +30,7 @@ struct SharedState {
|
||||
fn index() -> String {
|
||||
format!("Wecome to the AV1Master Server version {version}\n
|
||||
This currently requires a distro with CAP_SYS_USER_NS enabled and correct permissions
|
||||
curl -L {baseurl}/av1client > av1client && chmod +x ./av1client && ./av1client", baseurl="https://av1.dodsorf.as", version=VERSION)
|
||||
curl -L {baseurl}/av1client > av1client && chmod +x ./av1client && ./av1client {baseurl}", baseurl="https://av1.dodsorf.as", version=VERSION)
|
||||
}
|
||||
|
||||
#[get("/version")]
|
||||
@ -134,5 +134,13 @@ fn main() {
|
||||
.manage(SharedState::default())
|
||||
.mount("/", StaticFiles::from("src/static")) // switch to templates or something cause this is dumb
|
||||
.mount("/", routes![index, version, get_jobs, get_job, request_job, edit_status, add_job, upload])
|
||||
.mount("/", routes![test_job])
|
||||
.launch();
|
||||
}
|
||||
|
||||
|
||||
#[get("/test_job/<jobset>")]
|
||||
fn test_job(jobset: String, shared: State<SharedState>) {
|
||||
let id = uuid::Uuid::new_v4();
|
||||
shared.jobs.lock().unwrap().insert(id, WUnit::new(id, jobset, workunit::WDesc::new("https://pomf.dodsorf.as/f/vz9dtl.mkv", "014", None, 90, (540, 960), None)));
|
||||
}
|
@ -3,8 +3,8 @@
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
base_url="https://av1.dodsorf.as"
|
||||
version="0.10.0"
|
||||
base_url="$1"
|
||||
version="0.11.0"
|
||||
|
||||
while true; do
|
||||
sleep 30
|
||||
@ -71,17 +71,27 @@ while true; do
|
||||
|
||||
echo "Starting Encode"
|
||||
|
||||
etype=`echo $job | jq -r '.description.options | keys | .[]'`
|
||||
|
||||
if [$etype != "FFMPEG"] || [$etype != "AOMENC" ]; then
|
||||
echo "That's not a valid encoder!! Are you being attacked?"
|
||||
fi
|
||||
|
||||
height=`echo $job | jq -r .description.resolution[0]`
|
||||
width=`echo $job | jq -r .description.resolution[1]`
|
||||
|
||||
echo $job | jq
|
||||
|
||||
aomenco=`echo $job | jq -r .description.options.aomenc`
|
||||
options=`echo $job | jq .description.options.$etype`
|
||||
|
||||
case $etype in
|
||||
AOMENC)
|
||||
aomenco=`echo $options | jq -r .aomenc`
|
||||
aomenco=${aomenco//[^a-zA-Z0-9_\- =]/}
|
||||
ffmpego=`echo $job | jq -r .description.options.ffmpeg`
|
||||
ffmpego=`echo $options | jq -r .ffmpeg`
|
||||
ffmpego=${ffmpego//[^a-zA-Z0-9_\- =:]/}
|
||||
|
||||
pix_fmt=`echo $job | jq -r .description.options.pix_fmt`
|
||||
pix_fmt=`echo $job | jq -r .pix_fmt`
|
||||
if [[ $pix_fmt = "YV12" ]]; then
|
||||
ffpix="yuv12p"
|
||||
aompix="--yv12"
|
||||
@ -98,7 +108,7 @@ while true; do
|
||||
|
||||
|
||||
|
||||
fps=`echo $job | jq -r .description.options.fps`
|
||||
fps=`echo $options | jq -r .fps`
|
||||
if [[ $fps = "null" ]]; then
|
||||
fffps=""
|
||||
aomfps=""
|
||||
@ -110,8 +120,7 @@ while true; do
|
||||
aomfps="--fps=$fpsv"
|
||||
fi
|
||||
|
||||
|
||||
two_pass=`echo $job | jq -r .description.options.two_pass`
|
||||
two_pass=`echo $options | jq -r .two_pass`
|
||||
|
||||
if [[ $two_pass = true ]]; then
|
||||
set +e
|
||||
@ -161,6 +170,22 @@ while true; do
|
||||
echo "Deleting Source"
|
||||
rm "$input"
|
||||
fi
|
||||
;;
|
||||
FFMPEG)
|
||||
echo "Starting FFMPEG encode"
|
||||
if [[ $two_pass = true ]]; then
|
||||
echo "Running in two-pass mode"
|
||||
|
||||
options=`echo $job | jq -r .options.$etype`
|
||||
|
||||
pix_fmt=`echo $options | jq -r .pix_fmt`
|
||||
tiles=`echo $options | jq -r .tiles`
|
||||
lag_in_frames=`echo $options | jq -r .lag_in_frames`
|
||||
|
||||
set +e
|
||||
ffmpeg -i $input -c:v libaom-av1 -strict experimental -pass 1 -an -vf scale=$width:$height -pix_fmt $pix_fmt -tiles $tiles -lag-in-frames $lag_in_frames $flag_g -f ivf /dev/null
|
||||
fi
|
||||
;;
|
||||
|
||||
set +e
|
||||
curl -s -L "$base_url"/edit_status/"$job_id"/completed
|
||||
|
@ -49,27 +49,62 @@ impl WDesc {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub enum EOptions {
|
||||
AOMENC(AomencO),
|
||||
FFMPEG(FffmpegO)
|
||||
}
|
||||
impl Default for EOptions {
|
||||
fn default() -> Self {
|
||||
let default = AomencO::default();
|
||||
EOptions::AOMENC(default)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct EOptions {
|
||||
pub struct AomencO {
|
||||
pub ffmpeg: String,
|
||||
pub aomenc: String,
|
||||
pub two_pass: bool,
|
||||
pub pix_fmt: EPixFmt,
|
||||
pub fps: (u16, u16)
|
||||
}
|
||||
impl Default for EOptions {
|
||||
impl Default for AomencO {
|
||||
fn default() -> Self {
|
||||
EOptions{
|
||||
AomencO{
|
||||
ffmpeg: String::default(),
|
||||
aomenc: "--lag-in-frames=25 --tile-columns=0 --tile-rows=0 --enable-fwd-kf=1 --bit-depth=10 --cpu-used=3 --cq-level=30 --end-usage=q".to_string(),
|
||||
two_pass: false,
|
||||
aomenc: "--lag-in-frames=35 --tile-columns=0 --tile-rows=0 --enable-fwd-kf=1 --bit-depth=10 --cpu-used=4 --cq-level=30 --end-usage=q".to_string(),
|
||||
two_pass: true,
|
||||
pix_fmt: EPixFmt::I422,
|
||||
fps: (25, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct FffmpegO {
|
||||
pub two_pass: bool,
|
||||
pub crf: u8,
|
||||
pub b_v: String,
|
||||
pub lag_in_frames: u8,
|
||||
pub pix_fmt: String,
|
||||
pub tiles: String,
|
||||
pub speed: u8
|
||||
}
|
||||
impl Default for FffmpegO {
|
||||
fn default() -> Self {
|
||||
FffmpegO {
|
||||
two_pass: true,
|
||||
crf: 30,
|
||||
b_v: "0".to_string(),
|
||||
lag_in_frames: 35,
|
||||
pix_fmt: "yuv420p10le"
|
||||
tiles: "1x1".to_string(),
|
||||
speed: 4
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
||||
pub enum EStatus {
|
||||
Queued,
|
||||
|
12
test.sh
12
test.sh
@ -8,7 +8,7 @@ curl "$base_url"
|
||||
|
||||
curl "$base_url"/get_jobs | jq
|
||||
|
||||
curl "$base_url"/add_job -X POST -H "Content-Type: application/json" -d \
|
||||
curl "$base_url"/add_job/b -X POST -H "Content-Type: application/json" -d \
|
||||
'
|
||||
{
|
||||
"file_url": "https://pomf.dodsorf.as/f/vz9dtl.mkv",
|
||||
@ -17,11 +17,13 @@ curl "$base_url"/add_job -X POST -H "Content-Type: application/json" -d \
|
||||
"length": 90,
|
||||
"resolution": [540, 960],
|
||||
"options": {
|
||||
"aomenc": "--lag-in-frames=25 --tile-columns=0 --tile-rows=0 --enable-fwd-kf=1 --bit-depth=10 --cpu-used=0 --end-usage=vbr --target-bitrate=60 --kf-min-dist=9999 --kf-max-dist=9999",
|
||||
"ffmpeg": "",
|
||||
"FFMPEG": {
|
||||
"two_pass": true,
|
||||
"pix_fmt": "YV12",
|
||||
"fps": [24000, 1001]
|
||||
"crf": 45,
|
||||
"b_v": "0",
|
||||
"tiles": "1x1",
|
||||
"speed": 4
|
||||
}
|
||||
}
|
||||
}
|
||||
'
|
||||
|
Loading…
Reference in New Issue
Block a user