blackjack4494 / yt-dlc

media downloader and library for various sites.
The Unlicense
2.91k stars 368 forks source link

Audio track disappearing when including the thumbnail in the mkv #304

Closed Ev3rdown closed 1 year ago

Ev3rdown commented 3 years ago

Checklist

Verbose log

Initial config :

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v']
[debug] Loading archive file None
[debug] Encodings: locale cp1252, fs utf-8, out utf-8, pref cp1252
[debug] youtube-dlc version 2020.11.11-3
[debug] Python version 3.8.6 (CPython) - Windows-10-10.0.19041-SP0
[debug] exe versions: ffmpeg n4.3.2-160-gfbb9368226, ffprobe n4.3.2-160-gfbb9368226
With "--embed-thumbnail" in the command ```powershell PS D:\Bazard\youtube-dl> .\youtube-dlc.exe -v -f bestvideo+bestaudio[acodec^=opus]+bestaudio[acodec^=mp4] --add-metadata --embed-thumbnail "https://youtu.be/wDR_iDg-ttc" [debug] System config: [] [debug] User config: [] [debug] Custom config: [] [debug] Command-line args: ['-v', '-f', 'bestvideo+bestaudio[acodec^=opus]+bestaudio[acodec^=mp4]', '--add-metadata', '--embed-thumbnail', 'https://youtu.be/wDR_iDg-ttc'] [debug] Loading archive file None [debug] Encodings: locale cp1252, fs utf-8, out utf-8, pref cp1252 [debug] youtube-dlc version 2020.11.11-3 [debug] Python version 3.8.6 (CPython) - Windows-10-10.0.19041-SP0 [debug] exe versions: ffmpeg n4.3.2-160-gfbb9368226, ffprobe n4.3.2-160-gfbb9368226 [debug] Proxy map: {} [youtube] wDR_iDg-ttc: Downloading webpage [youtube] {18} signature length 107, html5 player 223a7479 [youtube] {299} signature length 107, html5 player 223a7479 [youtube] {303} signature length 107, html5 player 223a7479 [youtube] {399} signature length 107, html5 player 223a7479 [youtube] {136} signature length 107, html5 player 223a7479 [youtube] {247} signature length 107, html5 player 223a7479 [youtube] {298} signature length 107, html5 player 223a7479 [youtube] {302} signature length 103, html5 player 223a7479 [youtube] {398} signature length 107, html5 player 223a7479 [youtube] {135} signature length 107, html5 player 223a7479 [youtube] {244} signature length 107, html5 player 223a7479 [youtube] {397} signature length 103, html5 player 223a7479 [youtube] {134} signature length 107, html5 player 223a7479 [youtube] {243} signature length 107, html5 player 223a7479 [youtube] {396} signature length 107, html5 player 223a7479 [youtube] {133} signature length 107, html5 player 223a7479 [youtube] {242} signature length 107, html5 player 223a7479 [youtube] {395} signature length 107, html5 player 223a7479 [youtube] {160} signature length 107, html5 player 223a7479 [youtube] {278} signature length 107, html5 player 223a7479 [youtube] {394} signature length 107, html5 player 223a7479 [youtube] {140} signature length 107, html5 player 223a7479 [youtube] {249} signature length 107, html5 player 223a7479 [youtube] {250} signature length 103, html5 player 223a7479 [youtube] {251} signature length 103, html5 player 223a7479 [youtube] wDR_iDg-ttc: Downloading thumbnail ... [youtube] wDR_iDg-ttc: Writing thumbnail to: Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.webp WARNING: Requested formats are incompatible for merge and will be merged into mkv. [debug] Invoking downloader on 'https://r5---sn-25glen7l.googlevideo.com/videoplayback?expire=1616223856&ei=EEpVYJWGL66fxN8Puqy94Ak&ip=2a01%3Acb19%3A74c%3A8b00%3Aa820%3A6a5c%3Ae911%3A3479&id=o-APew27LKmBkoNiQZcXTxczd7zpU2-DnDSpgGwIUZYZmE&itag=299&aitags=133%2C134%2C135%2C136%2C160%2C242%2C243%2C244%2C247%2C278%2C298%2C299%2C302%2C303%2C394%2C395%2C396%2C397%2C398%2C399&source=youtube&requiressl=yes&mh=DA&mm=31%2C26&mn=sn-25glen7l%2Csn-4g5ednsl&ms=au%2Conr&mv=m&mvi=5&pl=30&initcwndbps=1225000&vprv=1&mime=video%2Fmp4&ns=9JOIZGteQ7RX77J4tVa10VcF&gir=yes&clen=97119237&dur=205.649&lmt=1585571850171374&mt=1616202048&fvip=5&keepalive=yes&fexp=24001374%2C24007246&c=WEB&txp=5432432&n=c67SPHua9SuRNw-tdD&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgAcQWdkgQtDchFXCoQOHntyhX-20fmsqzLKqleJpSZqYCIQDUgNL3-5RgZKwR_Qa_g26npd1CCHoXa4rs9DEFYZf4Tg%3D%3D&sig=AOq0QJ8wRgIhAO6NZrYPem8-NOvH8LkkHtHD_uthnIJNciZOyjcAulxMAiEAi0Hxd5bYaMy8JoIXZK64ev-5HF5JS8bgmHedN4ue6yk=&ratebypass=yes' [download] Destination: Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.f299.mp4 [download] 100% of 92.62MiB in 00:04 [debug] Invoking downloader on 'https://r5---sn-25glen7l.googlevideo.com/videoplayback?expire=1616223856&ei=EEpVYJWGL66fxN8Puqy94Ak&ip=2a01%3Acb19%3A74c%3A8b00%3Aa820%3A6a5c%3Ae911%3A3479&id=o-APew27LKmBkoNiQZcXTxczd7zpU2-DnDSpgGwIUZYZmE&itag=251&source=youtube&requiressl=yes&mh=DA&mm=31%2C26&mn=sn-25glen7l%2Csn-4g5ednsl&ms=au%2Conr&mv=m&mvi=5&pl=30&initcwndbps=1225000&vprv=1&mime=audio%2Fwebm&ns=9JOIZGteQ7RX77J4tVa10VcF&gir=yes&clen=3407113&dur=205.681&lmt=1585571535789561&mt=1616202048&fvip=5&keepalive=yes&fexp=24001374%2C24007246&c=WEB&txp=5431432&n=c67SPHua9SuRNw-tdD&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgOEy2ya7dn806mxrIA9TDu_WKHJHGsBYad1_bd3fQuQwCIQDkiE07FBeQk79zFysrB0VAuj4R8_gDACYvXXZpidrFdA%3D%3D&sig=AOq0QJ8wRAIgBbv1mj5gp08SzuSjU4yd0mNsajlHm8IN4QJ7W4BqBiICIB-swoRKO8DxcMrlhcHQXRUtMWrNXDxyoX3TcXKJMMBQ&ratebypass=yes' [download] Destination: Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.f251.webm [download] 100% of 3.25MiB in 00:00 [debug] Invoking downloader on 'https://r5---sn-25glen7l.googlevideo.com/videoplayback?expire=1616223856&ei=EEpVYJWGL66fxN8Puqy94Ak&ip=2a01%3Acb19%3A74c%3A8b00%3Aa820%3A6a5c%3Ae911%3A3479&id=o-APew27LKmBkoNiQZcXTxczd7zpU2-DnDSpgGwIUZYZmE&itag=140&source=youtube&requiressl=yes&mh=DA&mm=31%2C26&mn=sn-25glen7l%2Csn-4g5ednsl&ms=au%2Conr&mv=m&mvi=5&pl=30&initcwndbps=1225000&vprv=1&mime=audio%2Fmp4&ns=9JOIZGteQ7RX77J4tVa10VcF&gir=yes&clen=3329825&dur=205.705&lmt=1585571533368365&mt=1616202048&fvip=5&keepalive=yes&fexp=24001374%2C24007246&c=WEB&txp=5431432&n=c67SPHua9SuRNw-tdD&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhAOgaMuNyVIbR8pHyHIpRvNS8cdjJRWuy1J9MP3Xtfn3FAiEAiciYimmHelssPnSl9M6HwVcftncDlWbademCAT54PYU%3D&sig=AOq0QJ8wRgIhAOFp56A--TPa01TVahBtakeB8ESJX3kpxr2c9Qou5JxkAiEA2rkRx256XnOayFjDTCpVG6wsZBQIYFJ0rmbxc1zLIbc=&ratebypass=yes' [download] Destination: Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.f140.m4a [download] 100% of 3.18MiB in 00:00 [ffmpeg] Merging formats into "Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.mkv" [debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.f299.mp4" -i "file:Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.f251.webm" -i "file:Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.f140.m4a" -c copy -map "0:v:0" -map "1:a:0" -map "2:a:0" "file:Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.temp.mkv" Deleting original file Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.f140.m4a (pass -k to keep) Deleting original file Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.f299.mp4 (pass -k to keep) Deleting original file Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.f251.webm (pass -k to keep) [ffmpeg] Adding metadata to 'Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.mkv' [debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.mkv" -map 0 -c copy -metadata "title=Constellation" -metadata "date=20200330" -metadata "description= --lots of text-- " -metadata "purl=https://www.youtube.com/watch?v=wDR_iDg-ttc" -metadata "artist=Far Out, Karra" -metadata "album=Constellation" "file:Constellation - AMV - 「Anime MV 」-wDR_iDg-ttc.temp.mkv" [ffmpeg] Converting thumbnail "Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.webp" to JPEG [debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.webp" "-bsf:v" mjpeg2jpeg "file:Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.jpg" [ffmpeg] Adding thumbnail to "Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.mkv" [debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.mkv" -c copy -attach cover.jpg "-metadata:s:t" "mimetype=image/jpeg" "file:Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.temp.mkv" ```
MediaInfo result with cover and missing audio ``` Général Identifiant unique : 251588425267833593234894592940935878583 (0xBD462B0E660A37A89DBC5D650A1617B7) Nom complet : D:\Bazard\youtube-dl\Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.mkv Format : Matroska Version du format : Version 4 Taille du fichier : 95,9 Mio Durée : 3 min 25s Débit global moyen : 3 910 kb/s Nom du film : Constellation Description : lot of text Application utilisée : Lavf58.45.100 Bibliothèque utilisée : Lavf58.45.100 Couverture : Yes Commentaire : lot of text ErrorDetectionType : Per level 1 Attachments : cover.jpg <----------------cover is here ALBUM : Constellation ARTIST : Far Out, Karra DATE : 20200330 PURL : https://www.youtube.com/watch?v=wDR_iDg-ttc Vidéo ID : 1 Format : AVC Format/Info : Advanced Video Codec Profil du format : High@L4.2 Paramètres du format : CABAC / 3 Ref Frames Paramètres du format, CABAC : Oui Paramètres du format, RefFrames : 3 images Identifiant du codec : V_MPEG4/ISO/AVC Durée : 3 min 25s Largeur : 1 920 pixels Hauteur : 1 080 pixels Format à l'écran : 16/9 Type d'images/s : Constant Images par seconde : 60,000 Im/s Espace de couleurs : YUV Sous-échantillonnage de la chrominance : 4:2:0 Profondeur des couleurs : 8 bits Type de balayage : Progressif Titre : ISO Media file produced by Google Inc. Bibliothèque utilisée : x264 core 155 r2901 7d0ff22 Default : Oui Forced : Non Gamme de couleurs : Limited Coordonnées de chromaticité : BT.709 Caractéristiques du transfert : BT.709 Coefficients de la matrice : BT.709 Audio ID : 2 Format : Opus Identifiant du codec : A_OPUS Durée : 3 min 25s Canaux : 2 canaux Channel layout : L R Echantillonnage : 48,0 kHz Profondeur des couleurs : 32 bits Mode de compression : Avec perte Délai par rapport Vidéo : -14 ms Langue : Anglais Default : Oui Forced : Non ---------- Missing AAC audio here ------------ ```
Without "--embed-thumbnail" in the command ```powershell PS D:\Bazard\youtube-dl> .\youtube-dlc.exe -v -f bestvideo+bestaudio[acodec^=opus]+bestaudio[acodec^=mp4] --add-metadata "https://youtu.be/wDR_iDg-ttc" [debug] System config: [] [debug] User config: [] [debug] Custom config: [] [debug] Command-line args: ['-v', '-f', 'bestvideo+bestaudio[acodec^=opus]+bestaudio[acodec^=mp4]', '--add-metadata', 'https://youtu.be/wDR_iDg-ttc'] [debug] Loading archive file None [debug] Encodings: locale cp1252, fs utf-8, out utf-8, pref cp1252 [debug] youtube-dlc version 2020.11.11-3 [debug] Python version 3.8.6 (CPython) - Windows-10-10.0.19041-SP0 [debug] exe versions: ffmpeg n4.3.2-160-gfbb9368226, ffprobe n4.3.2-160-gfbb9368226 [debug] Proxy map: {} [youtube] wDR_iDg-ttc: Downloading webpage [youtube] {18} signature length 103, html5 player 223a7479 [youtube] {299} signature length 107, html5 player 223a7479 [youtube] {303} signature length 107, html5 player 223a7479 [youtube] {399} signature length 107, html5 player 223a7479 [youtube] {136} signature length 107, html5 player 223a7479 [youtube] {247} signature length 107, html5 player 223a7479 [youtube] {298} signature length 107, html5 player 223a7479 [youtube] {302} signature length 107, html5 player 223a7479 [youtube] {398} signature length 107, html5 player 223a7479 [youtube] {135} signature length 107, html5 player 223a7479 [youtube] {244} signature length 103, html5 player 223a7479 [youtube] {397} signature length 107, html5 player 223a7479 [youtube] {134} signature length 107, html5 player 223a7479 [youtube] {243} signature length 107, html5 player 223a7479 [youtube] {396} signature length 107, html5 player 223a7479 [youtube] {133} signature length 103, html5 player 223a7479 [youtube] {242} signature length 107, html5 player 223a7479 [youtube] {395} signature length 107, html5 player 223a7479 [youtube] {160} signature length 107, html5 player 223a7479 [youtube] {278} signature length 107, html5 player 223a7479 [youtube] {394} signature length 103, html5 player 223a7479 [youtube] {140} signature length 103, html5 player 223a7479 [youtube] {249} signature length 103, html5 player 223a7479 [youtube] {250} signature length 107, html5 player 223a7479 [youtube] {251} signature length 107, html5 player 223a7479 WARNING: Requested formats are incompatible for merge and will be merged into mkv. [debug] Invoking downloader on 'https://r5---sn-25glen7l.googlevideo.com/videoplayback?expire=1616224540&ei=vExVYI7_ONPpsALSxbWgBQ&ip=2a01%3Acb19%3A74c%3A8b00%3Aa820%3A6a5c%3Ae911%3A3479&id=o-AOVQ_VQrGErxqZ2ehp4V9bFNY8sriP0EJahigBweT3oi&itag=299&aitags=133%2C134%2C135%2C136%2C160%2C242%2C243%2C244%2C247%2C278%2C298%2C299%2C302%2C303%2C394%2C395%2C396%2C397%2C398%2C399&source=youtube&requiressl=yes&mh=DA&mm=31%2C26&mn=sn-25glen7l%2Csn-4g5e6nsr&ms=au%2Conr&mv=m&mvi=5&pl=30&initcwndbps=1240000&vprv=1&mime=video%2Fmp4&ns=tNtO9-RbLPEQLbvDfzHPKUoF&gir=yes&clen=97119237&dur=205.649&lmt=1585571850171374&mt=1616202773&fvip=5&keepalive=yes&fexp=24001373%2C24007246&c=WEB&txp=5432432&n=PDvZvELg-7V0cEM_of&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhAKM62ervjnouEAolFgKlBkyo1qbV1EH4xX4THh8qM5CqAiBkkRa82w09OYb7SzXzJk2_eKPer3si1A_1faSYF-mXgw%3D%3D&sig=AOq0QJ8wRgIhALa5fVfut2Gz70ecsQZ9x6jpQ6C8szU-drPm8ZtZ3X5fAiEAuoUJSc4obB62jes8jI3bUlnwkhFdEMsx1eHeml8tRZM=&ratebypass=yes' [download] Destination: Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.f299.mp4 [download] 100% of 92.62MiB in 00:03 [debug] Invoking downloader on 'https://r5---sn-25glen7l.googlevideo.com/videoplayback?expire=1616224540&ei=vExVYI7_ONPpsALSxbWgBQ&ip=2a01%3Acb19%3A74c%3A8b00%3Aa820%3A6a5c%3Ae911%3A3479&id=o-AOVQ_VQrGErxqZ2ehp4V9bFNY8sriP0EJahigBweT3oi&itag=251&source=youtube&requiressl=yes&mh=DA&mm=31%2C26&mn=sn-25glen7l%2Csn-4g5e6nsr&ms=au%2Conr&mv=m&mvi=5&pl=30&initcwndbps=1240000&vprv=1&mime=audio%2Fwebm&ns=tNtO9-RbLPEQLbvDfzHPKUoF&gir=yes&clen=3407113&dur=205.681&lmt=1585571535789561&mt=1616202773&fvip=5&keepalive=yes&fexp=24001373%2C24007246&c=WEB&txp=5431432&n=PDvZvELg-7V0cEM_of&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgAg0jwXWqy6sU-9m0Q3w_S020fBCRnOOkBT1uVYlrZ2ICIQDRcll-YiatwSkpQWWpI8eqOviL0POCuP3Y9nOMWBfWnw%3D%3D&sig=AOq0QJ8wRgIhAPO3EGk-agIzD-Pm0GXZC0_85dfN9gJW4GuTG5LGpNB5AiEA3XL6aV1JPKtKbL4mMONL7aQ-SVuVkTxeJjvs7zA9ptI=&ratebypass=yes' [download] Destination: Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.f251.webm [download] 100% of 3.25MiB in 00:00 [debug] Invoking downloader on 'https://r5---sn-25glen7l.googlevideo.com/videoplayback?expire=1616224540&ei=vExVYI7_ONPpsALSxbWgBQ&ip=2a01%3Acb19%3A74c%3A8b00%3Aa820%3A6a5c%3Ae911%3A3479&id=o-AOVQ_VQrGErxqZ2ehp4V9bFNY8sriP0EJahigBweT3oi&itag=140&source=youtube&requiressl=yes&mh=DA&mm=31%2C26&mn=sn-25glen7l%2Csn-4g5e6nsr&ms=au%2Conr&mv=m&mvi=5&pl=30&initcwndbps=1240000&vprv=1&mime=audio%2Fmp4&ns=tNtO9-RbLPEQLbvDfzHPKUoF&gir=yes&clen=3329825&dur=205.705&lmt=1585571533368365&mt=1616202773&fvip=5&keepalive=yes&fexp=24001373%2C24007246&c=WEB&txp=5431432&n=PDvZvELg-7V0cEM_of&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhAIAukGVETMKSvDTJXTlNhOtofiwVT_mgc5o5zFUlKQFpAiEAvFzSAfXJxDC6taR6ayAgzqMZSc6FZF6xx8U1UXufRw8%3D&sig=AOq0QJ8wRAIgJEodR-v_LES70neDh9TNhs7Ad_zrR32aCWPrCWTl2xsCIG0WAbXP_gnIHgQ5AcBh-8miFBVTunHNLka1bLxbXjvA&ratebypass=yes' [download] Destination: Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.f140.m4a [download] 100% of 3.18MiB in 00:00 [ffmpeg] Merging formats into "Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.mkv" [debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.f299.mp4" -i "file:Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.f251.webm" -i "file:Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.f140.m4a" -c copy -map "0:v:0" -map "1:a:0" -map "2:a:0" "file:Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.temp.mkv" Deleting original file Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.f140.m4a (pass -k to keep) Deleting original file Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.f299.mp4 (pass -k to keep) Deleting original file Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.f251.webm (pass -k to keep) [ffmpeg] Adding metadata to 'Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.mkv' [debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.mkv" -map 0 -c copy -metadata "title=Constellation" -metadata "date=20200330" -metadata "description=Great bunch of text" -metadata "purl=https://www.youtube.com/watch?v=wDR_iDg-ttc" -metadata "artist=Far Out, Karra" -metadata "album=Constellation" "file:Constellation - AMV - 「Anime MV 」-wDR_iDg-ttc.temp.mkv" ```
MediaInfo result with the expected dual audio ``` Général Identifiant unique : 33774902745271770897404728212271272860 (0x1968CF45A778D6E8E9A1E44564A6139C) Nom complet : D:\Bazard\youtube-dl\Constellation - AMV - 「Anime MV」- no thumb.mkv Format : Matroska Version du format : Version 4 Taille du fichier : 99,0 Mio Durée : 3 min 25s Débit global moyen : 4 038 kb/s Nom du film : Constellation Description : lot of text ErrorDetectionType : Per level 1 ALBUM : Constellation ARTIST : Far Out, Karra DATE : 20200330 PURL : https://www.youtube.com/watch?v=wDR_iDg-ttc Vidéo ID : 1 Format : AVC Format/Info : Advanced Video Codec Profil du format : High@L4.2 Paramètres du format : CABAC / 3 Ref Frames Paramètres du format, CABAC : Oui Paramètres du format, RefFrames : 3 images Identifiant du codec : V_MPEG4/ISO/AVC Durée : 3 min 25s Largeur : 1 920 pixels Hauteur : 1 080 pixels Format à l'écran : 16/9 Type d'images/s : Constant Images par seconde : 60,000 Im/s Espace de couleurs : YUV Sous-échantillonnage de la chrominance : 4:2:0 Profondeur des couleurs : 8 bits Type de balayage : Progressif Titre : ISO Media file produced by Google Inc. Bibliothèque utilisée : x264 core 155 r2901 7d0ff22 Default : Oui Forced : Non Gamme de couleurs : Limited Coordonnées de chromaticité : BT.709 Caractéristiques du transfert : BT.709 Coefficients de la matrice : BT.709 Audio #1 ID : 2 Format : Opus Identifiant du codec : A_OPUS Durée : 3 min 25s Canaux : 2 canaux Channel layout : L R Echantillonnage : 48,0 kHz Profondeur des couleurs : 32 bits Mode de compression : Avec perte Délai par rapport Vidéo : -7 ms Langue : Anglais Default : Oui Forced : Non Audio #2 ID : 3 Format : AAC LC Format/Info : Advanced Audio Codec Low Complexity Identifiant du codec : A_AAC-2 Durée : 3 min 25s Canaux : 2 canaux Channel layout : L R Echantillonnage : 44,1 kHz Images par seconde : 43,066 Im/s (1024 SPF) Mode de compression : Avec perte Titre : ISO Media file produced by Google Inc. Langue : Anglais Default : Non Forced : Non ```

Description

While trying to download a YT video with two audio streams and a cover (the thumbnail), I ran into a weird issue where if I try to add the cover, the second audio stream disappear/isn't merged in the output mkv. Basically, I can see in the log that the 2 audio tracks are downloaded, but only one is present at the output.

The command I use is the following : youtube-dlc.exe -v -f bestvideo+bestaudio[acodec^=opus]+bestaudio[acodec^=mp4] --add-metadata --embed-thumbnail "https://youtu.be/wDR_iDg-ttc" This command (is supposed to) merge the best opus audio and the best aac audio with the video, metadata and thumbnail (used as cover).

I added the full logs of the two cases (with and without the thumbnail option enabled) so that you can see the differences between them. To reproduce, try the command with and without the "--embed-thumbnail" option while looking at the content of the output file.

Ev3rdown commented 3 years ago

Well, I've probably lost 2 hours on this issue for nothing.

It turned out that, if you look closely to the logs, you can see that the ffmpeg call that add the cover to the file is missing a -map 0 right after the file name. Instead of being : ffmpeg -y -loglevel "repeat+info" -i "file:Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.mkv" -c copy -attach cover.jpg "-metadata:s:t" "mimetype=image/jpeg" "file:Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.temp.mkv" It should be : ffmpeg -y -loglevel "repeat+info" -i "file:Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.mkv" -map 0 -c copy -attach cover.jpg "-metadata:s:t" "mimetype=image/jpeg" "file:Constellation - AMV - 「Anime MV」-wDR_iDg-ttc.temp.mkv"

The "-map 0" option is extremely important because it selects the which stream you want to modify, if left unset, ffmpeg only takes the first stream of each type (so only one video, audio, sub, etc). It's detailed here ffmpeg doc for "map"

I've confirmed that doing all the steps manually with the correct options produce the expected result. Now, someone will have to look at the code to find why/where is this map missing.

pukkandan commented 3 years ago

This project has not had any updates in over 3 months. You can check out my fork yt-dlp which does handle this issue correctly

PS: in yt-dlp, multiple audio streams are disabled by default. You can enable it by using --audio-multistreams

Ev3rdown commented 3 years ago

@pukkandan Thank you very much for letting me know about yt-dlp. Your work is truly awesome.

To everyone else reading this, give a try to yt-dlp, at the time I'm writing this, it is clearly more "up-to-date" and solve most of the problems I encountered with yt-dl and yt-dlc, including this specific one.