From 5d999a9c97b986ff513aa6df71719914a41cb3eb Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 20 Feb 2022 04:14:55 +0100 Subject: Fix video thumbnail not maintaining aspect ratio --- TODO | 3 ++- src/FileAnalyzer.cpp | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index 4c2611d..b437734 100644 --- a/TODO +++ b/TODO @@ -221,4 +221,5 @@ Add ctrl+o keybind to open the selected media in an external application (video, Local anime bookmark. Local anime history. Replace youtube subscriptions page (rss) with youtube api. This allows us to get get video status for videos (and description). -Add watch progress to youtube (and maybe also lbry and peertube?). \ No newline at end of file +Add watch progress to youtube (and maybe also lbry and peertube?). +Ctrl+R set chapter to finished reading in chapters page. \ No newline at end of file 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; -- cgit v1.2.3