Make pix_fmt configurable

This commit is contained in:
Daniel Løvbrøtte Olsen 2020-04-01 01:10:15 +02:00
parent c965401286
commit 3917ccea47
2 changed files with 26 additions and 3 deletions

View File

@ -80,12 +80,27 @@ while true; do
ffmpego=`echo $job | jq -r .description.options.ffmpeg`
ffmpego=${ffmpego//[^a-zA-Z0-9_\- =:]/}
pix_fmt=`echo $job | jq -r .description.options.pix_fmt`
if [[ $pix_fmt = "YV12" ]]; then
ffpix="yv12p"
aompix="--yv12"
elif [[ $pix_fmt = "I420" ]]; then
ffpix="yv420p"
aompix="--i420"
elif [[ $pix_fmt = I422 ]]; then
ffpix="yv422p"
aompix="--i422"
elif [[ $pix_fmt = I444 ]]; then
ffpix="yv444p"
aompix="--i444"
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 yuv422p -f yuv4mpegpipe - | aomenc - --i422 '$aomenco' \
-i "'$input'" '$ffmpego' -vf scale='$height':'$width' -pix_fmt '$ffpix' -f yuv4mpegpipe - | aomenc - '$aompix' '$aomenco' \
--pass=1 --passes=2 --fpf="'$input'.fpf" --webm -o "'$input'.out.webm"'
retval=$?
@ -97,7 +112,7 @@ while true; do
fi
eval 'ffmpeg -nostats -hide_banner -loglevel warning \
-i "'$input'" '$ffmpego' -vf scale='$height':'$width' -pix_fmt yuv422p -f yuv4mpegpipe - | aomenc - --i422 '$aomenco' \
-i "'$input'" '$ffmpego' -vf scale='$height':'$width' -pix_fmt '$ffpix' -f yuv4mpegpipe - | aomenc - '$aompix' '$aomenco' \
--pass=2 --passes=2 --fpf="'$input'.fpf" --webm -o "'$input'.out.webm"'
retval=$?
@ -112,7 +127,7 @@ while true; do
else
set +e
eval 'ffmpeg -nostats -hide_banner -loglevel warning \
-i "'$input'" '$ffmpego' -vf scale='$height':'$width' -pix_fmt yuv422p -f yuv4mpegpipe - | aomenc - --i422 '$aomenco' \
-i "'$input'" '$ffmpego' -vf scale='$height':'$width' -pix_fmt '$ffpix' -f yuv4mpegpipe - | aomenc - '$aompix' '$aomenco' \
--passes=1 --fpf="'$input'.fpf" --webm -o "'$input'.out.webm"'
retval=$?

View File

@ -47,6 +47,7 @@ pub struct EOptions {
pub ffmpeg: String,
pub aomenc: String,
pub two_pass: bool,
pub pix_fmt: EPixFmt
}
impl Default for EOptions {
fn default() -> Self {
@ -70,4 +71,11 @@ impl Default for EStatus {
fn default() -> Self {
EStatus::Queued
}
}
pub enum EPixFmt {
YV12,
I420,
I422,
I444
}