mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-16 16:37:48 +01:00
Update ffmpeg args
This commit is contained in:
@@ -43,7 +43,7 @@ namespace Flowframes
|
|||||||
IoUtils.RenameExistingFile(outPath);
|
IoUtils.RenameExistingFile(outPath);
|
||||||
string loopStr = (looptimes > 0) ? $"-stream_loop {looptimes}" : "";
|
string loopStr = (looptimes > 0) ? $"-stream_loop {looptimes}" : "";
|
||||||
string vfrFilename = Path.GetFileName(concatFile);
|
string vfrFilename = Path.GetFileName(concatFile);
|
||||||
string args = $" {loopStr} -vsync 1 -f concat -i {vfrFilename} -c copy -movflags +faststart -fflags +genpts {outPath.Wrap()}";
|
string args = $" {loopStr} -fps_mode cfr -f concat -i {vfrFilename} -c copy -movflags +faststart -fflags +genpts {outPath.Wrap()}";
|
||||||
await RunFfmpeg(args, concatFile.GetParentDir(), LogMode.Hidden);
|
await RunFfmpeg(args, concatFile.GetParentDir(), LogMode.Hidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace Flowframes.Media
|
|||||||
{
|
{
|
||||||
string pre = i == 0 ? "" : $" && ffmpeg {AvProcess.GetFfmpegDefaultArgs()}";
|
string pre = i == 0 ? "" : $" && ffmpeg {AvProcess.GetFfmpegDefaultArgs()}";
|
||||||
string post = (i == 0 && encArgs.Length > 1) ? $"-f null -" : outPath.Wrap();
|
string post = (i == 0 && encArgs.Length > 1) ? $"-f null -" : outPath.Wrap();
|
||||||
args += $"{pre} -vsync 0 {GetFfmpegExportArgsIn(fps, itsScale)} {inArg} {encArgs[i]} {GetFfmpegExportArgsOut(resampleFps, extraData, Interpolate.currentSettings.outMode, isChunk)} {post} ";
|
args += $"{pre} {GetFfmpegExportArgsIn(fps, itsScale)} {inArg} {encArgs[i]} {GetFfmpegExportArgsOut(resampleFps, extraData, Interpolate.currentSettings.outMode, isChunk)} {post} ";
|
||||||
}
|
}
|
||||||
|
|
||||||
await RunFfmpeg(args, framesFile.GetParentDir(), logMode, !isChunk);
|
await RunFfmpeg(args, framesFile.GetParentDir(), logMode, !isChunk);
|
||||||
@@ -98,7 +98,7 @@ namespace Flowframes.Media
|
|||||||
string vf = (resampleFps.GetFloat() < 0.1f) ? "" : $"-vf fps=fps={resampleFps}";
|
string vf = (resampleFps.GetFloat() < 0.1f) ? "" : $"-vf fps=fps={resampleFps}";
|
||||||
string compression = format == "png" ? pngCompr : $"-q:v {lossyQ}";
|
string compression = format == "png" ? pngCompr : $"-q:v {lossyQ}";
|
||||||
string codec = format == "webp" ? "-c:v libwebp" : ""; // Specify libwebp to avoid putting all frames into single animated WEBP
|
string codec = format == "webp" ? "-c:v libwebp" : ""; // Specify libwebp to avoid putting all frames into single animated WEBP
|
||||||
string args = $"-vsync 0 -r {rate} {inArg} {codec} {compression} {sn} {vf} \"{outDir}/%{Padding.interpFrames}d.{format}\"";
|
string args = $"-r {rate} {inArg} {codec} {compression} {sn} {vf} -fps_mode passthrough \"{outDir}/%{Padding.interpFrames}d.{format}\"";
|
||||||
await RunFfmpeg(args, framesFile.GetParentDir(), logMode, "error", true);
|
await RunFfmpeg(args, framesFile.GetParentDir(), logMode, "error", true);
|
||||||
IoUtils.TryDeleteIfExists(linksDir);
|
IoUtils.TryDeleteIfExists(linksDir);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace Flowframes.Media
|
|||||||
|
|
||||||
string scnDetect = $"-vf \"select='gt(scene,{Config.GetFloatString(Config.Key.scnDetectValue)})'\"";
|
string scnDetect = $"-vf \"select='gt(scene,{Config.GetFloatString(Config.Key.scnDetectValue)})'\"";
|
||||||
string rateArg = (rate.GetFloat() > 0) ? $"-r {rate}" : "";
|
string rateArg = (rate.GetFloat() > 0) ? $"-r {rate}" : "";
|
||||||
string args = $"-vsync 0 {GetTrimArg(true)} {inArg} {GetImgArgs(format)} {rateArg} {scnDetect} -frame_pts 1 -s 256x144 {GetTrimArg(false)} \"{outDir}/%{Padding.inputFrames}d{format}\"";
|
string args = $"{GetTrimArg(true)} {inArg} {GetImgArgs(format)} {rateArg} {scnDetect} -fps_mode passthrough -frame_pts 1 -s 256x144 {GetTrimArg(false)} \"{outDir}/%{Padding.inputFrames}d{format}\"";
|
||||||
|
|
||||||
LogMode logMode = Interpolate.currentMediaFile.FrameCount > 50 ? LogMode.OnlyLastLine : LogMode.Hidden;
|
LogMode logMode = Interpolate.currentMediaFile.FrameCount > 50 ? LogMode.OnlyLastLine : LogMode.Hidden;
|
||||||
await RunFfmpeg(args, logMode, inputIsFrames ? "panic" : "warning", true);
|
await RunFfmpeg(args, logMode, inputIsFrames ? "panic" : "warning", true);
|
||||||
@@ -82,7 +82,7 @@ namespace Flowframes.Media
|
|||||||
string filters = FormatUtils.ConcatStrings(new[] { GetPadFilter(), mpStr });
|
string filters = FormatUtils.ConcatStrings(new[] { GetPadFilter(), mpStr });
|
||||||
string vf = filters.Length > 2 ? $"-vf {filters}" : "";
|
string vf = filters.Length > 2 ? $"-vf {filters}" : "";
|
||||||
string rateArg = (rate.GetFloat() > 0) ? $" -r {rate}" : "";
|
string rateArg = (rate.GetFloat() > 0) ? $" -r {rate}" : "";
|
||||||
string args = $"{GetTrimArg(true)} -i {inputFile.Wrap()} {GetImgArgs(format, true, alpha)} -vsync 0 {rateArg} -frame_pts 1 {vf} {sizeStr} {GetTrimArg(false)} \"{framesDir}/%{Padding.inputFrames}d{format}\"";
|
string args = $"{GetTrimArg(true)} -i {inputFile.Wrap()} {GetImgArgs(format, true, alpha)} -fps_mode passthrough {rateArg} -frame_pts 1 {vf} {sizeStr} {GetTrimArg(false)} \"{framesDir}/%{Padding.inputFrames}d{format}\"";
|
||||||
LogMode logMode = Interpolate.currentMediaFile.FrameCount > 50 ? LogMode.OnlyLastLine : LogMode.Hidden;
|
LogMode logMode = Interpolate.currentMediaFile.FrameCount > 50 ? LogMode.OnlyLastLine : LogMode.Hidden;
|
||||||
await RunFfmpeg(args, logMode, true);
|
await RunFfmpeg(args, logMode, true);
|
||||||
int amount = IoUtils.GetAmountOfFiles(framesDir, false, "*" + format);
|
int amount = IoUtils.GetAmountOfFiles(framesDir, false, "*" + format);
|
||||||
@@ -226,7 +226,7 @@ namespace Flowframes.Media
|
|||||||
|
|
||||||
string sizeStr = (size.Width > 1 && size.Height > 1) ? $"-s {size.Width}x{size.Height}" : "";
|
string sizeStr = (size.Width > 1 && size.Height > 1) ? $"-s {size.Width}x{size.Height}" : "";
|
||||||
string vf = $"-vf {GetPadFilter()}";
|
string vf = $"-vf {GetPadFilter()}";
|
||||||
string args = $"-r 25 {inArg} {GetImgArgs(format, true, alpha)} {sizeStr} -vsync 0 -start_number 0 {vf} \"{outPath}/%{Padding.inputFrames}d{format}\"";
|
string args = $"-r 25 {inArg} {GetImgArgs(format, true, alpha)} {sizeStr} -fps_mode passthrough -start_number 0 {vf} \"{outPath}/%{Padding.inputFrames}d{format}\"";
|
||||||
LogMode logMode = IoUtils.GetAmountOfFiles(inPath, false) > 50 ? LogMode.OnlyLastLine : LogMode.Hidden;
|
LogMode logMode = IoUtils.GetAmountOfFiles(inPath, false) > 50 ? LogMode.OnlyLastLine : LogMode.Hidden;
|
||||||
await RunFfmpeg(args, logMode, "panic");
|
await RunFfmpeg(args, logMode, "panic");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ namespace Flowframes.Media
|
|||||||
{
|
{
|
||||||
int cq = Config.GetInt(Config.Key.av1Crf);
|
int cq = Config.GetInt(Config.Key.av1Crf);
|
||||||
string g = GetKeyIntArg(fps, keyint);
|
string g = GetKeyIntArg(fps, keyint);
|
||||||
return new string[] { $"-c:v {GetEnc(codec)} -b:v 0 -qp {cq} {GetSvtAv1Speed()} {g} -svtav1-params enable-overlays=0:enable-tf=0:scd=0 -pix_fmt {GetPixFmt()}" };
|
return new string[] { $"-c:v {GetEnc(codec)} -b:v 0 -qp {cq} {GetSvtAv1Speed()} {g} -svtav1-params enable-qm=1:enable-overlays=1:enable-tf=0:scd=0 -pix_fmt {GetPixFmt()}" };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (codec == Codec.Vp9)
|
if (codec == Codec.Vp9)
|
||||||
|
|||||||
Reference in New Issue
Block a user