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

--thumbnail-from-video option to extract the thumbnail from the video #25271

Open
johelegp opened this issue May 13, 2020 · 2 comments
Open

--thumbnail-from-video option to extract the thumbnail from the video #25271

johelegp opened this issue May 13, 2020 · 2 comments
Labels

Comments

@johelegp
Copy link

@johelegp johelegp commented May 13, 2020

Checklist

  • I'm reporting a feature request
  • I've verified that I'm running youtube-dl version 2020.05.08
  • I've searched the bugtracker for similar feature requests including closed ones

Description

Feature request: A --thumbnail-from-video option to extract the thumbnail (to be used by the other thumbnail options) from the video (for better image quality).

I'm personally going to use this with music videos that have a static image throughout the whole video. Some have a mostly static image, so to avoid corner cases, perhaps some further-refining options may be required. Like for:

  • getting the image from the middle of the video to avoid any initial effects,
  • and maybe only if seeking is supported to save bandwidth.
  • If the above refinements aren't used, and the default is to use the first frame of the video, check that the image isn't unreasonable (like all black) and fall back to the usual thumbnail.
@johelegp johelegp added the request label May 13, 2020
@johelegp
Copy link
Author

@johelegp johelegp commented Jun 27, 2020

For now, I've gone with the following as a post-process step on my m4a files:

--restrict-filenames
--output "%(title)s.%(id)s.%(ext)s"
--format bestvideo[height<=720]
--exec "hq_cover {}"
#!/bin/bash
# "$1" is the video
set -e
file=${1%.*}
ffmpeg -sseof -00:00:20 -i "$1" -frames:v 1 "$file.png"
ffmpeg -i "$file.m4a" -i "$file.png" -c copy "$file.with_cover.mp4"
rm "$1" "$file.png"
mv "$file.with_cover.mp4" "$file.m4a"
@johelegp
Copy link
Author

@johelegp johelegp commented Jun 27, 2020

For https://www.youtube.com/watch?v=cEFStFTtBxI, here's what --embed-thumbnail gives me:
HardStyle_-_L S D_Love_Sadness_and_Desire cEFStFTtBxI
That's better than what --write-thumbnail, --write-all-thumbnails and --list-thumbnails have to offer.
This is the quality I get with the post-processing in the comment above:
HardStyle_-_L S D_Love_Sadness_and_Desire cEFStFTtBxI

Then there's https://www.youtube.com/watch?v=VzGxhMVd0pA, whose thumbnail is as tiny as it seems (--embed-thumbnail):
Dj_Splash_-_Bass_is_kicking VzGxhMVd0pA
This is the quality I get with the post-processing in the comment above:
Dj_Splash_-_Bass_is_kicking VzGxhMVd0pA

I might not want the author's thumbnail (--embed-thumbnail, https://www.youtube.com/watch?v=wF0bWnQXGqY):
Envy_Techno_-_Heaven_Rd _2 wF0bWnQXGqY
This is the thumbnail I get with the post-processing in the comment above:
Envy_Techno_-_Heaven_Rd _2 wF0bWnQXGqY

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
1 participant
You can’t perform that action at this time.