-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
--get-filename not getting the final filename (was: get filename not working?) #5710
Comments
The problem is that we output the filename before deciding if the formats have to be merged into an mkv file. The workaround is to use |
Thanks, the second solution worked for me, although I'm planning to just read the generated filename for now. |
@jaimeMF If there is no extension used, such as simply Or an option to force not using an extension so we can trust what we pass to the |
@eriktjacobsen if not extension is used ffmpeg is not able to merge. |
@dstftw I see... Ok, just trying to get a handle on whether devs see this as something working as intended or something to be fixed. Couldn't youtube-dl just wait until ffmpeg finishes the merge, and then if no extension is listed in the Then at least it could be trusted to have some predictable output. |
@eriktjacobsen there wouldn't be a |
The problem is that the final filename may not be determined until actual downloading. For example, If anyone else have a good idea, feel free to post it. |
I too am running into the need for this functionality. It would be great if there was a way to pass the output file onto another script after downloading. If I'm missing something obvious, please let me know! |
Hi everyone, is there anyway I can get the final output filename (correctly) up to now? |
This seems can only get the filename "prepared to be", i.e. maybe get something.mp4 while the actual filename is something.mkv |
Requested formats are incompatible for merge and will be merged into mkv. ytdl-org/youtube-dl#5710
Brute force solution piece for a script: class MyLogger(object):
def debug(self, msg):
match = re.search(r'.ffmpeg..[Dd]estination..(.*?)$', msg)
if match:
final_path = match.group(1) And to cut down on msg: ydl_opts = {
'noprogress': True, |
this might be a stupid question, but can't I just Or to phrase it differently: are there cases in which youtubedl won't give me a mkv-file? |
Uh.. depends on the site/extractor? I mostly have |
A brave suggestion: Implement an additional (command-line) parameter or alter the existing one to print the true and final filename after all processing happened. |
Or — and not having looked at the code, I have no idea how much work it'd be to implement — how about outputting all of youtube-dl's "ok, I'm downloading stuff, here's how it's going" chatter to stderr, and after all is said and done, printing out the final output filename to stdout? It's a nice UNIX-y way to do things that's easy to deal with in just about any programming or scripting language. It seems like a crying shame that, how amazing this program is at grabbing video from so many different sources, that it can't report back on what it just downloaded. |
#5710 (comment): |
"--get-filename" returns a different name from a normal execution.
~# youtube-dl -o 'test.%(ext)s' --prefer-ffmpeg --get-filename https://www.youtube.com/watch?v=f3gNU0rNIIo
test.webm
:~# youtube-dl -o 'test.%(ext)s' --prefer-ffmpeg https://www.youtube.com/watch?v=f3gNU0rNIIo
[youtube] f3gNU0rNIIo: Downloading webpage
[youtube] f3gNU0rNIIo: Extracting video information
[youtube] f3gNU0rNIIo: Downloading DASH manifest
WARNING: You have requested formats incompatible for merge. The formats will be merged into mkv
[download] Destination: test.f248.webm
[download] 100% of 83.44MiB in 00:02
[download] Destination: test.f141.m4a
[download] 100% of 7.24MiB in 00:00
[ffmpeg] Merging formats into "test.mkv"
Deleting original file test.f248.webm (pass -k to keep)
Deleting original file test.f141.m4a (pass -k to keep)
~# ls
test.mkv
I am expecting the two commands to return the same filename (either .mkv or .webm).
What am I doing wrong?
Thanks
The text was updated successfully, but these errors were encountered: