feature/insight-chat-improvements #83
@@ -108,15 +108,27 @@ pub async fn create_playlist(video_path: &str, playlist_file: &str) -> Result<Ch
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn generate_video_thumbnail(path: &Path, destination: &Path) -> std::io::Result<()> {
|
pub fn generate_video_thumbnail(path: &Path, destination: &Path) -> std::io::Result<()> {
|
||||||
|
// -vf scale + -c:v mjpeg mirrors `generate_image_thumbnail_ffmpeg`. The
|
||||||
|
// filter chain matters as much as the scale does: without it, ffmpeg
|
||||||
|
// hands the decoded frame straight to the mjpeg encoder, which rejects
|
||||||
|
// any non-yuvj420p source ("Non full-range YUV is non-standard"). The
|
||||||
|
// filter chain lets ffmpeg auto-insert the pix_fmt converter the
|
||||||
|
// encoder needs, which is how the image-thumbnail path already handles
|
||||||
|
// the same class of source.
|
||||||
let output = Command::new("ffmpeg")
|
let output = Command::new("ffmpeg")
|
||||||
|
.arg("-y")
|
||||||
.arg("-ss")
|
.arg("-ss")
|
||||||
.arg("3")
|
.arg("3")
|
||||||
.arg("-i")
|
.arg("-i")
|
||||||
.arg(path)
|
.arg(path)
|
||||||
.arg("-vframes")
|
.arg("-vframes")
|
||||||
.arg("1")
|
.arg("1")
|
||||||
|
.arg("-vf")
|
||||||
|
.arg("scale=200:-1")
|
||||||
.arg("-f")
|
.arg("-f")
|
||||||
.arg("image2")
|
.arg("image2")
|
||||||
|
.arg("-c:v")
|
||||||
|
.arg("mjpeg")
|
||||||
.arg(destination)
|
.arg(destination)
|
||||||
.output()?;
|
.output()?;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user