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

-o different filenames of multiple files when downloading more formats of a youtube-video #6557

Closed
Klaus1189 opened this issue Aug 14, 2015 · 37 comments

Comments

@Klaus1189
Copy link

@Klaus1189 Klaus1189 commented Aug 14, 2015

If you want to download a video in different formats and want to build different filenames for the files, I don't find the solution to set up different filenames with -o
May you please tell me how to do it?

If it's not possible, I want to make a feature request for this.

Thank you

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 14, 2015

Read FAQ on -o.

@dstftw dstftw closed this Aug 14, 2015
@Klaus1189
Copy link
Author

@Klaus1189 Klaus1189 commented Aug 14, 2015

I don't get it. Which syntax do I need?

@Klaus1189
Copy link
Author

@Klaus1189 Klaus1189 commented Aug 14, 2015

I already read this, but I don't know how to put in different filenames for the different files.
Please help me.

yan12125 added a commit that referenced this issue Aug 14, 2015
@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Aug 14, 2015

What you need is format_id. Here's a quick example:

$ youtube-dl -o "%(title)s-%(id)s-%(format_id)s.%(ext)s" --get-filename test:youtube
youtube-dl test video ''_ä↭𝕐-BaW_jenozKc-137+141.mp4

It's documented in Filesystem options section. However, it's not so easy to find, so I add an item in Output template section.

@Klaus1189
Copy link
Author

@Klaus1189 Klaus1189 commented Aug 14, 2015

OK, thank you. So %(format_id)s is for the itag value.
My intention for this issue:
Is it possible to type in text for the different filenames by hand with -o?

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Aug 14, 2015

Not really sure what's the meaning of "by hand". Can you give a more concrete example?

@Klaus1189
Copy link
Author

@Klaus1189 Klaus1189 commented Aug 14, 2015

For example I want to download a video from youtube in two or more formats. But the files should be named abcdef.mp4 and ghijkl.mp4:
youtube-dl -f 136,135 https://www.youtube.com/watch?v=YuOBzWF0Aws -o "abcdef.%(ext)s" "ghijkl.%(ext)s"

But this doesn't work, I need a separator for the two filenames in -o
Without that, it is recognized as one filename.

@Klaus1189
Copy link
Author

@Klaus1189 Klaus1189 commented Aug 14, 2015

Do you know how I can do that?

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Aug 14, 2015

It's not possible with youtube-dl only. A possible solution is using %(autonumber)s.%(ext)s and rename the files with another script.

EDIT: --exec option may be useful for running external scripts after downloading.

@Klaus1189
Copy link
Author

@Klaus1189 Klaus1189 commented Aug 14, 2015

OK, I see. Can we make a feature request of this issue, so youtube-dl can do that?

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Aug 14, 2015

I prefer using extra scripts. Filename computation is a quite complex part in youtube-dl. Changing it is not a good idea.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 14, 2015

Why not just download separately?

youtube-dl -f 136 https://www.youtube.com/watch?v=YuOBzWF0Aws -o "abcdef.%(ext)s"
youtube-dl -f 135 https://www.youtube.com/watch?v=YuOBzWF0Aws -o "ghijkl.%(ext)s"
@Klaus1189
Copy link
Author

@Klaus1189 Klaus1189 commented Aug 14, 2015

If you download for example 5 videos and want each video in three formats, then you need to download 5 times instead of 15 times.
-> It would be a really usefull feature, only one time to download and you have all files you want of the desired video.

I know how to download with a batch-list, but this would be much better especially for most download usage scenarios.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 14, 2015

The only gain you'll get is that you'll download data needed for extraction once instead of 3 times for each video. But still this would be neglected by the same 15 media files you'll need to download in any case that will consume much more time and bandwidth in comparison to extraction data.
As already mentioned by @yan12125 just use %(format_id)s in output template and perform filename-based postprocessing substituting format codes by your strings.

@Klaus1189
Copy link
Author

