yt-dlp / yt-dlp

A feature-rich command-line audio/video downloader
https://discord.gg/H5MNcFW63r
The Unlicense
73.35k stars 5.81k forks source link

Different response to --output, in two different situations #9944

Open krasnh opened 2 weeks ago

krasnh commented 2 weeks ago

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

Checklist

Provide a description that is worded well enough to be understood

A name I don't expect:

  1. -f bv+va --output '%(title)s - %(id)s' We get "*oBUuh3DIK_A.webm"

The correct name:

  1. -f b --output '%(title)s - %(id)s' We get "*oBUuh3DIK_A"

Provide verbose output that clearly demonstrates the problem

Complete Verbose Output

[debug] Command-line config: ['oBUuh3DIK_A', '-o', '%(title)s - %(id)s', '--no-config', '-Uv']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version nightly@2024.05.16.232713 from yt-dlp/yt-dlp-nightly-builds [6d8a53d87] (zip)
[debug] Python 3.10.8 (CPython x86_64 64bit) - Linux-6.8.0-pf1-x86_64-with-glibc2.38 (OpenSSL 1.1.1t  7 Feb 2023, glibc 2.38)
[debug] exe versions: ffmpeg 5.1.2 (setts), ffprobe 5.1.2
[debug] Optional libraries: certifi-2022.09.24, requests-2.28.1, sqlite3-3.39.4, urllib3-1.26.12
[debug] Proxy map: {}
[debug] Request Handlers: urllib
[debug] Extractor Plugins: YandexTranslateIE
[debug] Post-Processor Plugins: YandexTranslateAutoAddPP, YandexTranslateMergePP, YandexTranslateSubtitleFixPP
[debug] Loaded 1803 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp-nightly-builds/releases/latest
Latest version: nightly@2024.05.16.232713 from yt-dlp/yt-dlp-nightly-builds
yt-dlp is up to date (nightly@2024.05.16.232713 from yt-dlp/yt-dlp-nightly-builds)
[youtube] Extracting URL: oBUuh3DIK_A
[youtube] oBUuh3DIK_A: Downloading webpage
[youtube] oBUuh3DIK_A: Downloading ios player API JSON
[youtube] oBUuh3DIK_A: Downloading android player API JSON
WARNING: [youtube] Skipping player responses from android clients (got player responses for video "aQvGIIdgFDM" instead of "oBUuh3DIK_A")
[debug] [youtube] Extracting signature function js_74a3a562_101
[debug] Loading youtube-sigfuncs.js_74a3a562_101 from cache
[debug] Loading youtube-nsig.74a3a562 from cache
[debug] [youtube] Decrypted nsig 8URNQt6HR25XQYY-1Yq => DsjKhepHzWpBOw
[debug] [youtube] Extracting signature function js_74a3a562_105
[debug] Loading youtube-sigfuncs.js_74a3a562_105 from cache
[debug] Loading youtube-nsig.74a3a562 from cache
[debug] [youtube] Decrypted nsig 6z66rnwK2pdozA9J54E => ikvu3HKFwoAXKg
[youtube] oBUuh3DIK_A: Downloading m3u8 information
[debug] Sort order given by extractor: quality, res, fps, hdr:12, source, vcodec:vp9.2, channels, acodec, lang, proto
[debug] Formats sorted by: hasvid, ie_pref, quality, res, fps, hdr:12(7), source, vcodec:vp9.2(10), channels, acodec, lang, proto, size, br, asr, vext, aext, hasaud, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] oBUuh3DIK_A: Downloading 1 format(s): 243+251
[debug] Invoking http downloader on "https://rr8---sn-gxuog0-axqe.googlevideo.com/videoplayback?expire=1715957218&ei=ghlHZpGtJPuA0u8PvNufsAo&ip=&id=o-AK8TxJ7tzTFwuTtOnFMSu6fhbr-s5PYpIIDbwD7gXl-5&itag=243&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&mh=Ro&mm=31%2C29&mn=sn-gxuog0-axqe%2Csn-axq7sn7s&ms=au%2Crdu&mv=m&mvi=8&pl=21&initcwndbps=1856250&vprv=1&svpuc=1&mime=video%2Fwebm&rqh=1&gir=yes&clen=9340169&dur=278.840&lmt=1559401363730576&mt=1715935264&fvip=4&keepalive=yes&c=IOS&txp=5432432&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cxpc%2Cvprv%2Csvpuc%2Cmime%2Crqh%2Cgir%2Cclen%2Cdur%2Clmt&sig=AJfQdSswRgIhAPEJpW2v8mDzRo4wT2Q41hcL0-QQK4X5GKJFl4goV8apAiEAvheX2DVIZYoY1MUJ26BAFlFddGe3HHE___pauOqnl1U%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AHWaYeowRQIhAL5pIOE0kRofQqZsB_mh-khET3n2FcK9M-sq2c175RpQAiA13-473Rzpobxu39VfKS69Owk9evBKped7-W-WKSyr3A%3D%3D"
[download] Destination: Винни-Пух Пятачок Ослик Иа. Песни из мультиков. Вспомним детство! Подписывайтесь - ссылка под видео - oBUuh3DIK_A.f243.webm
[download] 100% of    8.91MiB in 00:00:04 at 2.04MiB/s
[debug] Invoking http downloader on "https://rr8---sn-gxuog0-axqe.googlevideo.com/videoplayback?expire=1715957218&ei=ghlHZuD1Aeunv_IP-dKJiAI&ip=&id=o-ALeb5Mva2jBhSKN9ZDU7O8GwPxRNh6kpkyS14MPIwn72&itag=251&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&mh=Ro&mm=31%2C29&mn=sn-gxuog0-axqe%2Csn-axq7sn7s&ms=au%2Crdu&mv=m&mvi=8&pl=21&initcwndbps=1856250&bui=AWRWj2QrGiHhNJQfm4SUorrjzEvOYaGi2b8fkfux696eO3wyAly_1jBgYC2Y3_ZVGwYfwwLobw3Mmp0e&spc=UWF9f4vLCgqoPLYxgcyY6dGlPREaHuyPCuAQIj0mpx37sExTANRMkHQ&vprv=1&svpuc=1&mime=audio%2Fwebm&ns=jRp6gvjuWuJTlhsy-Z8ospMQ&rqh=1&gir=yes&clen=4556315&dur=278.861&lmt=1559387980437469&mt=1715935264&fvip=4&keepalive=yes&c=WEB&sefc=1&txp=5432432&n=ikvu3HKFwoAXKg&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cxpc%2Cbui%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cns%2Crqh%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AHWaYeowRQIgPxbkoAmtKD6n6ABkJa0SNSR6okVAjXNv8Lc-O4XcrF4CIQDjeu5DbilRLat8cV5vd3WhI3MrC1Yv3S3xs49eu_rLVg%3D%3D&sig=AJfQdSswRAIgE_4Y07ZDBYto7lLr57zeCBIwMleT-1CHYOEPLDOcUIICIEM7-TyiAiwgaV8u2BkFuCqjUqtZKrWqmYH45v51rl44"
[download] Destination: Винни-Пух Пятачок Ослик Иа. Песни из мультиков. Вспомним детство! Подписывайтесь - ссылка под видео - oBUuh3DIK_A.f251.webm
[download] 100% of    4.35MiB in 00:00:02 at 1.77MiB/s
[Merger] Merging formats into "Винни-Пух Пятачок Ослик Иа. Песни из мультиков. Вспомним детство! Подписывайтесь - ссылка под видео - oBUuh3DIK_A.webm"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:Винни-Пух Пятачок Ослик Иа. Песни из мультиков. Вспомним детство! Подписывайтесь - ссылка под видео - oBUuh3DIK_A.f243.webm' -i 'file:Винни-Пух Пятачок Ослик Иа. Песни из мультиков. Вспомним детство! Подписывайтесь - ссылка под видео - oBUuh3DIK_A.f251.webm' -c copy -map 0:v:0 -map 1:a:0 -movflags +faststart 'file:Винни-Пух Пятачок Ослик Иа. Песни из мультиков. Вспомним детство! Подписывайтесь - ссылка под видео - oBUuh3DIK_A.temp.webm'
Deleting original file Винни-Пух Пятачок Ослик Иа. Песни из мультиков. Вспомним детство! Подписывайтесь - ссылка под видео - oBUuh3DIK_A.f243.webm (pass -k to keep)
Deleting original file Винни-Пух Пятачок Ослик Иа. Песни из мультиков. Вспомним детство! Подписывайтесь - ссылка под видео - oBUuh3DIK_A.f251.webm (pass -k to keep)

