perf: correct ffmpeg
params for efficient video previews
-ss before -i ("When used as an output option (before an output url), decodes but discards input until the timestamps reach position. ") discard all non-keyframes turn off accurate seek
This commit is contained in:
parent
e48e007617
commit
327b87a18a
1 changed files with 4 additions and 1 deletions
|
@ -30,9 +30,12 @@ impl<'a> Previewable for VideoPath<'a> {
|
||||||
let outfile = tempfile::Builder::new().suffix(".webp").tempfile()?;
|
let outfile = tempfile::Builder::new().suffix(".webp").tempfile()?;
|
||||||
let thumbnail_cmd = Command::new("ffmpeg")
|
let thumbnail_cmd = Command::new("ffmpeg")
|
||||||
.args(["-threads", "1"])
|
.args(["-threads", "1"])
|
||||||
|
.args(["-discard", "nokey"])
|
||||||
|
.args(["-noaccurate_seek"])
|
||||||
|
.args(["-ss", &(90f64.min(duration / 2.0)).to_string()])
|
||||||
.args(["-i", &self.0.to_string_lossy()])
|
.args(["-i", &self.0.to_string_lossy()])
|
||||||
.args(["-vframes", "1"])
|
.args(["-vframes", "1"])
|
||||||
.args(["-ss", &(90f64.min(duration / 2.0)).to_string()])
|
.args(["-vsync", "passthrough"])
|
||||||
.arg(&*outfile.path().to_string_lossy())
|
.arg(&*outfile.path().to_string_lossy())
|
||||||
.arg("-y")
|
.arg("-y")
|
||||||
.output()?;
|
.output()?;
|
||||||
|
|
Loading…
Reference in a new issue