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

Thumbnails still not being embedded in (webm/jpg -> mkv) (also seen in closed issue #5840) #6046

Open
vxbinaca opened this issue Jun 22, 2015 · 27 comments

Comments

@vxbinaca
Copy link
Contributor

@vxbinaca vxbinaca commented Jun 22, 2015

vxbinaca@lappy/~$ youtube-dl --verbose --ignore-config --embed-thumbnail https://www.youtube.com/watch?v=QOLi1GvyBHs

[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'--verbose', u'--ignore-config', u'--embed-thumbnail', u'https://www.youtube.com/watch?v=QOLi1GvyBHs']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2015.06.15
[debug] Python version 2.7.9 - Linux-3.19.0-20-generic-x86_64-with-Ubuntu-15.04-vivid
[debug] exe versions: avconv 11.2-6, avprobe 11.2-6
[debug] Proxy map: {}
[youtube] QOLi1GvyBHs: Downloading webpage
[youtube] QOLi1GvyBHs: Extracting video information
[youtube] QOLi1GvyBHs: Downloading DASH manifest
[youtube] QOLi1GvyBHs: Downloading thumbnail ...
[youtube] QOLi1GvyBHs: Writing thumbnail to: HuniePop X Robin-QOLi1GvyBHs.jpg
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[debug] Invoking downloader on 'https://r3---sn-uhvcpax0n5-hjvl.googlevideo.com/videoplayback?id=40e2e2d46bf2047b&itag=302&source=youtube&requiressl=yes&pcm2cms=yes&pl=23&ms=au&mv=m&mn=sn-uhvcpax0n5-hjvl&mm=31&ratebypass=yes&mime=video/webm&gir=yes&clen=26505944&lmt=1434765936584526&dur=95.612&upn=nBbu_YnbPm4&signature=1245159F65113B8F1434E6BD7353428EB692E169.0126AA038788D8504301719B5F0390FC28FF431C&fexp=9407141,9408142,9408420,9408710,9408856,9412773,9412840,9412988,9413503,9415304,9415635,9416126,9416289,9416456,952640&mt=1434948902&sver=3&key=dg_yt0&ip=172.56.27.126&ipbits=0&expire=1434970568&sparams=ip,ipbits,expire,id,itag,source,requiressl,pcm2cms,pl,ms,mv,mn,mm,ratebypass,mime,gir,clen,lmt,dur'
[download] Destination: HuniePop X Robin-QOLi1GvyBHs.f302.webm
[download] 100% of 25.28MiB in 00:14
[debug] Invoking downloader on 'https://r3---sn-uhvcpax0n5-hjvl.googlevideo.com/videoplayback?id=40e2e2d46bf2047b&itag=140&source=youtube&requiressl=yes&pcm2cms=yes&pl=23&ms=au&mv=m&mn=sn-uhvcpax0n5-hjvl&mm=31&ratebypass=yes&mime=audio/mp4&gir=yes&clen=1520780&lmt=1434874413597243&dur=95.712&upn=nBbu_YnbPm4&signature=93DA72014070F112214F1F8F7D7FE42F4CBB6116.877584EAAFD2ABD30BCEA12DF7E9A0A06395A70E&fexp=9407141,9408142,9408420,9408710,9408856,9412773,9412840,9412988,9413503,9415304,9415635,9416126,9416289,9416456,952640&mt=1434948902&sver=3&key=dg_yt0&ip=172.56.27.126&ipbits=0&expire=1434970568&sparams=ip,ipbits,expire,id,itag,source,requiressl,pcm2cms,pl,ms,mv,mn,mm,ratebypass,mime,gir,clen,lmt,dur'
[download] Destination: HuniePop X Robin-QOLi1GvyBHs.f140.m4a
[download] 100% of 1.45MiB in 00:01
[ffmpeg] Merging formats into "HuniePop X Robin-QOLi1GvyBHs.mkv"
[debug] ffmpeg command line: avconv -y -i 'HuniePop X Robin-QOLi1GvyBHs.f302.webm' -i 'HuniePop X Robin-QOLi1GvyBHs.f140.m4a' -c copy -map 0:v:0 -map 1:a:0 'HuniePop X Robin-QOLi1GvyBHs.temp.mkv'
Deleting original file HuniePop X Robin-QOLi1GvyBHs.f302.webm (pass -k to keep)
Deleting original file HuniePop X Robin-QOLi1GvyBHs.f140.m4a (pass -k to keep)
ERROR: Only mp3 and m4a/mp4 are supported for thumbnail embedding for now.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 1548, in post_process
    files_to_delete, info = pp.run(info)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/postprocessor/embedthumbnail.py", line 85, in run
    raise EmbedThumbnailPPError('Only mp3 and m4a/mp4 are supported for thumbnail embedding for now.')
EmbedThumbnailPPError
@vxbinaca vxbinaca changed the title Thumbnails still not being embedded in (webm/jpg -> mkv) Thumbnails still not being embedded in (webm/jpg -> mkv) (also seen in issue #5840) Jun 22, 2015
@vxbinaca vxbinaca changed the title Thumbnails still not being embedded in (webm/jpg -> mkv) (also seen in issue #5840) Thumbnails still not being embedded in (webm/jpg -> mkv) (also seen in closed issue #5840) Jun 22, 2015
@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jul 2, 2015

@pulpe Seems the ffmpeg approach in EmbedThumbnailPP works for mkv format, too. Would you like to add mkv to allowed extensions?

@vxbinaca
Copy link
Contributor Author

@vxbinaca vxbinaca commented Jul 2, 2015

@yan12125 if someone were to specify avconv as an encoder wouldn't this bug creep back up?

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jul 3, 2015

Thanks for reminding. I've just tested against ffmpeg 2.5.7 and avconv 11.2 on ubuntu 15.04, and both works. Something weird is that avconv adds the image twice:

Input #0, matroska,webm, from 'HuniePop X Robin-QOLi1GvyBHs.mkv':
  Metadata:
    ENCODER         : Lavf56.1.0
  Duration: 00:01:35.71, start: 0.000000, bitrate: N/A
    Stream #0.0(eng): Video: vp9, yuv420p, 1280x720, PAR 1:1 DAR 16:9, 60.61 fps, 1k tbn (default)
    Metadata:
      title           : "Album cover"
      LANGUAGE        : eng
      COMMENT         : "Cover (Front)"
    Stream #0.1(und): Audio: aac, 44100 Hz, stereo, fltp (default)
    Metadata:
      CREATION_TIME   : 2015-06-21 08:13:15
      LANGUAGE        : und
      HANDLER_NAME    : SoundHandler
    Stream #0.2: Video: mjpeg, yuvj420p, 480x360 [PAR 1:1 DAR 4:3], 1k tbn
    Metadata:
      title           : "Album cover"
      COMMENT         : "Cover (Front)"
    Stream #0.3: Video: mjpeg, yuvj420p, 480x360 [PAR 1:1 DAR 4:3], 1k tbn
    Metadata:
      title           : "Album cover"
      COMMENT         : "Cover (Front)"
# avprobe output
@vxbinaca
Copy link
Contributor Author

@vxbinaca vxbinaca commented Jul 3, 2015

Should I report this to avconv and keep you abreast of the status of the bug?

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jul 3, 2015

That would be fine. Not sure whether avconv needs different arguments than ffmpeg's. If this is the case, things are easy, otherwise we have to check avconv's version in EmbedThumbnailPP.

@vxbinaca
Copy link
Contributor Author

@vxbinaca vxbinaca commented Jul 3, 2015

@yan12125 rule out the problem being on youtube-dl's end, and I'll file the report. Change the args if need be.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Feb 20, 2016

Much apologies for being late. mkv will be supported for thumbnail embedding in the next version. However, avconv may throw the same error as in #7238. If so, use ffmpeg instead.

@vxbinaca
Copy link
Contributor Author

@vxbinaca vxbinaca commented Feb 20, 2016

Thanks I'll update my config to force ffmpeg use.

yan12125 added a commit that referenced this issue Oct 20, 2016
This reverts commit 7360db0.

This commit was added as an attempt to fix #6046. Unfortunately, the fix
is completely wrong. As reported on #10359, embedded thumbnails are not
displayed in VLC, and Se7en on IRC reports that the embedded thumbnail
misleads mpv as well.

The correct way is using -attachment of ffmpeg, while the current
run_ffmpeg_multiple_files API can't handle it cleanly.
@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Oct 20, 2016

The way I embed thumbnails to mkv was wrong and misleads players like VLC and mpv, so I disable it until the correct approach is implemented..

@yan12125 yan12125 reopened this Oct 20, 2016
@XJDHDR
Copy link

@XJDHDR XJDHDR commented Feb 15, 2017

If this helps at all, the correct way to add a thumbnail to a MKV container is to add an attachment called either "cover.jpg/png" or "cover_land.jpg/png". I'm currently adding this to youtube-dl to command FFmpeg to add that attachment:
--postprocessor-args "-attach c:/location/of/image/cover.jpg -metadata:s:t mimetype=image/jpeg"

You can find info regarding how thumbnails are used in MKVs here:
https://matroska.org/technical/cover_art/index.html
Note that while those documents state that the maximum size for a thumbnail's shortest side is 600 pixels, I attached a 720p image as a thumbnail and I haven't seen FFmpeg, Icaros or VLC complain. I think the most important part is that the thumbnail be an attachment named correctly.

@vijayaraghavanramanan
Copy link

@vijayaraghavanramanan vijayaraghavanramanan commented Sep 12, 2017

Any update on this?

@Dialga
Copy link

@Dialga Dialga commented Nov 4, 2018

@yan12125 any updates on this?

@Barafu
Copy link

@Barafu Barafu commented Feb 8, 2019

We are still waiting for this.

@aksh1618
Copy link

@aksh1618 aksh1618 commented Mar 10, 2019

Would love this to be fixed.

@pqhf5kd
Copy link

@pqhf5kd pqhf5kd commented Dec 19, 2019

Any updates?

@diamondsw
Copy link

@diamondsw diamondsw commented Mar 8, 2020

At risk of getting banned, seriously - this issue has been open for years, has a lot of interest (thus the comments looking for help here and the number of related and duplicate bugs) - could we at least know more about the holdup? What is the technical issue blocking this, so that maybe we can help?

Ugh, there is no technical issue. The patch has been seemingly done for almost two years and @dstftw hasn't reviewed the changes that he himself requested (see #15445 ).

@ilovelinux
Copy link

@ilovelinux ilovelinux commented Apr 6, 2020

I hope the PR will be requested soon! Can't wait for this feature

@nt4f04uNd
Copy link

@nt4f04uNd nt4f04uNd commented Apr 27, 2020

Guys, I think you really ought to add this feature, this issue is opened more than 5 years along

@Nicktheslick69
Copy link

@Nicktheslick69 Nicktheslick69 commented Apr 28, 2020

Hello everyone, initially I turned to the internet to solve this problem and came across this thread detailing how the feature wasn't implemented yet so I continued to do more digging and eventually found a user named MrDoritos on reddit who created this pull request: #22659

In order to get this working it took some fiddling and communication between the creator but I finally figured it out and forgot about this thread entirely so I will go into as much detail as possible. Another thing I wanted to add before anyone attempts this, I installed vanilla youtube-dl through python so I don't know where you would find the paths if you installed another way.

                                         Two Steps:
  1. Go to MrDoritos pull request, find: /youtube_dl/postprocessor/embedthumbnail.py and proceed to download "embedthumbnail.py".

  2. Navigate to ”AppData/Local/Programs/Python/Python37-32/Lib/site-packages/youtube_dl/postprocessor” and replace the old embedthumbnail.py with the MrDoritos version and everything should run flawlessly.

                                         That's All.
    

This works with the latest versions of youtube-dl although if you decide to update youtube-dl when the time comes, you will have to replace embedthumbnail.py in appdata with the doritos variant as mentioned in the steps above.

For those of you who will ask why I didn't clone the entire repo and install is through python, I couldn't get it to push changes to the embedthumbnail.py in appdata and installing his entire pull request implies you would be installing everything else along with it that isn't up to date.

I am so very sorry you guys had to suffer my mobile formatting from before, I have adjusted the links as well. I am also not sure which of the many previous updates to youtube-dl are compatible, I do know that this has worked for me since youtube-dl version 2020.1.1 and has continued to work with the recently released youtube-dl version 2020.03.24

@Dialga
Copy link

@Dialga Dialga commented Apr 28, 2020

@Nicktheslick69 link the right branch because it's not in his master, it's in mkvthumbnail.

@Nicktheslick69
Copy link

@Nicktheslick69 Nicktheslick69 commented Apr 28, 2020

@Nicktheslick69 link the right branch because it's not in his master, it's in mkvthumbnail.

Thanks, I don't know how I looked past that the first time. I will be sure to update my original reply.

@nt4f04uNd
Copy link

@nt4f04uNd nt4f04uNd commented Apr 28, 2020

@Nicktheslick69 you should restructure your answer into short readable instructions.

Also please list the right working versions of the McDoritos repo and youtube-dl itself, so if something will eventually change and break, people could lookup for these versions and use them.

@diamondsw
Copy link

@diamondsw diamondsw commented May 4, 2020

@Nicktheslick69 you should restructure your answer into short readable instructions.

The original pull request should be merged.

@SamuelKurtzer
Copy link

@SamuelKurtzer SamuelKurtzer commented Jun 29, 2020

Any update on whats stopping the pull request from being merged? Need more testing or something?

@zxHreQK
Copy link

@zxHreQK zxHreQK commented Jun 30, 2020

+1

1 similar comment
@irateadmin
Copy link

@irateadmin irateadmin commented Sep 9, 2020

+1

@Nicktheslick69
Copy link

@Nicktheslick69 Nicktheslick69 commented Sep 9, 2020

I don't think I mentioned this before since I had everything running smoothly on windows 10.

I recently tried running my youtube-dl configuration on my raspberry pi and after a lengthy troubleshooting process of auto mounting my network drives and getting used to the linux filesystem, the thumbnails weren't embedding even with the most recent version of dorito's embedthumbnail.py

My frustration grew until I decided to look inside the python file and saw that his modification calls AtomicParsley to embed the thumbnail, I installed it through apt and it worked.

Now my only issue is figuring out the best way to schedule the script to run on an interval akin to the task scheduler in windows. That's my problem though and I just wanted to inform anyone who tried this out unsuccessfully to install AtomicParsley and see if that is the issue.

If anyone is native to linux and schedules youtube-dl a better way than cron I would love to know how. Thank you

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