[debug] Command-line config: ['-f', 'b', 'oBUuh3DIK_A', '-o', '%(title)s - %(id)s', '--no-config', '-Uv']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version nightly@2024.05.16.232713 from yt-dlp/yt-dlp-nightly-builds [6d8a53d87] (zip)
[debug] Python 3.10.8 (CPython x86_64 64bit) - Linux-6.8.0-pf1-x86_64-with-glibc2.38 (OpenSSL 1.1.1t  7 Feb 2023, glibc 2.38)
[debug] exe versions: ffmpeg 5.1.2 (setts), ffprobe 5.1.2
[debug] Optional libraries: certifi-2022.09.24, requests-2.28.1, sqlite3-3.39.4, urllib3-1.26.12
[debug] Proxy map: {}
[debug] Request Handlers: urllib
[debug] Extractor Plugins: YandexTranslateIE
[debug] Post-Processor Plugins: YandexTranslateAutoAddPP, YandexTranslateMergePP, YandexTranslateSubtitleFixPP
[debug] Loaded 1803 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp-nightly-builds/releases/latest
Latest version: nightly@2024.05.16.232713 from yt-dlp/yt-dlp-nightly-builds
yt-dlp is up to date (nightly@2024.05.16.232713 from yt-dlp/yt-dlp-nightly-builds)
[youtube] Extracting URL: oBUuh3DIK_A
[youtube] oBUuh3DIK_A: Downloading webpage
[youtube] oBUuh3DIK_A: Downloading ios player API JSON
[youtube] oBUuh3DIK_A: Downloading android player API JSON
WARNING: [youtube] Skipping player responses from android clients (got player responses for video "aQvGIIdgFDM" instead of "oBUuh3DIK_A")
[debug] [youtube] Extracting signature function js_74a3a562_105
[debug] Loading youtube-sigfuncs.js_74a3a562_105 from cache
[debug] Loading youtube-nsig.74a3a562 from cache
[debug] [youtube] Decrypted nsig lxIy3PJytBPklPHdjyh => gjU2hFaU4NusXw
[debug] Loading youtube-nsig.74a3a562 from cache
[debug] [youtube] Decrypted nsig qkzRVhbXyS6yUFt-otF => 35OtP0tZ55o-kA
[debug] [youtube] Extracting signature function js_74a3a562_101
[debug] Loading youtube-sigfuncs.js_74a3a562_101 from cache
[youtube] oBUuh3DIK_A: Downloading m3u8 information
[debug] Sort order given by extractor: quality, res, fps, hdr:12, source, vcodec:vp9.2, channels, acodec, lang, proto
[debug] Formats sorted by: hasvid, ie_pref, quality, res, fps, hdr:12(7), source, vcodec:vp9.2(10), channels, acodec, lang, proto, size, br, asr, vext, aext, hasaud, id
[info] oBUuh3DIK_A: Downloading 1 format(s): 18
[debug] Invoking http downloader on "https://rr8---sn-gxuog0-axqe.googlevideo.com/videoplayback?expire=1715957246&ei=nhlHZr6GJ7KQv_IPjpSs4AE&ip=&id=o-AOZTY8Pdzxwuit3CIdANmW1T9dvgj-Xpa-nUck5cHXG7&itag=18&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&mh=Ro&mm=31%2C29&mn=sn-gxuog0-axqe%2Csn-axq7sn7s&ms=au%2Crdu&mv=m&mvi=8&pl=21&initcwndbps=1856250&bui=AWRWj2RJI4SwAGhjrigXBSd1U6WmjCuM45cQPqqoXElL_juAMoIR2qPfRBZGCs12vZZm64bsL7hVLshc&spc=UWF9fw1cZ4JrZTe6ibfUtz8yYdoT47q8VikGtotm4Xpq0VKLhSia9BdsFalf&vprv=1&svpuc=1&mime=video%2Fmp4&ns=auPUgkjHW0FvS1Dwfa2GgaUQ&rqh=1&cnr=14&ratebypass=yes&dur=278.894&lmt=1665358852464066&mt=1715935264&fvip=4&c=WEB&sefc=1&txp=1438434&n=gjU2hFaU4NusXw&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cxpc%2Cbui%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cns%2Crqh%2Ccnr%2Cratebypass%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AHWaYeowRQIhAI4PV4sAzEpfK9UOmUAq7G8YNWdHuQRidesdj6cObZKaAiBesqMdhQafogfWLKnvIC0JouxfZvzueLYNCkz2UO7fLQ%3D%3D&sig=AJfQdSswRQIhAPR5Wu92hNL2hFvSogWkHgd3DcIy3GZvKd65NHOa26HjAiAAsbX-1R79heOXkXjvxBUlNtKY7ZRaBRohbebPdXeeWw%3D%3D"
[download] Destination: Винни-Пух Пятачок Ослик Иа. Песни из мультиков. Вспомним детство! Подписывайтесь - ссылка под видео - oBUuh3DIK_A
[download] 100% of   15.97MiB in 00:00:07 at 2.00MiB/s
Grub4K commented 2 weeks ago

You always should append .%(ext)s to the output template, otherwise it might cause even more problems (Like when the name contains a .).

Why do you want to download without the extension in the first place?

dirkf commented 2 weeks ago

Presumably the merge process is applying the extension even though it wasn't specified in the output template.

Actually, as the first log shows, yt-dlp is forcing the {format_id}.webm extension to avoid having one format overwrite the other (function correct_ext(), I think), the merge command is using a temp.webm extension for the output, and that is being renamed by just removing the temp. part (because dl_filename passed to the post_process() is that temp filename when no file has been downloaded).

Would the answer to this be a documentation note that an output template with no %(ext)s is likely to cause unexpected behaviour except in very simple cases, like downloading one combined format video with a specific filename?

pukkandan commented 2 weeks ago

I swear there is an open issue for this, but I can't find it

krasnh commented 2 weeks ago

but I can't find it

And I was looking for it. I was also surprised that for the entire existence of "yt-dlp", I was the first one who encountered this problem. :)

upd. If this is not a problem but a feature, it is advisable to mention it in the readme.

dirkf commented 2 weeks ago

This old upstream issue, with its relatives, is somewhat similar: user who specified a fixed --output value (in particular, without %(ext)s) was surprised when the final file had a .webm or .mkv extension as a side-effect of merging.