Comments (24)
request.setOption("--write-thumbnail"); request.setOption("-o", youtubeDLDir.getAbsolutePath() + "/%(title)s.%(ext)s");
These commands work with me.
Here's the link: https://www.youtube.com/watch?v=cwgOVslrtn8
tested on android 10 and 9.
from youtubedl-android.
What is the error code or error message that appears.
also use getApplication() instead of "this".
replace
YoutubeDL.getInstance().init(this);
FFmpeg.getInstance().init(this);
with
YoutubeDL.getInstance().init(getApplication());
FFmpeg.getInstance().init(getApplication());
from youtubedl-android.
I'm testing on a real device so I don't have any error message and getApplication() doesn't work either
from youtubedl-android.
What options are you setting on the YoutubeDLRequest
object?
Can you share the link for which the download fails?
from youtubedl-android.
It's litterally your stable release 0.7.0 and in the "app/src/main/java/com/yausername/youtubedl_android_example/App.java" I have added this line FFmpeg.getInstance().init(this);
at line 55 above YoutubeDL.getInstance().init(this);
that's all.
The link I have used to test is just a random link from youtube : https://www.youtube.com/watch?v=VDB65S6rCC0
from youtubedl-android.
Shouldn't it be handled by the command given to youtube-dl?
Rather than downloading the video then extracting the audio, you could directly download the audio and output it to an mp3 file
It would use a lot of bandwidth especially on large playlists for nothing
from youtubedl-android.
It's litterally your stable release 0.7.0 and in the "app/src/main/java/com/yausername/youtubedl_android_example/App.java" I have added this line
FFmpeg.getInstance().init(this);
at line 55 aboveYoutubeDL.getInstance().init(this);
that's all.
The link I have used to test is just a random link from youtube : https://www.youtube.com/watch?v=VDB65S6rCC0
I am not able to reproduce this on my device. What android version are you on?
You need to look at logcat to figure out what the error is.
from youtubedl-android.
Shouldn't it be handled by the command given to youtube-dl?
Rather than downloading the video then extracting the audio, you could directly download the audio and output it to an mp3 file
It would use a lot of bandwidth especially on large playlists for nothing
Yes, it will be handled by youtube-dl. youtube-dl will not download the video when only audio is requested but will still need ffmpeg for converting the audio to mp3.
from youtubedl-android.
Yes, it will be handled by youtube-dl. youtube-dl will not download the video when only audio is requested but will still need ffmpeg for converting the audio to mp3.
I tried to modify the line:
"request.setOption("-o", youtubeDLDir.getAbsolutePath() + "/%(title)s.%(ext)s");"
(line 104 in the DownloadingExampleActivity.java) to download a thumbnail with no success though (and I doubt it needs ffmpeg to get an image).
Reading the documentation of youtube-dl didn't help much in this regard.
Another common error is python missing on Android emulators, but it shouldn't be affecting tests on a real device.
I am not able to reproduce this on my device. What android version are you on?
You need to look at logcat to figure out what the error is.
Android version 8.0
from youtubedl-android.
I got this
failed to download : com.yausername.youtubedl_android.YoutubeDLException: java.io.IOException: Cannot run program "/data/user/0/com.yausername.youtubedl_android_example/files/youtubedl-android/packages/usr/bin/python": error=2, No such file or directory
at com.yausername.youtubedl_android.YoutubeDL.execute(YoutubeDL.java:157)
at com.yausername.youtubedl_android_example.DownloadingExampleActivity.lambda$startDownload$0$DownloadingExampleActivity(DownloadingExampleActivity.java:115)
at com.yausername.youtubedl_android_example.-$$Lambda$DownloadingExampleActivity$DIqcJ_vtApVhyONpHFiA5nyofXo.call(Unknown Source:4)
at io.reactivex.internal.operators.observable.ObservableFromCallable.subscribeActual(ObservableFromCallable.java:42)
at io.reactivex.Observable.subscribe(Observable.java:12030)
at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:579)
at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.io.IOException: Cannot run program "/data/user/0/com.yausername.youtubedl_android_example/files/youtubedl-android/packages/usr/bin/python": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at com.yausername.youtubedl_android.YoutubeDL.execute(YoutubeDL.java:155)
... 13 more
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:133)
at java.lang.ProcessImpl.start(ProcessImpl.java:128)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 14 more
from youtubedl-android.
I got this
Does it error without ffmpeg also?
Does it print any error at init
time?
Can you do force stop, clear data, reopen app and see if any error happens at init?
from youtubedl-android.
no error at init time.
Yes, the error is the same with or without ffmpeg but without ffmpeg I can download on real device. On emulator I've never been able to download.
from youtubedl-android.
On emulator I've never been able to download.
On emulator it is not expected to work since emulators use x86 images which are not supported. I should have mentioned this in the readme. You can try with arm images on the emulator if you have to.
from youtubedl-android.
Yes, I've already tested it on arm and it works but arm is so slow that I can't even start the emulator. Nonetheless, that's not working with ffmpeg.
from youtubedl-android.
Nonetheless, that's not working with ffmpeg.
Can you do uninstall and reinstall on real device and see logcat for errors at init and at the time on download? You can also try to run on debug mode using android studio and put break points in L58 of App.java
from youtubedl-android.
I tried to modify the line:
"request.setOption("-o", youtubeDLDir.getAbsolutePath() + "/%(title)s.%(ext)s");"
(line 104 in the DownloadingExampleActivity.java) to download a thumbnail with no success though (and I doubt it needs ffmpeg to get an image).
This works for me. The thumbnail is also downloaded.
request.setOption("--write-thumbnail");
request.setOption("-o", youtubeDLDir.getAbsolutePath() + "/%(title)s.%(ext)s");
from youtubedl-android.
This works for me. The thumbnail is also downloaded.
request.setOption("--write-thumbnail"); request.setOption("-o", youtubeDLDir.getAbsolutePath() + "/%(title)s.%(ext)s");
I have been trying to apply your solution with no luck unfortunately.
I reckon the thumbnail would be generated in the same folder as the video, but it didn't. Looking around in the phone gave no result.
Adding the parameter youtubeDLDir.getAbsolutePath() did not work either. The video is successfully downloaded each time though.
request.setOption("--write-thumbnail", youtubeDLDir.getAbsolutePath());
Just in case, I tested it with --write-description as well, again without any good result.
Tested on an Android 8.0 device as the download on emulator is broken.
from youtubedl-android.
request.setOption("--write-thumbnail", youtubeDLDir.getAbsolutePath());
This option does not accept a second parameter. So this won't work.
If you set both the options like below, the thumbnail should be downloaded just next to where the video is. Also share link of the vid that you are trying.
request.setOption("--write-thumbnail");
request.setOption("-o", youtubeDLDir.getAbsolutePath() + "/%(title)s.%(ext)s");
from youtubedl-android.
@vdstogel Can you share an apk for me to test?
from youtubedl-android.
Here's the link: https://www.youtube.com/watch?v=cwgOVslrtn8
To be absolutely sure, I copy-pasted your lines. As expected, the video is downloaded flawlessly, but no thumbnail whatsoever.
This is a slightly modified version of your code where we are currently implementing an activity with databases to constantly keep playlists updated. The .apk had to be zipped because GitHub doesn't allow the apk extension.
from youtubedl-android.
Alright, so @Marinos33 tried on his phone and got the thumbnail as well as the video.
The .apk is the same so it's an issue on my device. We both use the version 8.0.
Also, -x worked on his device.
So he is able to get audio extracted from the video.
from youtubedl-android.
I don't know why but now FFmpeg works, It's magic !!!
Anyway, thanks for your help.
from youtubedl-android.
The apk provided by you doesn't download thumbnails on my device too.
I think this might be an issue with your build system/android studio. Close android studio and run ./gradlew clean assembleDebug
. This will generate an apk in ./app/build/outputs/apk/debug/app-debug.apk
from youtubedl-android.
Should work on emulators also with 0.8.0
, although I haven't tested because my slow machine can't run emulators.
from youtubedl-android.
Related Issues (20)
- Youtube Video has no sound HOT 1
- insatgram "Thrades" not working
- 403 HTTP error HOT 9
- Resolve Duplicate FFmpeg Code between arthenica/ffmpeg-kit and youtubedl-android HOT 2
- Python & FFmpeg as downloadable plugins HOT 12
- instance not initialized HOT 1
- Processing logs causes OutOfMemoryError when downloading long streams
- How get Youtube VideoFormat list
- Error To Get VideoInfo HOT 1
- Download Not Work in Live App. HOT 7
- I can't get the format list for some videos in YouTube. HOT 1
- Update FFmpeg to the lastet version HOT 5
- Showing Downloaded Bytes for RTMP Videos
- ( lib/x86_64/libpython.zip.so) Malware Detected HOT 13
- destroyProcessByID not working with external executables running in child processes HOT 11
- [Errno 2] No usable temporary directory found in ['/data/data/com.termux/files/usr/tmp', '/'] HOT 5
- Resolution Setting
- Improvement Request update to python 3.12 for better performance ( libpython.zip.so)
- Feature Request: Add callback to read the output of process whether it is progress or not HOT 5
- Add FFMPEG progress regex matcher
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from youtubedl-android.