Problem playing downloaded multiple sections of a youtube video with a single command with yt-dlp on android

189 views Asked by At

I'm trying to to download multiple sections of a YouTube video with yt-dlp at once with Termux on Android. An output template naming each file according to the timestamps to differentiate the files from one other is the main cause of my trouble now. The videos were successfully downloaded but did not play on my android returning an error message "Can't preview file type" while they played on my PC. I copied the video from my PC and the problem persists. The videos play on my android if I don't use an output template but that means new sections of the video won't be downloaded because they'll all have the same filename.

This is the command I used.The videos get downloaded but they don't play on my android (version 12) which is where I need the video.

yt-dlp -f  <FORMAT> --download-sections "*21:00 - 21:10" --download-sections "*23:37 - 23:44" --download-sections "*26:41 - 26:48" <URL> -o "%(title)s %(section_start)s %(section_end)s . %(ext)s"

I'd also be grateful if anyone would be kind enough to show me a faster way to download multiple sections of a YouTube video without having to type out "download sections" several times. I once saw something about creating a timestamp.txt file and adding all the timestamps in it but I couldn't get it to work. Any help will be appreciated

2

There are 2 answers

0
furas On

Android (similar to other Linux) shouldn't use extension to recognize file type
but if I'm wrong and if some programs use extension to detect file type
then you shouldn't use space after dot, before extension - . %(ext)s
and you should change into .%(ext)s

0
Programmer Dancuk On

YOur syntax is correct. all you need to do is re-encode the downloaded parts so it become playable