@Klaus1189 Klaus1189 commented Aug 14, 2015

OK. I see.

I beg to add this funktionality to youtube-dl.
Then it would be perfect. I'm sure it's possible to achieve that behavior.
It's only a separator like ;; or similar characters and youtube-dl knows, OK, we download three files and there are two separators ;; and then it puts the string to the right file.

Please add this feature.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 14, 2015

Separator for what? If you want anything to be implemented you have to clearly formulate it in the first place.
I would prefer keeping output template as is since your suggestion of multiple -o args -o "template1" "template2" ... breaks the original idea of single output template and doesn't fit into current format selection mechanisms.

@Klaus1189
Copy link
Author

@Klaus1189 Klaus1189 commented Aug 14, 2015

youtube-dl -f 136,135 https://www.youtube.com/watch?v=YuOBzWF0Aws -o "abcdef.%(ext)s" ;; "ghijkl.%(ext)s"
separator between the strings of -o

Sounds like it's not possible to add that?

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 14, 2015

No, that's counter-intuitive to regular CLI UX.

@Klaus1189
Copy link
Author

@Klaus1189 Klaus1189 commented Aug 14, 2015

What?

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 14, 2015

The way command line programs are usually used.

@Klaus1189
Copy link
Author

@Klaus1189 Klaus1189 commented Aug 14, 2015

OK, I see. That would have been great, but now I know it can't be done. I'm sad now
Anyway, Thank you
BTW: Is it possible to link to a txt-file with proxy in it in --proxy URL

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 14, 2015

txt-file with proxy in it in --proxy URL

No, for what?

@Klaus1189
Copy link
Author

@Klaus1189 Klaus1189 commented Aug 14, 2015

Just a thought, so I can paste the proxy like 192.168.178.001:0123 in a txt-file and while using youtube-dl I give the path to the txt-file.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 14, 2015

I mean what is the scenario for youtube-dl to use this list?

@Klaus1189
Copy link
Author

@Klaus1189 Klaus1189 commented Aug 14, 2015

If I need a proxy because the video is blocked in bavaria and I need a proxy, then I look up for a proxy and paste it in the txt-file and the proxy-string in cmd.exe can stay like it is. It's quite long^^

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 14, 2015

This does not rationalize the need of proxy list instead of single proxy.

@Klaus1189
Copy link
Author

@Klaus1189 Klaus1189 commented Aug 14, 2015

No, not a list.
Only one proxy in the txt-file, so I don't have to change my long string which contains the proxy several times.
Then I only copy the new working proxy to the txt-file and youtube-dl reads the proxy in the txt-file and the string contains the links to the txt-file instead of the proxy itself.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 14, 2015

You can achieve this with configuration file as well as put any default options in it.

@Klaus1189
Copy link
Author

@Klaus1189 Klaus1189 commented Aug 14, 2015

Do you have more information about the configuration file?

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 14, 2015

What info you need?

@Klaus1189
Copy link
Author

@Klaus1189 Klaus1189 commented Aug 14, 2015

How do I set up such a file with the proxy setting for example and what things can I set up in the file?
-> Which options are available? Something like that? --proxy 123.456.789:0123

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 14, 2015

Yes. Any option you pass in command line can be put into configuration file.

@Klaus1189
Copy link
Author

@Klaus1189 Klaus1189 commented Aug 14, 2015

So a configuration file for example only consist of --proxy 123.456.789:0123
and then youtube-dl will always use that proxy?

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 14, 2015

Exactly.

@Klaus1189
Copy link
Author

@Klaus1189 Klaus1189 commented Aug 14, 2015

Thank you very much.

@Klaus1189
Copy link
Author

@Klaus1189 Klaus1189 commented Aug 14, 2015

I copied config.txt to the location in appdata, but it doesn't work.

@Klaus1189
Copy link
Author

@Klaus1189 Klaus1189 commented Aug 14, 2015

Now I copied it to users ... youtube-dl.conf.
Now it works.

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