aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-02-20 04:14:55 +0100
committerdec05eba <dec05eba@protonmail.com>2022-02-20 04:14:55 +0100
commit5d999a9c97b986ff513aa6df71719914a41cb3eb (patch)
tree2119f3941364e7f589bafa0357d58015505e6c35 /src
parent7885bec3b304f79b1933156b624a293df64f7aa3 (diff)
Fix video thumbnail not maintaining aspect ratio
Diffstat (limited to 'src')
-rw-r--r--src/FileAnalyzer.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/FileAnalyzer.cpp b/src/FileAnalyzer.cpp
index 2ce8250..5b67b8d 100644
--- a/src/FileAnalyzer.cpp
+++ b/src/FileAnalyzer.cpp
@@ -136,10 +136,10 @@ namespace QuickMedia {
snprintf(middle_seconds_str, sizeof(middle_seconds_str), "%d", middle_seconds);
if(width > 0 && height > 0) {
- char framesize[128];
- snprintf(framesize, sizeof(framesize), "%dx%d", width, height);
+ char size_arg_str[512];
+ snprintf(size_arg_str, sizeof(size_arg_str), "scale=%d:%d:force_original_aspect_ratio=decrease", width, height);
- const char *program_args[] = { "ffmpeg", "-y", "-v", "quiet", "-ss", middle_seconds_str, "-i", file.get_filepath().c_str(), "-vframes", "1", "-s", framesize, "--", destination_path_tmp.data.c_str(), nullptr };
+ const char *program_args[] = { "ffmpeg", "-y", "-v", "quiet", "-ss", middle_seconds_str, "-i", file.get_filepath().c_str(), "-vframes", "1", "-vf", size_arg_str, "--", destination_path_tmp.data.c_str(), nullptr };
if(exec_program(program_args, nullptr, nullptr) != 0) {
fprintf(stderr, "Failed to execute ffmpeg, maybe its not installed?\n");
return false;