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

Choosing output file name with --extract-audio #347

Closed
frabjous opened this issue May 14, 2012 · 10 comments
Closed

Choosing output file name with --extract-audio #347

frabjous opened this issue May 14, 2012 · 10 comments
Labels

Comments

@frabjous
Copy link

Version 2012.02.27 on ArchLinux x86_64....

There doesn't seem to be an elegant way of specifying the output filename when using the --extract-audio option. I had expected to be able to use the -o or --output option, but that seems to only work when specifying the video file name. indeed:

youtube-dl --extract-audio --audio-format=mp3 --output myfile.mp3 http://youtu.be/9ro0FW9Qt-4

results in no file being saved at all. This is presumably because the video and audio files are given the same name, so audio is extracted overwriting the video file, and then that file is deleted, leaving nothing remaining.

I can set the video file name, provided I specify the extension directly (without an extension I get an error) and then the mp3 name will match, but this is counterintuitive when I'm not saving the video file.

Incidentally, I don't understand how to use templates.

youtube-dl --extract-audio --audio-format=mp3 --output "myfile.%(ext)" http://youtu.be/9ro0FW9Qt-4

Yields: "ERROR: invalid system charset or erroneous output template"

@rg3
Copy link
Collaborator

rg3 commented May 20, 2012

About the last issue, you're missing the lowercase S after the template parameter. This is documented here:

http://rg3.github.com/youtube-dl/documentation.html#d7

@CharliePicorini
Copy link

Hi,
If you need extract the sound track from the video with in a GUI and keep the extracted sound track in mp3 with the same name as in the video then iVAc can help you. It's a kind of front-end to youtube-dl.

http://x.platformeasytools.free.fr/download_MC.html

You'll need a java virtual machine (JVM) and mencoder

Hope this help
Regards
CP

@frabjous
Copy link
Author

rg3, thanks for the info.

Charlie, please don't use the bugtracker to plug your GUI. This issue has nothing to do with it. I use youtube-dl in a script, and a GUI would be useless to me.

@ocisly
Copy link

ocisly commented May 26, 2014

@phihag seems to have been resolved...?

@marcotrosi
Copy link

Hello,

I experienced the same issue.
Calling youtube-dl with -x and -o does not work.
It creates an empty audio file. And as frabjous already mentioned, it seems like video and audio get them same file extension or something.

BR,

marco

youtube-dl -x -o '~/Downloads/%(title)s.%(ext)s' y o u t u b e . c o m /watch?v=NjxNnqTcHhg
[youtube] Setting language
[youtube] Confirming age
[youtube] NjxNnqTcHhg: Downloading webpage
[youtube] NjxNnqTcHhg: Downloading video info webpage
[youtube] NjxNnqTcHhg: Extracting video information
[download] Destination: /Users/myname/Downloads/Popcorn Original Song.m4a
[download] 100% of 3.44MiB in 00:02
[youtube] Post-process file /Users/myname/Downloads/Popcorn Original Song.m4a exists, skipping

@5n00p4eg
Copy link

youtube-dl -x --audio-format mp3 --audio-quality 0 -i -o '%(autonumber)s. %(title)s_%(id)s.%(ext)s' https://www.youtube.com/playlist\?list\=PLDfKAXSi6kUY0DDWDo2-tH3-ErRk08fWe

....
[download] Destination: 00002. Pat Lok - Move Slow (GANZ Remix)_RTRUFPhU8QA.m4a
[download] 100% of 3.93MiB in 00:00
[avconv] Destination: 00002. Pat Lok - Move Slow (GANZ Remix)_RTRUFPhU8QA.mp3
....

So everything work fine.
.%(ext)s at the end of format is required

@marcotrosi
Copy link

Hi,

I tested what you sent me.
It works only if the parameter
--audio-format mp3
is given
If omitted it doesn't work

works
youtube-dl -x --audio-format mp3 --audio-quality 0 -i -o '%(title)s_%(id)s.%(ext)s' https://www.youtube.com/watch?v=iyTTX6Wlf1Y

does not work
youtube-dl -x --audio-quality 0 -i -o '%(title)s_%(id)s.%(ext)s' https://www.youtube.com/watch?v=iyTTX6Wlf1Y

I thought by omitting this parameter youtube-dl will automatically extract the original audio format without conversion.

BR,

#marco

Am 14.09.2014 um 17:01 schrieb Boyko Daniel notifications@github.com:

youtube-dl -x --audio-format mp3 --audio-quality 0 -i -o '%(autonumber)s. %(title)s_%(id)s.%(ext)s' https://www.youtube.com/playlist\?list\=PLDfKAXSi6kUY0DDWDo2-tH3-ErRk08fWe

....
[download] Destination: 00002. Pat Lok - Move Slow (GANZ Remix)_RTRUFPhU8QA.m4a
[download] 100% of 3.93MiB in 00:00
[avconv] Destination: 00002. Pat Lok - Move Slow (GANZ Remix)_RTRUFPhU8QA.mp3
....

So everything work fine.
.%(ext)s at the end of format is required


Reply to this email directly or view it on GitHub.

@phihag
Copy link
Contributor

phihag commented Sep 22, 2014

@marcotrosi Can you elaborate how "it does not work"? Is there a file on your filesystem? If so, what is the output of ls -l *m4a?

You'll indeed get the raw audio file if you leave out --audio-format. YouTube serves that file in their version of m4a, which is only supported by some players such as mplayer.

@marcotrosi
Copy link

Ok, forget everything I said.
I'm now getting the audiofile but under OSX I can not play the file with the preview (by pressing spacebar in Finder).
But with a player (like mplayer) it works

Sorry for the inconvenience

#marco

p.s. I am working on a pseudo GUI for youtube-dl to extract audio. If you are interested I can send you the app.

Am 22.09.2014 um 19:27 schrieb Philipp Hagemeister notifications@github.com:

@marcotrosi Can you elaborate how "it does not work"? Is there a file on your filesystem? If so, what is the output of ls -l *m4a?

You'll indeed get the raw audio file if you leave out --audio-format. YouTube serves that file in their version of m4a, which is only supported by some players such as mplayer.


Reply to this email directly or view it on GitHub.

@phihag
Copy link
Contributor

phihag commented Oct 25, 2014

This seems to be resolved. @marcotrosi Feel free to mention a URL where your program is distributed. I'll include it in a list of UIs.

@phihag phihag closed this as completed Oct 25, 2014
joedborg referenced this issue in joedborg/youtube-dl Nov 17, 2020
[pull] master from ytdl-org:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants