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

outputformat string is not respected properly when the final file required merging #26654

Closed
atticus-sullivan opened this issue Sep 21, 2020 · 2 comments

Comments

@atticus-sullivan
Copy link

@atticus-sullivan atticus-sullivan commented Sep 21, 2020

  • 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

$ youtube-dl --version
2020.09.20
$ youtube-dl -v -i -f bestvideo+bestaudio --merge-output-format mkv --restrict-filenames -o '%(uploader)s-_-%(title)s.tmp' "https://www.youtube.com/watch?v=Zn4oSL0_8ho"
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '-i', '-f', 'bestvideo+bestaudio', '--merge-output-format', 'mkv', '--restrict-filenames', '-o', '%(uploader)s-_-%(title)s.tmp', 'https://www.youtube.com/watch?v=Zn4oSL0_8ho']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2020.09.20
[debug] Python version 3.8.5 (CPython) - Linux-5.4.66-1-lts-x86_64-with-glibc2.2.5
[debug] exe versions: ffmpeg 4.3.1, ffprobe 4.3.1, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] Zn4oSL0_8ho: Downloading webpage
[youtube] Zn4oSL0_8ho: Downloading MPD manifest
[debug] Invoking downloader on 'https://manifest.googlevideo.com/api/manifest/dash/expire/1600712423/ei/h5poX9P0KI-x1gK75Lv4CA/ip/2003%3Acb%3Af735%3Afc00%3A7c9a%3Ac747%3A5c83%3A5d31/id/667e2848bd3ff21a/source/youtube/requiressl/yes/playback_host/r5---sn-h0jeln7e.googlevideo.com/mh/os/mm/31%2C26/mn/sn-h0jeln7e%2Csn-4g5ednsk/ms/au%2Conr/mv/m/mvi/5/pl/36/hfr/all/as/fmp4_audio_clear%2Cwebm_audio_clear%2Cwebm2_audio_clear%2Cfmp4_sd_hd_clear%2Cwebm2_sd_hd_clear/initcwndbps/1490000/vprv/1/mt/1600690731/fvip/5/keepalive/yes/itag/0/sparams/expire%2Cei%2Cip%2Cid%2Csource%2Crequiressl%2Chfr%2Cas%2Cvprv%2Citag/sig/AOq0QJ8wRQIhALcCzyoRgp0Du0tEDOFuI7ozDums3TEYjg2XLzCoYFNyAiB-Ail0BuGniZW3lLZWgax4ZDLWVaY07B6JU88tZRkZLg%3D%3D/lsparams/playback_host%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps/lsig/AG3C_xAwRQIgMdN5mtSMgSSXeZyaKYc-a79c2ByVvHA_xIP9168uYb4CIQDnGUsvcUznVGFPBPARW70Pr_2zEOw1uqnVO5atl5TLQw%3D%3D'
[dashsegments] Total fragments: 40
[download] Destination: M4-_-M4_-_Not_Good_Enough_Official_Video.tmp.f137
[download] 100% of 90.06MiB in 00:37
[debug] Invoking downloader on 'https://manifest.googlevideo.com/api/manifest/dash/expire/1600712423/ei/h5poX9P0KI-x1gK75Lv4CA/ip/2003%3Acb%3Af735%3Afc00%3A7c9a%3Ac747%3A5c83%3A5d31/id/667e2848bd3ff21a/source/youtube/requiressl/yes/playback_host/r5---sn-h0jeln7e.googlevideo.com/mh/os/mm/31%2C26/mn/sn-h0jeln7e%2Csn-4g5ednsk/ms/au%2Conr/mv/m/mvi/5/pl/36/hfr/all/as/fmp4_audio_clear%2Cwebm_audio_clear%2Cwebm2_audio_clear%2Cfmp4_sd_hd_clear%2Cwebm2_sd_hd_clear/initcwndbps/1490000/vprv/1/mt/1600690731/fvip/5/keepalive/yes/itag/0/sparams/expire%2Cei%2Cip%2Cid%2Csource%2Crequiressl%2Chfr%2Cas%2Cvprv%2Citag/sig/AOq0QJ8wRQIhALcCzyoRgp0Du0tEDOFuI7ozDums3TEYjg2XLzCoYFNyAiB-Ail0BuGniZW3lLZWgax4ZDLWVaY07B6JU88tZRkZLg%3D%3D/lsparams/playback_host%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps/lsig/AG3C_xAwRQIgMdN5mtSMgSSXeZyaKYc-a79c2ByVvHA_xIP9168uYb4CIQDnGUsvcUznVGFPBPARW70Pr_2zEOw1uqnVO5atl5TLQw%3D%3D'
[dashsegments] Total fragments: 21
[download] Destination: M4-_-M4_-_Not_Good_Enough_Official_Video.tmp.f251
[download] 100% of 2.96MiB in 00:04
[ffmpeg] Merging formats into "M4-_-M4_-_Not_Good_Enough_Official_Video.tmp.mkv"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i file:M4-_-M4_-_Not_Good_Enough_Official_Video.tmp.f137 -i file:M4-_-M4_-_Not_Good_Enough_Official_Video.tmp.f251 -c copy -map 0:v:0 -map 1:a:0 file:M4-_-M4_-_Not_Good_Enough_Official_Video.tmp.temp.mkv
Deleting original file M4-_-M4_-_Not_Good_Enough_Official_Video.tmp.f137 (pass -k to keep)
Deleting original file M4-_-M4_-_Not_Good_Enough_Official_Video.tmp.f251 (pass -k to keep)

Description

When I download above Video, after merging I get a file named ....tmp.mkv despite the fact that I've used the output-formatstring '%(uploader)s-_-%(title)s.tmp'.
I'd expect that the final outputfile would be named in that specific case "M4-_-M4_-_Not_Good_Enough_Official_Video.tmp".

I consider this a bug, but maybe this behaviour is known and even wanted. In that case I want to mention that this makes scripting around with youtube-dl really hard, since one cannot get the final filenames of the files produced by youtube-dl

In my scripting case it would be enough to have the precise final filename to work with the output file, but when using --get-filename the filename that is outputted, is not the right one under every circumstances. When using something like -f bestvideo+bestaudio, the extension might change due to merging.
In my specific case I'd get
M4-_-M4_-_Not_Good_Enough_Official_Video.mp4 as output of
youtube-dl -i -f bestvideo+bestaudio --restrict-filenames -o '%(uploader)s-_-%(title)s.%(ext)s' --get-filename "https://www.youtube.com/watch?v=Zn4oSL0_8ho"
which is not right, since when downloading the resulting file (with
youtube-dl -i -f bestvideo+bestaudio --restrict-filenames -o '%(uploader)s-_-%(title)s.%(ext)s' "https://www.youtube.com/watch?v=Zn4oSL0_8ho") will be named
"M4-_-M4_-_Not_Good_Enough_Official_Video.mkv")

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Sep 21, 2020

This is expected behavior. Extension should not be hardcoded in output template.

@dstftw dstftw closed this Sep 21, 2020
@atticus-sullivan
Copy link
Author

@atticus-sullivan atticus-sullivan commented Sep 21, 2020

@dstftw is it then expected behaviour too that the filename outputted with the flag --get-filename isn't the right one? (or should I open a new issue for this?)

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.