-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Download range #622
Comments
This is request is more complex than it sounds:
All, in all, this is quite complex, but certainly doable. Feel free to contribute patches or pull request, even for the individual steps. |
Hi, I've tried to implement the Byte Range and it worked but of course the video will not play. Probably i need to reassemble the sequence somehow |
Feel free to submit a pull request for the byte range. It's far easier to integrate code in small steps than all at once, and others may chip in. |
hi guys, this feature is super important for us. any updates on this issue? |
Hi Thanks |
@shaybracha today its too late. I will see tomorrow and will tell you. 👍 |
@yasoob thanks...waiting for your answer |
Sorry I was not able to do it today because my laptop broke :( okay you
|
This is fairly easy to accomplish with ffmpeg. Example:
You can get the direct link by using the I don't know this projects feelings on adding (optional) dependancies, but this would be trivial to implement provided ffmpeg (compiled with open-ssl) is available. If adding the dependency is not an option, then, as I'm sure you're all aware, this is a pretty mammoth task. Users who have ffmpeg installed can use method this in the meantime. |
For current twitch.tv VoDs, byte-range is not necessarily needed, as they are split into 4-second chunks, and m3u8 playlist specifies all the chunk lengths precisely (e.g. I did write a proof-of-concept script for that here, and it seem to work nicely, except for some sequential download performance issues, which kinda rule-out downloading whole thing with ffmpeg directly. |
@JaySandhu please provide some complete example: cause I did this: ffmpeg -ss 14350 -i https://www.youtube.com/watch?v=mMZriSvaVP8 --get-url -t 11200 -c:v copy -c:a copy react-spot.mp4 |
@roberto68 Sorry for the confusion, to get a direct link to the video you need to use youtube-dl's --get-url option. Then, with a direct video link from youtube-dl, you can use ffmpeg as described above. Example: Then with the link: One line version: You can either pick a format with both video and audio (such as -f 22), or you can use ffmpeg to combine a DASH audio and video stream. You'll need to make sure you're ffmpeg build includes open-ssl (so that it can download the video over https). |
thanks JaySandhu, now it's workin right way :) |
replace old downloaders with a unified ffmpeg downloader: - replace old HlsFD and RtspFD(based on mplayer and mpv) - add basic support for download range
I can give it a try to implement this feature.. Right now when I tried to skip the video, youtube sent a request shown below. I then tried downloading the link directly with Params:
can someone give me any pointers from their earlier research on this to hep me? |
@johnhawkinson apparently default windows cmd not support $ |
As I said, use |
Yeah, something like One of the many reasons why you should use PowerShell! Because it can do sub-expressions: So try
in PowerShell.. Edit: Proof: 😄
|
I did it for windows but is extremely slow for download Download.bat
|
Hi es3! I would love to try this bat file but I have very basic knowledge in command lines. I understand that we can include the video by changing it to bestvideo+bestaudio instead. Other than that and the title, which else do we have to change to download our preferred youtube link? I'm not sure what to remove, replace, and add from your code. T_T @echo OFF The lines I changed where 7, 8, 10, 11, & 12. I'm also not sure what characters(e.g % , ") has to be remove or retain. I'm using Windows 10 with no bash or like that installed(yet). Also, since my storage is a bit short, this will download only the portion we need and not the entire 4hrs video to then trim and remove the rest, right? Appreciate any advice from you guys. |
Download ffmpeg from https://ffmpeg.zeranoe.com/builds/ Replace from the original script "Download.bat" Now open a command line "cmd.exe" xx:xx is start, yy:yy is the end |
What can I say? It's perfect! Thanks es3.. ^^ |
I made a bash script for having this done here: |
I would like to try this, if possible, on an Android non-rooted device? I'm using Termux v0.8 with Python v3.7.5, Nano v4.5, and youtube-dl installed in it. With my very basic command line knowledge, what I tried doing is, I downloaded your *.sh file sitting alone to a new folder in my android device. Run Termux with the work directory where the *.sh file is located. Then executed the command "download_youtube.sh https://www.youtube.com/watch?v=U8WRGFB_PWM 00:10:00 00:15:00 intro.mp4" It returned me this line...
I thought I may need to install the *.sh file, so I did the "./download_youtube.sh" and returned me a message saying...
I tried "chmod u+x download_youtube.sh" and it says...
I'm not sure what to do next. Can you help me what I did wrong? |
I know nothing about android and that you said there. But if it's like a normal Linux CLI environment you should check your permissions and where you are and that sort of things...
|
I got Termux from Playstore as Terminal for my Android device. The rest I installed through Termux via pgk, pip, & apt-get commands. I tried the commands you asked and it showed...
I believe this has to do with my Android not being rooted. Idk. If so, we can't do much about it. |
I downloaded the damn thing and it worked this way: cd
curl -L https://gitlab.com/snippets/1910457/raw?inline=false -o ../usr/bin/download_youtube
chmod +x ../usr/bin/download_youtube just use |
My apologies. I thought they're exactly the same as native Linux Terminal, guess not. I mainly work on desktop. I don't have nor tried Linux before but got interested of it out from your post, so thought of giving it a try. I remembered someone run Linux Terminal from Android so I did a little research and so came Termux and somehow I got those others installed as well. To make typing less painful, I installed Hacker's Keyboard from Playstore to emaulate the physical one. In short, curiosity just got me the desire to try.
I did as you instructed and got it to work perfectly. It's awesome! I noticed, the downloaded file will be saved to the location where you are currently at in your Termux. Thanks Rodsevich! |
yeah, unless you put the path in the name. for example:
|
When running the exact code from @Rodsevich in the previous comment (in terminal on macOS), I get this error: |
This solution works for me on Windows, in Anaconda prompt. |
UPDATED- It 's already SOLVED, thanks to the solution of es3. |
Other solution could work well on cmd and python code: (updated from #622 (comment)) |
Thanks! |
nice work, sounds good. could you please write a little guide on how to use it? |
In my case, I have to read such information like video_identifier, start_time, end_time in the csv file line by line, and download as well as trim the huge number of videos from youtube (such as Kinetics 400 dataset). Therefore a python code for automatically download just a portion of the video is needed for storage saving and also time-saving :) |
thanks for the quick reply |
Hi,
Is there any way to implement a download range? To download starting from 1m 30 to 1m 50?
Thanks
The text was updated successfully, but these errors were encountered: