Closed Fetchinator7 closed 3 years ago
I wrote a bash script to work around this problem which I'll provide incase anyone else wants it.
(bash
comes with git incase you don't already have bash
on Windows 10).
You run it from the command line like this: path/to/script/file.sh "https://youtu.be/QH2-TGUlwu4"
#!/bin/bash
# Get the command line input.
LINK_STR="$1"
TITLE_TEMPLATE="%(title)s.%(ext)s"
# Path to the folder you want to download to.
# This could be substituted with "$2" then you'd include the output folder as the second argument when executing this file.
OUTPUT_PATH="/example/path"
cd $OUTPUT_PATH
# Download the thumbnail.
youtube-dl -o $TITLE_TEMPLATE --write-thumbnail --skip-download $LINK_STR
# Get the title of the video that was downloaded to search for in the output folder.
OUTPUT_TITLE="$(youtube-dl -o $TITLE_TEMPLATE --get-title $LINK_STR)"
# Get the full path to the thumbnail file.
DOWNLOADED_THUMBNAIL_PATH="$(find $OUTPUT_PATH -type f -name "$OUTPUT_TITLE.*")"
# Change thumbnail extension to .jpg with ffmpeg.
ffmpeg -i "$DOWNLOADED_THUMBNAIL_PATH" "${DOWNLOADED_THUMBNAIL_PATH%.*}.jpg" -hide_banner
rm "$DOWNLOADED_THUMBNAIL_PATH"
This is expected behavior.
Checklist
Verbose log
Description
When
--skip-download
is an argument--exec
doesn't run which creates issues when--exec
is used in conjunction with other options like--write-thumbnail
.I want to download just the thumbnail for videos and change the thumbnail extension to
.jpg
since sometimes the thumbnails come through as.webp
. The simplest solution would be getting the path and converting it right after it downloads, but currently that's not possible since--exec
doesn't run.