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

Java - can not pass arguments/parameters to youtube-dl.exe #16730

Closed
FluffyDiscord opened this issue Jun 14, 2018 · 1 comment
Closed

Java - can not pass arguments/parameters to youtube-dl.exe #16730

FluffyDiscord opened this issue Jun 14, 2018 · 1 comment
Labels

Comments

@FluffyDiscord
Copy link

@FluffyDiscord FluffyDiscord commented Jun 14, 2018

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like this: [x])
  • Use the Preview tab to see what your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2018.06.14. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2018.06.14

Before submitting an issue make sure you have:

  • At least skimmed through the README, most notably the FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones
  • Checked that provided video/audio/playlist URLs (if any) are alive and playable in a browser

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

I have been trying to use Java ProcessBuilder to execute youtube-dl with parameters.
I have not been able to pass more than one parameter to youtube. Tried to enter one parameter after another as this:

`for (int i = 0; i < links.length; i++) {

//youtube dl commands
String path = "G:\\youtube-dl.exe";
String ea = "-x";
String af = "--audio-format mp3";
String aq = "--audio-quality 75K";
String[] cmd = {path, ea, af, aq, links[i]};
ProcessBuilder process = new ProcessBuilder(cmd);
String output = org.apache.commons.io.IOUtils.toString(process.start().getErrorStream());
System.out.println(output);
process.start();

}`
But it only passed the first one, then said

error: no such option --audio-format mp3

Then I tried to pass it as one big command
String commands = "--extract-audio" + "--audio-format " + defaultAudioFormat + "--audio-quality " + aBitrate + "K";
and i got the same result, but every command there

error: no such option: --extract-audio--audio-format mp3--audio-quality 75K

Adding spaces in quotes does not work.
Would you happen to know how can I get it to work?

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Jun 14, 2018

String[] cmd = {path, ea, "--audio-format", "mp3", links[i]};
@dstftw dstftw closed this Jun 14, 2018
@dstftw dstftw added the invalid label Jun 14, 2018
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.