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

youtube-dl.exe: error: no such option: --audio-format mp3 when executing with Java ProcessBuilder #12655

Closed
Babbie opened this issue Apr 5, 2017 · 2 comments
Labels

Comments

@Babbie
Copy link

@Babbie Babbie commented Apr 5, 2017

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 that [x])
  • Use Preview tab to see how your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2017.04.03. 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 2017.04.03

Before submitting an issue make sure you have:

  • At least skimmed through README and most notably FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones

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

The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue


If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:

Add -v flag to your command line you run youtube-dl with, copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):

Usage: youtube-dl.exe [OPTIONS] URL [URL...]

youtube-dl.exe: error: no such option: --audio-format mp3

Note :This is output from stderr, there is no output from stdout. I am running this from within a ProcessBuilder. It is run with this command array:

[youtube-dl.exe, -x, -v, --audio-format "mp3", -i, -o audio\107437558354423808\xoP9OQxSd9c.%(ext)s, --geo-bypass, --no-progress, https://www.youtube.com/watch?v=xoP9OQxSd9c]

Running the command manually from the command line works fine! If we remove the double quotes around mp3 or add more the exact same thing happens, except there will be (amount of double quotes - 1) double quotes around the mp3 in the log.

Description of your issue, suggested solution and other information

Explanation of your issue in arbitrary form goes here. Please make sure the description is worded well enough to be understood. Provide as much context and examples as possible.
If work on your issue requires account credentials please provide them or explain how one can obtain them.

I am running this from within a Java program using a ProcessBuilder. It looks like this:

List<String> command = new ArrayList<>(Arrays.asList("youtube-dl.exe", "-x", "--audio-format \"mp3\"", "-i", "-o text.%(ext)s", "--geo-bypass", "--no-progress", "https://www.youtube.com/watch?v=xoP9OQxSd9c"));

Process youtubedl;
try {
    System.out.println("Starting youtube-dl to get file with command: " + command);
    youtubedl = new ProcessBuilder(command).start();
} catch (IOException e) {
    System.out.println("Failed to start youtube-dl! Stacktrace: ");
    e.printStackTrace();
}

BufferedReader commandOutput = new BufferedReader(new InputStreamReader(youtubedl.getInputStream()));
BufferedReader commandError = new BufferedReader(new InputStreamReader(youtubedl.getErrorStream()));

try {
    String currentLine;
    System.out.println("--------------youtube-dl output: ");
    while ((currentLine = commandOutput.readLine()) != null) {
        System.out.println(currentLine);
    }
    System.out.println("--------------youtube-dl output finished");
    System.out.println("--------------youtube-dl error: ");
    while ((currentLine = commandError.readLine()) != null) {
        System.out.println(currentLine);
    }
    System.out.println("--------------youtube-dl error finished");
} catch (IOException e) {
    System.out.println("Could not read youtube-dl output! Stacktrace: ");
    e.printStackTrace();
}
@dstftw
Copy link
Collaborator

@dstftw dstftw commented Apr 5, 2017

List command = new ArrayList<>(Arrays.asList("youtube-dl.exe", "-x", "--audio-format", "mp3", "-i", "-o", "text.%(ext)s", "--geo-bypass", "--no-progress", "https://www.youtube.com/watch?v=xoP9OQxSd9c"));

@dstftw dstftw closed this Apr 5, 2017
@dstftw dstftw added the invalid label Apr 5, 2017
@Babbie
Copy link
Author

@Babbie Babbie commented Apr 5, 2017

Thanks!

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.