Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--exec doesn't run when --skip-download is specified #26859

Closed
Fetchinator7 opened this issue Oct 10, 2020 · 2 comments
Closed

--exec doesn't run when --skip-download is specified #26859

Fetchinator7 opened this issue Oct 10, 2020 · 2 comments

Comments

@Fetchinator7
Copy link

@Fetchinator7 Fetchinator7 commented Oct 10, 2020

Checklist

  • I'm reporting a broken site support issue
  • I've verified that I'm running youtube-dl version 2020.09.20
  • I've checked that all provided URLs are alive and playable in a browser
  • I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • I've searched the bugtracker for similar bug reports including closed ones
  • I've read bugs section in FAQ

Verbose log

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-o', u'%(title)s.%(ext)s', u'https://youtu.be/QH2-TGUlwu4', u'--write-thumbnail', u'--skip-download', u'--exec', u'ffmpeg -i {} {}.jpg', u'-v']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2020.09.20
[debug] Python version 2.7.15 (CPython) - Darwin-19.6.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.3.1, ffprobe 4.3.1, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] QH2-TGUlwu4: Downloading webpage
[debug] Default format spec: bestvideo+bestaudio/best
[youtube] QH2-TGUlwu4: Downloading thumbnail ...
[youtube] QH2-TGUlwu4: Writing thumbnail to: Nyan Cat [original].jpg

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.

@Fetchinator7
Copy link
Author

@Fetchinator7 Fetchinator7 commented Oct 10, 2020

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"
@dstftw
Copy link
Collaborator

@dstftw dstftw commented Oct 17, 2020

This is expected behavior.

@dstftw dstftw closed this Oct 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.