diff --git a/src/main.rs b/src/main.rs index 90fa607..3cb429b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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", version=VERSION) +curl -L {baseurl}/av1client > av1client && chmod +x ./av1client && ./av1client", baseurl="https://av1.dodsorf.as", version=VERSION) } #[get("/version")] diff --git a/src/static/client.sh b/src/static/client.sh index 8b3699a..3ecaecb 100644 --- a/src/static/client.sh +++ b/src/static/client.sh @@ -4,7 +4,7 @@ set -euo pipefail IFS=$'\n\t' base_url="https://av1.dodsorf.as" -version="0.5.0" +version="0.6.0" while true; do sleep 30 @@ -88,20 +88,29 @@ while true; do elif [[ $pix_fmt = "I420" ]]; then ffpix="yuv420p" aompix="--i420" - elif [[ $pix_fmt = I422 ]]; then + elif [[ $pix_fmt = "I422" ]]; then ffpix="yuv422p" aompix="--i422" - elif [[ $pix_fmt = I444 ]]; then + elif [[ $pix_fmt = "I444" ]]; then ffpix="yuv444p" aompix="--i444" fi + fps=`echo $job | jq -r .description.options.fps` + if [[ $fps = "null" ]]; then + fpsoption="" + else + fpsrate=`echo $fps | jq -r '.[0]'` + fpsscale=`echo $fps | jq -r '.[1]'` + fpsoption="$fpsrate/$fpsscale" + fi + two_pass=`echo $job | jq -r .description.options.two_pass` if [[ $two_pass = true ]]; then set +e eval 'ffmpeg -nostats -hide_banner -loglevel warning \ - -i "'$input'" '$ffmpego' -vf scale='$height':'$width' -pix_fmt '$ffpix' -f yuv4mpegpipe - | aomenc - '$aompix' '$aomenco' \ + -i "'$input'" '$ffmpego' -vf scale='$height':'$width' -pix_fmt '$ffpix' -f yuv4mpegpipe - | aomenc - '$fpsoption' '$aompix' '$aomenco' \ --pass=1 --passes=2 --fpf="'$input'.fpf" --webm -o "'$input'.out.webm"' retval=$? @@ -113,7 +122,7 @@ while true; do fi eval 'ffmpeg -nostats -hide_banner -loglevel warning \ - -i "'$input'" '$ffmpego' -vf scale='$height':'$width' -pix_fmt '$ffpix' -f yuv4mpegpipe - | aomenc - '$aompix' '$aomenco' \ + -i "'$input'" '$ffmpego' -vf scale='$height':'$width' -pix_fmt '$ffpix' -f yuv4mpegpipe - | aomenc - '$fpsoption' '$aompix' '$aomenco' \ --pass=2 --passes=2 --fpf="'$input'.fpf" --webm -o "'$input'.out.webm"' retval=$? @@ -131,7 +140,7 @@ while true; do else set +e eval 'ffmpeg -nostats -hide_banner -loglevel warning \ - -i "'$input'" '$ffmpego' -vf scale='$height':'$width' -pix_fmt '$ffpix' -f yuv4mpegpipe - | aomenc - '$aompix' '$aomenco' \ + -i "'$input'" '$ffmpego' -vf scale='$height':'$width' -pix_fmt '$ffpix' -f yuv4mpegpipe - | aomenc - '$fpsoption' '$aompix' '$aomenco' \ --passes=1 --fpf="'$input'.fpf" --webm -o "'$input'.out.webm"' retval=$? @@ -166,6 +175,4 @@ while true; do echo "Upload finished, deleting result!" rm "$input".out.webm fi - - done \ No newline at end of file diff --git a/src/workunit.rs b/src/workunit.rs index 97946dd..fb68c9e 100644 --- a/src/workunit.rs +++ b/src/workunit.rs @@ -47,7 +47,9 @@ pub struct EOptions { pub ffmpeg: String, pub aomenc: String, pub two_pass: bool, - pub pix_fmt: EPixFmt + pub pix_fmt: EPixFmt, + #[serde(default)] + pub fps: Option<(u16, u16)> } impl Default for EOptions { fn default() -> Self { @@ -55,7 +57,8 @@ impl Default for EOptions { 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, - pix_fmt: EPixFmt::I422 + pix_fmt: EPixFmt::I422, + fps: Option::None } } } diff --git a/test.sh b/test.sh index 0970a91..583c94f 100755 --- a/test.sh +++ b/test.sh @@ -14,7 +14,7 @@ curl "$base_url"/add_job -X POST -H "Content-Type: application/json" -d \ "file_url": "https://pomf.dodsorf.as/f/vz9dtl.mkv", "file_name": "014", "priority": 0, - "length": 15, + "length": 20, "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",