question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Im trying to download the audio as an mp3, but I keep getting the error:

com.sapher.youtubedl.YoutubeDLException: ERROR: ffprobe or avprobe not found. Please install one.

	at com.sapher.youtubedl.YoutubeDL.execute(YoutubeDL.java:90)
	at TestingFunctions.main(TestingFunctions.java:37)

I do have ffmpeg installed, so I don’t know whats the issue

Heres what I have in terms of code:

File a = new File("a.mp3");
		File b = new File("a.webm");
		if (a.exists()) {
			a.delete();
		}
		if (b.exists()) {
			b.delete();
		}

		String videoUrl = "https://www.youtube.com/watch?v=BrCKvKXvN2c";
		String directory = System.getProperty("user.dir");

		try {
			YoutubeDLRequest request = new YoutubeDLRequest(videoUrl, directory);
			YoutubeDL.setExecutablePath("/usr/local/Cellar/youtube-dl/2017.09.15/bin/youtube-dl");
			request.setOption("no-mark-watched");
			request.setOption("no-playlist");
			request.setOption("extract-audio");
			request.setOption("audio-format mp3");
			request.setOption("output a.%(ext)s");
			
			
			
			System.out.println("Downloading...");
			YoutubeDLResponse response = YoutubeDL.execute(request);

			String stdOut = response.getOut();
			
			System.out.println(stdOut);

		} catch (Exception YoutubeDLException) {
			YoutubeDLException.printStackTrace();
		}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
saphercommented, Oct 5, 2017

If ffmpeg is installed you should be able to invoke it through the terminal by doing ffmpeg like so capture d ecran 2017-10-05 a 20 18 50

You can add request.setOption("prefer-ffmpeg"); or request.setOption("prefer-avconv"); to force the use of one or another.

Also you can use request.setOption("ffmpeg-location /my_path/PATH"); to manually set the path of ffmpeg executable. I don’t think you have to do that. If you have youtube-dl, ffmpeg or avconv in your PATH it should work with no issue.

As this library seemed to be use by some people, I’m going to rethink the API.

0reactions
yeSpudcommented, Oct 5, 2017

Ok, that seemed to work. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

List of file formats - Wikipedia
List of file formats · HTML – Hypertext Markup Language · Avro – Data format appropriate for ingestion of record based attributes. ·...
Read more >
What is a File Format? - Computer Hope
The file format is the structure of a file that tells a program how to display its contents. For example, a Microsoft Word...
Read more >
What is file extension (file format) ? | Definition from TechTarget
In a computer, a file extension, also called a file format, is the layout of a file -- in terms of how the...
Read more >
File Format Docs
A file format describes the structure of data in a file that applications follow to read or create such files. File types can...
Read more >
21 Different Types of Files and How to Use Them | Indeed.com
5 types of document files · 1. Portable document format (PDF) · 2. Word document (DOC and DOCX) · 3. Hypertext markup language...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found