Download range

Hi,
Is there any way to implement a download range? To download starting from 1m 30 to 1m 50?
Thanks

This is fairly easy to accomplish with ffmpeg. Example:
ffmpeg -ss (start time) -i (direct video link) -t (duration you need) -c:v copy -c:a copy (title.mp4)

You can get the direct link by using the --get-url option.
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. #EXTINF:3.240,), so if ~4s seek precision is tolerable (which it probably is) - it's only a matter of running through playlist to pick the links needed.
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.
Did a write-up on on the whole process here.

@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
and it did not work.

@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:
youtube-dl -f 22 --get-url https://www.youtube.com/watch?v=mMZriSvaVP8
Then with the link:
ffmpeg -ss 14350 -i (link) -t 11200 -c:v copy -c:a copy react-spot.mp4
One line version:
ffmpeg -ss 14350 -i $(youtube-dl -f 22 --get-url https://www.youtube.com/watch?v=mMZriSvaVP8) -t 11200 -c:v copy -c:a copy react-spot.mp4
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 :)

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 wget and I also got a file of about 500 KB but it did not play in VLC, KMPlayer, MPlayer, etc. So maybe there is another missing piece?
Link:
https://r3---sn-ci5gup-cvhz.googlevideo.com/videoplayback?initcwndbps=365000&sparams=clen%2Cdur%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cupn%2Cexpire&id=o-AE1c25o1pRu61sxBCZWQksq3ixkGB_Uqtl2xKDhs1LUa&sver=3&ip=<IP_ADDRESS>&mv=m&mt=1456387095&ms=au&fexp=3300134%2C3300164%2C3311882%2C3312381%2C3312529%2C9405186%2C9408497%2C9413141%2C9416126%2C9418200%2C9419451%2C9420452%2C9422342%2C9422596%2C9423661%2C9423662%2C9425283%2C9425790%2C9427107%2C9427422%2C9428649%2C9428710%2C9429072%2C9429597&dur=11346.869&upn=M38qsT9uuVg&mn=sn-ci5gup-cvhz&mm=31&source=youtube&signature=D0FD6BB2BD5E82C7B882813C552C06EDBDCE2A82.1E85213F62C2E69F4FCEA7D7E87B8BC9D00CB7E8&lmt=1418940170813485&ipbits=0&key=yt6&itag=247&mime=video%2Fwebm&clen=2245741091&pl=21&keepalive=yes&requiressl=yes&expire=1456408861&gir=yes&cpn=TR7wBJmFEBEkwtVX&alr=yes&ratebypass=yes&c=WEB&cver=html5&range=415184135-417218639&rn=28&rbuf=31205
Params:
initcwndbps:365000
sparams:clen,dur,gir,id,initcwndbps,ip,ipbits,itag,keepalive,lmt,mime,mm,mn,ms,mv,pl,requiressl,source,upn,expire
id:o-AE1c25o1pRu61sxBCZWQksq3ixkGB_Uqtl2xKDhs1LUa
sver:3
ip:<IP_ADDRESS>
mv:m
mt:1456387095
ms:au
fexp:3300134,3300164,3311882,3312381,3312529,9405186,9408497,9413141,9416126,9418200,9419451,9420452,9422342,9422596,9423661,9423662,9425283,9425790,9427107,9427422,9428649,9428710,9429072,9429597
dur:11346.869
upn:M38qsT9uuVg
mn:sn-ci5gup-cvhz
mm:31
source:youtube
signature:D0FD6BB2BD5E82C7B882813C552C06EDBDCE2A82.1E85213F62C2E69F4FCEA7D7E87B8BC9D00CB7E8
lmt:1418940170813485
ipbits:0
key:yt6
itag:247
mime:video/webm
clen:2245741091
pl:21
keepalive:yes
requiressl:yes
expire:1456408861
gir:yes
cpn:TR7wBJmFEBEkwtVX
alr:yes
ratebypass:yes
c:WEB
cver:html5
range:415184135-417218639
rn:28
rbuf:31205

can someone give me any pointers from their earlier research on this to hep me?

Anyone ever figure this one out? Sending range or begin params doesn't work for me, curious if anyone has found a working solution?

/me would also be interested.

Whoops, sorry for the dupe. Although in #12347 I asked:

I realize we can sort of achieve this today by passing args to ffmpeg, e.g.
youtube-dl ... --external-downloader ffmpeg --external-downloader-args '-ss 3718.538 -t 60'
or perhaps as a postprocessor arg where appropriate.
But that's not very user-friendly, and knowing when to choose an external downloader versus a postprocessor may not be obvious.
I guess maybe this could just be a FAQ entry, but I think some options would be a better goal.

Can we get some interim documentation in the absence of a real user-oriented feature?

There are already quite a few such cases (workarounds for missing features), and I guess they will make README.md even more bloated. IMO it's enough to listed them in relevant issues. Your comment will definitely benifit those who need it.

Fair enough. Although I found it tough to find this Issue. I did in fact search before filing a new one, although obviously not extremely hard :)

ffmpeg -ss 14350 -i $(youtube-dl -f 22 --get-url https://www.youtube.com/watch?v=mMZriSvaVP8) -t 11200 -c:v copy -c:a copy react-spot.mp4

Was looking for this feature to be able to download a time segment from a video. Is @JaySandhu's 2015 answer still one of the better ways to do this or does youtube-dl support this feature in any way? Don't get me wrong, it's a great answer, I was just curious to see if anyone was aware of current developments seeing how this issue is still open and all.

I believe there has not been any change.

I'd like to follow @JaySandhu's suggestion but am lost and would greatly appreciate some help!
Let's take this link, of which I would like the first 29 minutes and 54 seconds, as an example:
https://www.youtube.com/watch?v=2QPbriKs_sI&list=PLtra-MWzIvZGdqzuA59Jp0dZVzpmNZyT0&index=2
When I try to get the url of the file via the --get-url option I get this:

youtube-dl --get-url https://www.youtube.com/watch?v=2QPbriKs_sI&list=PLtra-MWzIvZGdqzuA59Jp0dZVzpmNZyT0&index=2
[1] 1322
[2] 1323
[2]+  Done                    list=PLtra-MWzIvZGdqzuA59Jp0dZVzpmNZyT0
users-MacBook-Pro:~ user$ https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?id=d903dbae22acfec2&itag=137&source=youtube&requiressl=yes&pcm2cms=yes&ei=fsKGWeyGLcONowO8xIP4AQ&mm=31&pl=20&mn=sn-8vq54voxpo-5hql&initcwndbps=1352500&ms=au&mv=m&ratebypass=yes&mime=video/mp4&gir=yes&clen=16938851529&lmt=1498521946448697&dur=36000.000&key=dg_yt0&signature=224CB1B319564531CA1819805C9EFF3848A9C801.3AC4B5B275625FF0F5D2F6D49F756CDEA4ADCB67&mt=1502003750&ip=<IP_ADDRESS>&ipbits=0&expire=1502025438&sparams=ip,ipbits,expire,id,itag,source,requiressl,pcm2cms,ei,mm,pl,mn,initcwndbps,ms,mv,ratebypass,mime,gir,clen,lmt,dur
https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?mime=audio%2Fwebm&keepalive=yes&source=youtube&pcm2cms=yes&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Crequiressl%2Csource%2Cexpire&itag=251&expire=1502025437&gir=yes&mm=31&mn=sn-8vq54voxpo-5hql&dur=36000.000&mt=1502003750&mv=m&ms=au&lmt=1498650272424607&clen=526461218&ip=<IP_ADDRESS>&key=yt6&ipbits=0&id=o-AJqnSngI1EXKktmEmtNUt0nvM1QwU2pjCTI-SU2tFwEj&ei=fcKGWevQLMnYowPh_qvQBQ&initcwndbps=1352500&pl=20&signature=15B982263BA7D44D7F0FDF9B8D167076E35F8882.2547270D7467DEA9FF6DF36E9A9841061073558D&requiressl=yes&ratebypass=yes
[1]+  Done                    youtube-dl --get-url https://www.youtube.com/watch?v=2QPbriKs_sI

Please, please help with the following!
1. I suspect that I am getting 2 urls here because the audio and video streams are not combined. How do I go about using ffmpeg to combine DASH audio and video streams, as Jay suggests?
2. Do I need to use : or leading zeroes in the timestamp? How do I distinguish 20 seconds from 2 minutes for the (duration you need) portion?
3. Will this command download the entire video and then crop out the portion I want or would it just download the requested portion?
And now a question that is not directly related but I would greatly appreciate some help with!
Does the --rm-cache-dir clear partially downloaded files? If not, what do I need to do to delete all partially downloaded files?

your command would be ffmpeg -ss 0 -i $(youtube-dl -f 22 --get-url https://www.youtube.com/watch?v=2QPbriKs_sI) > -t  1794 -c:v copy -c:a copy output.mp4  .
you are basically piping out youtube-dl output as an input to ffmpeg
sometimes it happens that the best format youtube-dl can find is the mixture of 1 best video and 1 best audio which eventually gets merged/muxed using ffmpeg/avconv

Do I need to use : or leading zeroes in the timestamp? How do I distinguish 20 seconds from 2 minutes for the (duration you need) portion

Basically you need to provide time in seconds so 20 seconds is 20 and 2 minutes is 120

Will this command download the entire video and then crop out the portion I want or would it just download the requested portion

It will first try to get the video for the given duration,if its fails then it would download the whole video.
example Also it may try https://www.youtube.com/watch?v=2QPbriKs_sI?start=0&end=1794&version=3
You can try  https://www.youtube.com/watch?v=2QPbriKs_sI&t=1794
where https://www.youtube.com/watch?v=2QPbriKs_sI is the video and t=1794 is the time from where to begin (29 min 54 sec)
for same reason   https://www.youtube.com/watch?v=2QPbriKs_sI?start=0&end=1794&version=3
doesnt end at 29 mins 54 sec ,
but changing start time did changed it start time

Thanks for weighing in, @siddht4. Wouldn't using the f -22 download the 720p version, which is the best version with both audio and video?
139          m4a        audio only DASH audio   82k , m4a_dash container, mp4a.40.5@ 48k (22050Hz), 204.18MiB
249          webm       audio only DASH audio   97k , opus @ 50k, 188.44MiB
250          webm       audio only DASH audio  111k , opus @ 70k, 249.28MiB
171          webm       audio only DASH audio  161k , vorbis@128k, 464.74MiB
140          m4a        audio only DASH audio  162k , m4a_dash container, mp4a.40.2@128k (44100Hz), 545.28MiB
251          webm       audio only DASH audio  170k , opus @160k, 502.07MiB
160          mp4        256x144    DASH video  242k , avc1.4d400c, 25fps, video only, 310.34MiB
278          webm       256x144    144p  303k , webm container, vp9, 25fps, video only, 379.01MiB
133          mp4        426x240    DASH video  377k , avc1.4d4015, 25fps, video only, 776.09MiB
242          webm       426x240    240p  444k , vp9, 25fps, video only, 734.48MiB
243          webm       640x360    360p  675k , vp9, 25fps, video only, 1.36GiB
134          mp4        640x360    DASH video  764k , avc1.4d401e, 25fps, video only, 1.63GiB
244          webm       854x480    480p 1022k , vp9, 25fps, video only, 2.53GiB
135          mp4        854x480    DASH video 1390k , avc1.4d401e, 25fps, video only, 3.42GiB
247          webm       1280x720   720p 2035k , vp9, 25fps, video only, 5.38GiB
136          mp4        1280x720   DASH video 2755k , avc1.4d401f, 25fps, video only, 7.39GiB
248          webm       1920x1080  1080p 3608k , vp9, 25fps, video only, 10.03GiB
137          mp4        1920x1080  DASH video 4589k , avc1.640028, 25fps, video only, 15.78GiB
17           3gp        176x144    small , mp4v.20.3, mp4a.40.2@ 24k
36           3gp        320x180    small , mp4v.20.3, mp4a.40.2
43           webm       640x360    medium , vp8.0, vorbis@128k
18           mp4        640x360    medium , avc1.42001E, mp4a.40.2@ 96k
22           mp4        1280x720   hd720 , avc1.64001F, mp4a.40.2@192k (best)

I would like to get the best audio and the best video (in this case 137 - 1920x1080 (DASH video)+251 - audio only (DASH audio)) and let ffmpeg mix the two.
I'm not clear as to what @JaySandhu's means when he mentions the --get-url command. Would ffmpeg -ss 0 -i $(youtube-dl https://www.youtube.com/watch?v=2QPbriKs_sI) > -t 1794 -c:v copy -c:a copy output.mp4 not work?

basically --get-url can be substituted by -g. The url for format 22 is only one but as you had previously also added playlist as get request so youtube-dl returned more than 1 urls.

I would like to get the best audio and the best video (in this case 137 - 1920x1080 (DASH video)+251 - audio only (DASH audio)) and let ffmpeg mix the two.

Basically I tried the url you provided and its 14.7 GB,so instead download only the best audio.
Alternative
wget -O "output-filename.mp4" $( youtube-dl -g -f bestaudio https://www.youtube.com/watch?v=2QPbriKs_sI )
so  ```
wget -O "output-filename.mp4" $( youtube-dl -g -f bestaudio https://w
ww.youtube.com/watch?v=2QPbriKs_sI )&start=0&end=1794&version=3

Thanks @siddht4. My ffmpeg version is 3.3.3.
I'm sorry but I don't follow what you said! Could you please list the command I would use to get the best versions of audio and video and get ffmpeg to combine them?
I like how youtube-dl automatically mixes the two if ffmpeg is present :-)

I'm sorry but I don't follow what you said! Could you please list the command I would use to get the best versions of audio and video and get ffmpeg to combine them

for that just use youtube-dl,it will merge the best audio and best video all by itself. more details https://github.com/rg3/youtube-dl#format-selection
https://github.com/rg3/youtube-dl#video-selection
If you just need an url so that you could download via external programs you can use -g or --get-url.
If you just provide youtube-dl with best as the parameter i.e youtube-dl -f best [youtube_url] it will start to download the best video it found out. But if you instead need that url then use  youtube-dl -g -f best [youtube_url]. These command will instead provide you the links  https://github.com/rg3/youtube-dl#verbosity--simulation-options

I still don't get it :-( I would like the best audio + best video but restricted to the first 29 minutes and 54 seconds. Many thanks for your continued help!

but restricted to the first 29 minutes and 54 seconds

This feature is not present in youtube-dl.
So as a workaround use @JaySandhus   method i.e using ffmpeg with youtube-dl   or use as I commented earlier wget with youtube-dl with  start,end and version paramaters too.
This is simply   ( https://www.youtube.com/watch?v=2QPbriKs_sI&start=0&end=1947&version=3) which can be seen in youtube

I would like the best audio + best video

Use https://github.com/rg3/youtube-dl#format-selection in this case

How can I use Jay's method without f -22 and with the best audio + video but restricted to the time portion I want?
If I use the command that you posted earlier ffmpeg -ss 0 -i $(youtube-dl -f 22 --get-url https://www.youtube.com/watch?v=2QPbriKs_sI) > -t 1794 -c:v copy -c:a copy output.mp4 but without the -f 22 so, ffmpeg -ss 0 -i $(youtube-dl --get-url https://www.youtube.com/watch?v=2QPbriKs_sI) > -t 1794 -c:v copy -c:a copy output.mp4, I get the following message in Terminal in red text with a black background.
[NULL @ 0x7fbca1802600] Unable to find a suitable output format for 'https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?signature=8F8A97319A40FA3E51A25E09F13BD38D3249DD6B.0159BD0D26CD4678858582AE1323D4B4122A5C01&requiressl=yes&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Crequiressl%2Csource%2Cexpire&ei=zweHWfb7NI3AowO_yIq4Bw&itag=251&id=o-AAlFlG-RRe0xpK9AJI-FxVEre2XwhXs_n2druqsjsUzM&ipbits=0&mm=31&mn=sn-8vq54voxpo-5hql&initcwndbps=1380000&clen=526461218&pcm2cms=yes&ip=<IP_ADDRESS>&ms=au&mt=1502021495&mv=m&dur=36000.000&gir=yes&keepalive=yes&expire=1502043184&lmt=1498650272424607&key=yt6&mime=audio%2Fwebm&pl=20&source=youtube&ratebypass=yes'
https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?signature=8F8A97319A40FA3E51A25E09F13BD38D3249DD6B.0159BD0D26CD4678858582AE1323D4B4122A5C01&requiressl=yes&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Crequiressl%2Csource%2Cexpire&ei=zweHWfb7NI3AowO_yIq4Bw&itag=251&id=o-AAlFlG-RRe0xpK9AJI-FxVEre2XwhXs_n2druqsjsUzM&ipbits=0&mm=31&mn=sn-8vq54voxpo-5hql&initcwndbps=1380000&clen=526461218&pcm2cms=yes&ip=<IP_ADDRESS>&ms=au&mt=1502021495&mv=m&dur=36000.000&gir=yes&keepalive=yes&expire=1502043184&lmt=1498650272424607&key=yt6&mime=audio%2Fwebm&pl=20&source=youtube&ratebypass=yes: Invalid argument

The --get-url option just prints a direct link to the video instead of downloading it.
The complication is that YouTube serves its highest quality content through separate video and audio sources, so youtube-dl's --get-url provides you with two links, one is video and the other is audio. In my previous comment I recommended people use -f 22, which is the best quality source (720p) that has both video and audio, but sometimes that's not available, or you would prefer the best quality version. For that use:
youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]' --get-url (youtube link)
To get the urls of the best video and audio sources. Then combine them with ffmpeg:
ffmpeg -ss (start time) -i (top link) -i (bottom link) -t (duration you need) -c:v copy -c:a copy (title.mp4)
@rEes9P to answer your questions in order:

The output of your --get-url command is a bit screwy because your forgot to put the link in quotes, so the & in the link is being interpreted by bash causing the command to run in the background and leading to a bunch of job control related output - the [1], [2], [3] and "+ Done" part. Also, remove the playlist part of the link else youtube-dl will print links to the entire playlist. So the revised command:

youtube-dl --get-url "https://www.youtube.com/watch?v=2QPbriKs_sI"
That should lead to a more parseable output, but you'll still have two links, which you can combine with ffmpeg as mentioned above.

You can provide timestamps in the format hh:mm:ss or just as an integer in seconds. so 20 seconds would be 00:00:22 or just 22 and 2 minutes would be 00:02:00 or 120.

This will not download the entire video, only the range you request.

@JaySandhu - This is brilliant! Thank you so, so much for the clear and concise instructions.

@JaySandhu  can you pr your method so that it becomes a proper implementation

?
How should this be implemented? It depends on the shell, platform, etc..

may be by adding flags and parameter in ffmpeg.py,utils.py and in extractor.py    the closest i can find i changing the url to   [url]&start=[start_time]&end=[end_time]&version=3  .  example  https://www.youtube.com/watch?v=2QPbriKs_sI&start=0&end=1947&version=3.
Now in python
`import urllib.parse
import urllib.request
url = 'https://www.youtube.com/watch?v=2QPbriKs_sI'
user_agent = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64)'
values = {'start': 0,
'end': 1970',
'version': 3 }
headers = {'User-Agent': user_agent}
data = urllib.parse.urlencode(values)
data = data.encode('ascii')  # can be utf-8 too
req = urllib.request.Request(url, data, headers)
with urllib.request.urlopen(req) as response:
the_page = response.read()
print(the_page)   `

For those who want to work on this, please check #8851 first. Discussions here only applies to plain file-based streams. That is, a single file contains the whole video and/or audio stream. Fragmented streams (HLS/DASH/HDS/ISM) should be handled differently. We can implement this for file-based streams first, in which the implementation should check whether a given video URL is file-based or not.
There are two possible approaches for file-based streams, ffmpeg-based post convertor or website-dependent URL transformer (ex: &start=xxx for YouTube). The former should be included in the proposed implementation for generality, and the latter can be added as an extra feature.

@JaySandhu, thanks for coming back to this after a couple years have since gone by. Does the -t flag have to be in seconds, or can it be in hh:mm:ss as well?

Both use the same syntax, across all of ffmpeg.
https://www.ffmpeg.org/ffmpeg-utils.html#Time-duration

Thank you @Hrxn.

@JaySandhu - The --get-url part works perfectly after I took out the playlist bit of the url and put the quotes in where appropriate. However, I'm having some trouble with the ffmpeg -ss (start time) -i (top link) -i (bottom link) -t (duration you need) -c:v copy -c:a copy (title.mp4) bit. Could you please have a look and let me know where I'm going wrong?
Here's the command I used
ffmpeg -ss 00 -i “https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?id=d903dbae22acfec2&itag=137&source=youtube&requiressl=yes&ei=KhyIWb3MLNT4oAPI2o6oDA&mm=31&initcwndbps=1307500&mv=m&ms=au&mn=sn-8vq54voxpo-5hql&pl=20&ratebypass=yes&mime=video/mp4&gir=yes&clen=16938851529&lmt=1498521946448697&dur=36000.000&mt=1502092202&key=dg_yt0&signature=8BDD2573344F5E26CBD46F7EADFDA55BC161A5E5.42FAA9C3F66466197BC24C027F75248F65222A6E&ip=<IP_ADDRESS>&ipbits=0&expire=1502113930&sparams=ip,ipbits,expire,id,itag,source,requiressl,ei,mm,initcwndbps,mv,ms,mn,pl,ratebypass,mime,gir,clen,lmt,dur” -i “https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Crequiressl%2Csource%2Cexpire&lmt=1498650272424607&ipbits=0&requiressl=yes&source=youtube&initcwndbps=1307500&keepalive=yes&ei=KRyIWe-ND8OAowPhz6fYCA&clen=526461218&dur=36000.000&key=yt6&mime=audio%2Fwebm&ip=<IP_ADDRESS>&mm=31&mn=sn-8vq54voxpo-5hql&expire=1502113929&itag=251&pl=20&gir=yes&signature=58051D10D2468DE05B4636609C9C2C03E40B50BC.4A76CA4B114D52A55588AB3B35521BB8D0EFA14A&id=o-AI3-NsFb5zK3MD-gr4Fcbkh66Vqw4E_ezwWT8vLMIRC7&mt=1502092202&mv=m&pcm2cms=yes&ms=au&ratebypass=yes” -t 00:01:04 -c:v copy -c:a copy test.mp4
And here's what happened

users-MacBook-Pro:~ user$ ffmpeg -ss 00 -i “https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?id=d903dbae22acfec2&itag=137&source=youtube&requiressl=yes&ei=KhyIWb3MLNT4oAPI2o6oDA&mm=31&initcwndbps=1307500&mv=m&ms=au&mn=sn-8vq54voxpo-5hql&pl=20&ratebypass=yes&mime=video/mp4&gir=yes&clen=16938851529&lmt=1498521946448697&dur=36000.000&mt=1502092202&key=dg_yt0&signature=8BDD2573344F5E26CBD46F7EADFDA55BC161A5E5.42FAA9C3F66466197BC24C027F75248F65222A6E&ip=<IP_ADDRESS>&ipbits=0&expire=1502113930&sparams=ip,ipbits,expire,id,itag,source,requiressl,ei,mm,initcwndbps,mv,ms,mn,pl,ratebypass,mime,gir,clen,lmt,dur” -i “https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Crequiressl%2Csource%2Cexpire&lmt=1498650272424607&ipbits=0&requiressl=yes&source=youtube&initcwndbps=1307500&keepalive=yes&ei=KRyIWe-ND8OAowPhz6fYCA&clen=526461218&dur=36000.000&key=yt6&mime=audio%2Fwebm&ip=<IP_ADDRESS>&mm=31&mn=sn-8vq54voxpo-5hql&expire=1502113929&itag=251&pl=20&gir=yes&signature=58051D10D2468DE05B4636609C9C2C03E40B50BC.4A76CA4B114D52A55588AB3B35521BB8D0EFA14A&id=o-AI3-NsFb5zK3MD-gr4Fcbkh66Vqw4E_ezwWT8vLMIRC7&mt=1502092202&mv=m&pcm2cms=yes&ms=au&ratebypass=yes” -t 00:01:04 -c:v copy -c:a copy test.mp4
[1] 1797
[2] 1798
[3] 1799
[4] 1800
[5] 1801
[6] 1802
[7] 1803
[8] 1804
[9] 1805
[10] 1806
[11] 1807
[12] 1808
[13] 1809
[14] 1810
[15] 1811
[16] 1812
[17] 1813
[18] 1814
[19] 1815
[20] 1816
[21] 1817
[22] 1818
[23] 1819
[24] 1820
[25] 1821
[26] 1822
-bash: -i: command not found
[27] 1823
[28] 1824
[29] 1825
[30] 1826
[31] 1827
[32] 1828
[33] 1829
[34] 1830
[35] 1831
[36] 1832
[37] 1833
[38] 1834
[39] 1835
[40] 1836
[41] 1837
[42] 1838
[43] 1839
[44] 1840
[45] 1841
[46] 1842
[47] 1843
[48] 1844
-bash: -t: command not found
[2]   Done                    itag=137
[3]   Done                    source=youtube
[4]   Done                    requiressl=yes
[5]   Done                    ei=KhyIWb3MLNT4oAPI2o6oDA
[6]   Done                    mm=31
[7]   Done                    initcwndbps=1307500
[8]   Done                    mv=m
[9]   Done                    ms=au
[10]   Done                    mn=sn-8vq54voxpo-5hql
[11]   Done                    pl=20
[12]   Done                    ratebypass=yes
[13]   Done                    mime=video/mp4
[14]   Done                    gir=yes
[15]   Done                    clen=16938851529
[16]   Done                    lmt=1498521946448697
[17]   Done                    dur=36000.000
[18]   Done                    mt=1502092202
[19]   Done                    key=dg_yt0
[20]   Done                    signature=8BDD2573344F5E26CBD46F7EADFDA55BC161A5E5.42FAA9C3F66466197BC24C027F75248F65222A6E
[21]   Done                    ip=<IP_ADDRESS>
[22]   Done                    ipbits=0
[23]   Done                    expire=1502113930
[24]   Exit 127                sparams=ip,ipbits,expire,id,itag,source,requiressl,ei,mm,initcwndbps,mv,ms,mn,pl,ratebypass,mime,gir,clen,lmt,dur” -i “https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Crequiressl%2Csource%2Cexpire
[25]   Done                    lmt=1498650272424607
[26]   Done                    ipbits=0
[27]   Done                    requiressl=yes
[28]   Done                    source=youtube
[29]   Done                    initcwndbps=1307500
[30]   Done                    keepalive=yes
[31]   Done                    ei=KRyIWe-ND8OAowPhz6fYCA
[32]   Done                    clen=526461218
[33]   Done                    dur=36000.000
[34]   Done                    key=yt6
[35]   Done                    mime=audio%2Fwebm
[36]   Done                    ip=<IP_ADDRESS>
[37]   Done                    mm=31
[38]   Done                    mn=sn-8vq54voxpo-5hql
[39]   Done                    expire=1502113929
[40]   Done                    itag=251
[41]   Done                    pl=20
[42]   Done                    gir=yes
[43]   Done                    signature=58051D10D2468DE05B4636609C9C2C03E40B50BC.4A76CA4B114D52A55588AB3B35521BB8D0EFA14A
[44]   Done                    id=o-AI3-NsFb5zK3MD-gr4Fcbkh66Vqw4E_ezwWT8vLMIRC7
[45]   Done                    mt=1502092202
[46]   Done                    mv=m
[47]-  Done                    pcm2cms=yes
[48]+  Done                    ms=au
users-MacBook-Pro:~ user$ ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers
built with Apple LLVM version 8.1.0 (clang-802.0.42)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags=-I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/ --host-ldflags= --enable-chromaprint --enable-ffplay --enable-frei0r --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopus --enable-librtmp --enable-librubberband --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtesseract --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg --enable-libzmq --enable-opencl --enable-openssl --enable-lzma --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.1.2_1/include/openjpeg-2.1 --enable-nonfree --enable-vda
libavutil      55. 58.100 / 55. 58.100
libavcodec     57. 89.100 / 57. 89.100
libavformat    57. 71.100 / 57. 71.100
libavdevice    57.  6.100 / 57.  6.100
libavfilter     6. 82.100 /  6. 82.100
libavresample   3.  5.  0 /  3.  5.  0
libswscale      4.  6.100 /  4.  6.100
libswresample   2.  7.100 /  2.  7.100
libpostproc    54.  5.100 / 54.  5.100

I am particularly perplexed by the -bash: -i: command not found and -bash: -t: command not found bits. Many, many thanks for all your help!

@rEes9P, you are using curly quotes. You must use straight quotes. Type the quotation mark into the terminal by hand, don't copy/paste it.

@johnhawkinson - Ah, thanks for that. You can tell that I am new to this!
I replaced the curly quotes so:
ffmpeg -ss 00 -i "https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?id=d903dbae22acfec2&itag=137&source=youtube&requiressl=yes&ei=KhyIWb3MLNT4oAPI2o6oDA&mm=31&initcwndbps=1307500&mv=m&ms=au&mn=sn-8vq54voxpo-5hql&pl=20&ratebypass=yes&mime=video/mp4&gir=yes&clen=16938851529&lmt=1498521946448697&dur=36000.000&mt=1502092202&key=dg_yt0&signature=8BDD2573344F5E26CBD46F7EADFDA55BC161A5E5.42FAA9C3F66466197BC24C027F75248F65222A6E&ip=<IP_ADDRESS>&ipbits=0&expire=1502113930&sparams=ip,ipbits,expire,id,itag,source,requiressl,ei,mm,initcwndbps,mv,ms,mn,pl,ratebypass,mime,gir,clen,lmt,dur" -i "https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Crequiressl%2Csource%2Cexpire&lmt=1498650272424607&ipbits=0&requiressl=yes&source=youtube&initcwndbps=1307500&keepalive=yes&ei=KRyIWe-ND8OAowPhz6fYCA&clen=526461218&dur=36000.000&key=yt6&mime=audio%2Fwebm&ip=<IP_ADDRESS>&mm=31&mn=sn-8vq54voxpo-5hql&expire=1502113929&itag=251&pl=20&gir=yes&signature=58051D10D2468DE05B4636609C9C2C03E40B50BC.4A76CA4B114D52A55588AB3B35521BB8D0EFA14A&id=o-AI3-NsFb5zK3MD-gr4Fcbkh66Vqw4E_ezwWT8vLMIRC7&mt=1502092202&mv=m&pcm2cms=yes&ms=au&ratebypass=yes" -t 00:01:04 -c:v copy -c:a copy test.mp4
However, I am now getting this (error in bold at the end):

fmpeg -ss 00 -i "https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?id=d903dbae22acfec2&itag=137&source=youtube&requiressl=yes&ei=KhyIWb3MLNT4oAPI2o6oDA&mm=31&initcwndbps=1307500&mv=m&ms=au&mn=sn-8vq54voxpo-5hql&pl=20&ratebypass=yes&mime=video/mp4&gir=yes&clen=16938851529&lmt=1498521946448697&dur=36000.000&mt=1502092202&key=dg_yt0&signature=8BDD2573344F5E26CBD46F7EADFDA55BC161A5E5.42FAA9C3F66466197BC24C027F75248F65222A6E&ip=<IP_ADDRESS>&ipbits=0&expire=1502113930&sparams=ip,ipbits,expire,id,itag,source,requiressl,ei,mm,initcwndbps,mv,ms,mn,pl,ratebypass,mime,gir,clen,lmt,dur" -i "https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Crequiressl%2Csource%2Cexpire&lmt=1498650272424607&ipbits=0&requiressl=yes&source=youtube&initcwndbps=1307500&keepalive=yes&ei=KRyIWe-ND8OAowPhz6fYCA&clen=526461218&dur=36000.000&key=yt6&mime=audio%2Fwebm&ip=<IP_ADDRESS>&mm=31&mn=sn-8vq54voxpo-5hql&expire=1502113929&itag=251&pl=20&gir=yes&signature=58051D10D2468DE05B4636609C9C2C03E40B50BC.4A76CA4B114D52A55588AB3B35521BB8D0EFA14A&id=o-AI3-NsFb5zK3MD-gr4Fcbkh66Vqw4E_ezwWT8vLMIRC7&mt=1502092202&mv=m&pcm2cms=yes&ms=au&ratebypass=yes" -t 00:01:04 -c:v copy -c:a copy test.mp4
ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers
built with Apple LLVM version 8.0.0 (clang-8<IP_ADDRESS>)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags=-I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/ --host-ldflags= --enable-chromaprint --enable-ffplay --enable-frei0r --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopus --enable-librtmp --enable-librubberband --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtesseract --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg --enable-libzmq --enable-opencl --enable-openssl --enable-lzma --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.1.2_1/include/openjpeg-2.1 --enable-nonfree --enable-vda
libavutil      55. 58.100 / 55. 58.100
libavcodec     57. 89.100 / 57. 89.100
libavformat    57. 71.100 / 57. 71.100
libavdevice    57.  6.100 / 57.  6.100
libavfilter     6. 82.100 /  6. 82.100
libavresample   3.  5.  0 /  3.  5.  0
libswscale      4.  6.100 /  4.  6.100
libswresample   2.  7.100 /  2.  7.100
libpostproc    54.  5.100 / 54.  5.100
[https @ 0x7fa399593540] HTTP error 403 Forbidden
https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?id=d903dbae22acfec2&itag=137&source=youtube&requiressl=yes&ei=KhyIWb3MLNT4oAPI2o6oDA&mm=31&initcwndbps=1307500&mv=m&ms=au&mn=sn-8vq54voxpo-5hql&pl=20&ratebypass=yes&mime=video/mp4&gir=yes&clen=16938851529&lmt=1498521946448697&dur=36000.000&mt=1502092202&key=dg_yt0&signature=8BDD2573344F5E26CBD46F7EADFDA55BC161A5E5.42FAA9C3F66466197BC24C027F75248F65222A6E&ip=<IP_ADDRESS>&ipbits=0&expire=1502113930&sparams=ip,ipbits,expire,id,itag,source,requiressl,ei,mm,initcwndbps,mv,ms,mn,pl,ratebypass,mime,gir,clen,lmt,dur: Server returned 403 Forbidden (access denied)

Thanks, as always, for all the help.

@rEes9P that seems odd -- did you regenerate the URL by (re)running youtube-dl ... --get-url recently? The URLs it returns are ephemeral -- they last for a few minutes, but not for hours or days.
If regenerating the URL doesn't work, then please include the output of youtube-dl -v along with the rest of your youtube-dl command line (that is, add -v). Or maybe even remove --get-url and include the output -- because if youtube-dl is able to retrieve the URL, ffmpeg should be able to. And if youtube-dl cannot, well, you have a different problem.

@rEes9P  it somehow seems to be related to https://github.com/rg3/youtube-dl#video-url-contains-an-ampersand-and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command .
To verify just run youtube-dl -g https://www.youtube.com/watch?v=2QPbriKs_sI -f 22, chances are the cookies and your ip is getting changed.
can you also build your ffmpeg in gcc,just to verify clang is not skipping anything (not likely)
Note : there are 4 programs being used here :-1:

your shell
youtube-dl
ffmpeg
clang

So you should make sure all the 4 are updated.
Other problem to consider :-

the video happens to be quite big (approx 15 GB ), so chances are the huge video size is creating errors

make sure your ip is same throughout the process. Your ISP may be dynamically be changing you ip or you may be you are using multiple network. If this is the case youtube will block your link as your ip and cookies are differnet.

ffmpeg might not to able to fully understand the url. (likely the issue) .  So instead of ffmpeg use wget or any other downloaders to make sure the url returned by youtube-dl is being understood by external programs.

Some ISP restrict the bandwidth to site like youtube as it uses very high data compared to other sites. They sometimes even allocate you to a slower network in case of network congestion or frequent bandwidth abuse (high internet traffic specially from your side) . Considering 1,2 and 4 make sure youtube is running file .https://github.com/rg3/youtube-dl#http-error-429-too-many-requests-or-402-payment-required

Unfortunately, @siddht4, that is not good advice.

@rEes9P it somehow seems to be related to https://github.com/rg3/youtube-dl#video-url-contains-an-ampersand-and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command .

No it is not. That was the problem in https://github.com/rg3/youtube-dl/issues/622#issuecomment-320600762 but he fixed the curly quotes and that is resolved.

To verify just run youtube-dl -g https://www.youtube.com/watch?v=2QPbriKs_sI -f 22, chances are the cookies and your ip is getting changed.

I'm not sure what you hope to gain form this, but technically it is an error not to quote the URL here. The ? is a shell metacharacter, and if you happen to have a file named https://www.youtube.com/watchXv=2QPbriKs_sI or https://www.youtube.com/watchYv=2QPbriKs_sI in the current directory, bad things will happen.

can you also build your ffmpeg in gcc,just to verify clang is not skipping anything (not likely)

This is so unlikely as to be not worth recommending. Especially for the inexpert, asking them to recompile from source with a different compiler is huge task and it's not warranted here. There is no evidence of a compiler problem, and such things are extremely rare in cases like this.

Note : there are 4 programs being used here : your shell,  youtube-dl, ffmpeg, clang
So you should make sure all the 4 are updated.

No. First of all, your shell and compiler (clang) do not need to be updated. Yes, ffmpeg and youtube-dl do change rapidly, so it is wise to keep them reasonably current. Although updates can introduce problems as well. Nothing's perfect.

ffmpeg might not to able to fully understand the url. (likely the issue) . So instead of ffmpeg use wget or any other downloaders to make sure the url returned by youtube-dl is being understood by external programs.

No, this is not likely the issue. But sure, if you've rerun youtube-dl -g and gotten a new URL and it still doesn't work with ffmpeg, try it with wget (but don't wait for it to download the whole thing). This is essentially the same as my earlier suggestion of letting youtube-dl do the download.

I'm sorry for being harsh, but you have given some problematic advice earlier in this thread. Specifically:

Basically you need to provide time in seconds so 20 seconds is 20 and 2 minutes is 120

False. ffmpeg accepts time in hours:minutes:seconds as well as raw seconds, as  @JaySandhu noted. See  https://ffmpeg.org/ffmpeg-utils.html#time-duration-syntax.

You can try https://www.youtube.com/watch?v=2QPbriKs_sI&t=1794
where https://www.youtube.com/watch?v=2QPbriKs_sI is the video andt=1794 is the time from where to begin (29 min 54 sec)
for some reason
https://www.youtube.com/watch?v=2QPbriKs_sI?start=0&end=1794&version=3
doesnt end at 29 mins 54 sec ,
but changing start time did changed it start time

I believe this to be wrong. Youtube-dl does not handle starting or ending offsets in Youtube URLs.

Your doesnt work as youtube-dl is not able to get any paramter,so changing it to ffmpeg -ss 0 -i $(youtube-dl -g https://www.youtube.com/watch?v=2QPbriKs_sI -f bestvideo) > -t 1794 -c:v copy -c:a copy output.mp4 would work

I'm not sure what this is intended to do, but the > -t  would redirect stdout to a file named -t which is certainly not what you want. And then ffmpeg would get confused by the standalone 1794, likely interpreting it as an output file. That's just in error.

This is simply https://www.youtube.com/watch?v=2QPbriKs_sI&start=0&end=1947&version=3 which can be seen in youtube

I'm not sure what you're going for but I think this is a false equivalence.

@johnhawkinson Thank you! That was it. I ran youtube-dl ... --get-url again and voila! I've learnt a lot because of the generosity and help of the folks here :-)

@rEes9P that seems odd -- did you regenerate the URL by (re)running youtube-dl ... --get-url recently? The URLs it returns are ephemeral -- they last for a few minutes, but not for hours or days.
If regenerating the URL doesn't work, then please include the output of youtube-dl -v along with the rest of your youtube-dl command line (that is, add -v). Or maybe even remove --get-url and include the output -- because if youtube-dl is able to retrieve the URL, ffmpeg should be able to. And if youtube-dl cannot, well, you have a different problem.

@johnhawkinson - Thank you! That was it. I ran youtube-dl ... --get-url again and voila! I've learnt a lot because of the generosity and help of the folks here :-)

@johnhawkinson   thanks for giving me pointers.
Well  I was under impression @rEes9P  had finally understood how to get the youtube-dl output to ffmpeg. Thanks to @JaySandhu  and you to clarify everything to @rEes9P.
But due to @rEes9P having trouble everytime to get everything working as this is not yet fully implemented in youtube-dl. So had to check wheter  all the programs i.e  ffmpeg,youtube-dl and everything else related is working fine.

Unfortunately, @siddht4, that is not good advice.

True to some extent but had to make sure all the programs are working fine.

I'm not sure what you hope to gain from this, but technically it is an error not to quote the URL here. The ? is a shell metacharacter, and if you happen to have a file named https://www.youtube.com/watchXv=2QPbriKs_sI or https://www.youtube.com/watchYv=2QPbriKs_sI in the current directory, bad things will happen

I am still trying to make him/her understand that the url returned might not work in case of IP change. I have already tried the url and found out it to be 17 GB. Also @rEes9P wanted multiple format as commented earlier and as youtube-dl  not the primary program here so gave him/here a sort of direct approach.
I am in no way telling @rEes9P to mirror the site. I am also telling @rEes9P that simply piping the output of 'youtube-dl -g https://www.youtube.com/watch?v=2QPbriKs_sI -f 22' to the following ffmpeg parameter will work as its the same thing.

False. ffmpeg accepts time in hours:minutes:seconds as well as raw seconds, as @JaySandhu noted. See https://ffmpeg.org/ffmpeg-utils.html#time-duration-syntax.

This can atleast be treated as incomplete rather being marked as false as I gave him in raw seconds.

I believe this to be wrong. Youtube-dl does not handle starting or ending offsets in Youtube URLs.

Well in that case try that too, and  check here https://stackoverflow.com/questions/4661905/how-to-customize-an-end-time-for-a-youtube-video

I'm not sure what you're going for but I think this is a false equivalence

This is an simple implementation of start and end quotes. It happens that instead of getting the url to download,it will try to download all the parts/fragments and then would binary append all the files.( i am already trying it as a hook to chrome)

Thank you! That was it. I ran youtube-dl ... --get-url again and voila! I've learnt a lot because of the generosity and help of the folks here :-)

Looks like your basic problem is solved. Would like to hear if you obtain something new missed by any of us. And also  --get-url can be substituted with '-g ' , you could chose anyone you liked.

Here is a step-by-step guide for those that are new to youtube-dl and/or ffmpeg for downloading a portion of a video. Many thanks to @JaySandhu and @johnhawkinson for all their work. These steps simply collate all the helpful tips they have shared at different places in this thread.
It would be easier to understand these steps with an example and so I am going to use this footage of relaxing sights and sounds of islands from the excellent Planet Earth II. The video loops 30 minutes of footage for 10 hours and so is a good candidate for this task. For this example, we will be extracting the first 29 minutes and 54 seconds of the video.
1. Get the URL of the video using the --get-url command
For a specific format
youtube-dl -f (desired format) --get-url (youtube link)
For the default, highest quality format (the video and audio streams may be different)
youtube-dl --get-url (youtube link)
Example
For a specific format (-f 22, which is the best version with combined video and audio)
youtube-dl -f 22 --get-url "https://www.youtube.com/watch?v=2QPbriKs_sI"
For the default, highest quality format (in this case the video and audio are separate). This will result in two separate URLs, but they can easily be combined using ffmpeg as seen below.
youtube-dl --get-url "https://www.youtube.com/watch?v=2QPbriKs_sI"
Note that another link (https://www.youtube.com/watch?v=2QPbriKs_sI&list=PLtra-MWzIvZGdqzuA59Jp0dZVzpmNZyT0&index=2) also points to the same video but it is the version that is a part of a playlist (as seen by the string beginning with "&list=..."). We want the version that points to the standalone video and omits the playlist information.
2. Use ffmpeg to get the desired range
If the source has both video and audio
ffmpeg -ss (start time) -i "link" -t (duration you need) -c:v copy -c:a copy (title.ext)
If the source that has separate video and audio streams ffmpeg will combine the two
ffmpeg -ss (start time) -i "top link" -i "bottom link" -t (duration you need) -c:v copy -c:a copy (title.ext)
Example
For the -f 22 version
ffmpeg -ss 00 -i "https://url" -t 00:29:54 -c:v copy -c:a copy Islands.mkv
For the highest quality version (different video and audio streams)
ffmpeg -ss 00 -i "https://topurl" -i "https://bottomurl" -t 00:29:54 -c:v copy -c:a copy Islands.mkv
Notes

Put links inside straight quotes (not curly quotes) else characters such as & in the link can be interpreted by bash, causing the command to run in the background and leading to a bunch of job control related output.
Ensure that the playlist part of the link is removed before running the --get-url command or else youtube-dl will print links to the entire playlist.
The URLs returned by the --get-url command are ephemeral; they last for a few minutes, but not for hours or days.
The timestamps (start time/duration) can in the format hh:mm:ss or just as an integer in seconds. So, 22 seconds would be 00:00:22 or just 22 and 2 minutes would be 00:02:00 or 120.

Several notes:
What @rEes9P is trying to do is handle a particularly annoying case where you need better than 720p quality. That introduces all kinds of extra difficulties, and in most application is not worth it. Using -f 22 gets you 720p quality and that's adequate for almost all cases, and makes this so much simpler.
That is, I would recommend, in modified form from https://github.com/rg3/youtube-dl/issues/622#issuecomment-162337869:
ffmpeg -ss 14350 -i $(youtube-dl -f 22 -g 'https://www.youtube.com/watch?v=mMZriSvaVP8') -t 11200 -c copy react-spot.mp4
or (more readable times):
ffmpeg -ss 3:59:10 -i $(youtube-dl -f 22 -g 'https://www.youtube.com/watch?v=mMZriSvaVP8') -t 3:06:40 -c copy react-spot.mp4

Specific notes:

The video loops 30 minutes of footage for 10 hours and so is a good candidate for this task.

This is actually a terrible candidate for this, because you will not detect a failure of the audio and video to sync up. This is a very serious problem, because indeed the steps you have recommended will give unsynchronized audio, because ffmpeg's input seek parameter applies only to the input source it immediately proceeds. Also, because you chose a start time of zero for your example, you mask this problem as well.

Use ffmpeg to get the desired range
If the source has both video and audio
ffmpeg -ss (start time) -i "link" -t (duration you need) -c:v copy -c:a copy (title.ext)

This is okay, but ffmpeg provides -c copy which is shorthand for -c:v copy -c:a copy. I'd use it.

If the source that has separate video and audio streams ffmpeg will combine the two
ffmpeg -ss (start time) -i "top link" -i "bottom link" -t (duration you need) -c:v copy -c:a copy (title.ext)

Nope. You need to repeat the start time for each input source, so it would need to be:
ffmpeg -ss (start time) -i "top link" -ss (start time) -i "bottom link" -t (duration you need) -c:v copy -c:a copy (title.ext)
Also, you can wrap this thing all together in one command-line if you see fit. For instance:
ffmpeg  $(youtube-dl -g 'LINK' | sed "s/.*/-ss STARTTIME -i &/") -t DURATION -c copy FILENAME.mkv
Where the sed command prepends -ss STARTTIME -i  to each line of output from youtube-dl -g.
For example, I ran:
ffmpeg  $(youtube-dl -g 'https://www.youtube.com/watch?v=NnW5EjwtE2U' | sed "s/.*/-ss 10 -i &/") -t 60 -c copy test3.mkv
To get from 00:10 to 01:10 of this week's Last Week Tonight segment.

Thank you again @johnhawkinson. Sorry about my earlier post. I meant to be of help to others but I guess I got ahead of myself.

Thanks @johnhawkinson. The sed line you shared, I've found, is essential for use with video editing. Otherwise you have to do additional processing. If you don't, there are syncing issues.

how it work with vimeo.com

@johnhawkinson quick question: what is correct syntax for windows environment?
ffmpeg -ss 3:59:10 -i $(youtube-dl -f 22 -g 'https://www.youtube.com/watch?v=mMZriSvaVP8') -t 3:06:40 -c copy react-spot.mp4
returns
$(youtube-dl: No such file or directory
I think it has something to do with "$" and Linux, but I don't have much experience with that

I don't think Windows CMD.EXE has a direct analog of $() syntax. Use one of the available bash implementations for Windows, or do it by hand:
Run youtube-dl -f 22 -g 'https://www.youtube.com/watch?v=mMZriSvaVP8' and copy the output, which will be the URL (because of -g) of the format 22 version.
Then paste it into the ffmpeg command line in place of the $(...) sequence.

@miklide
Windows syntax
for /F "tokens=* delims=" %a in ('youtube-dl --get-url https://oload.stream/embed/Rp8UClDzOKk') do (ffmpeg -ss 00:26:33.091 -i %a -t 9.983 eam.mp4)

Much uglier, naturally :stuck_out_tongue_closed_eyes:
Use %a when typing in the command prompt and %%a in batch files
:warning:  FFMPEG -to parameter is not supported here! If you use it ffmpeg will download sequentially until start time then process your fragment to end time and output your file. If your video is 2 hours long and you want to extract something from near the end you will download GBs of data only to throw it away. -t does work however, so subtract the start time from the end time to get the duration you need. More information: Seeking – FFmpeg

To get a range you need to send it as a param to the end of the video direct url like this
&range=<start_offset>-<end_offset>
open the stream and get the data it will be unplayable because the meta data aren't use something to make them or get them

any progress on this ?

any progress on this?

Where are we stuck? How can I help?

Would this approach work for downloading an accurate range with minimal transcoding?

stream copy a chunk around start timestamp
ffprobe to find the nearest keyframe inside of start
do an encode from start to said keyframe
do a stream copy from keyframe to end keyframe
do the same encode from end keyframe to end timestamp
concat the 3 files into one accurate video fragment with minimal transcoding
...
PROFIT

@akaleeroy asks:

Would this approach work for downloading an accurate range with minimal transcoding?

First of all, I don't think that is a youtube-dl problem. It sounds like you want an option for ffmpeg to do minimal transcoding. I suggest you implement that as an option to ffmpeg, or maybe a wrapper script around it (that youtube-dl could use). But that's really not what people are asking for in this Issue, so I would suggest a different one, rather than adding distraction here.
I'm frankly tempted to suggest someone should go through and summarize this issue into a new Issue and close this one out, because it has too much stuff in it and is just too hard to read.

1. stream copy a chunk around start timestamp
3. do an encode from start to said keyframe
6. concat the 3 files into one accurate video fragment with minimal transcoding

This only works if you can guarantee the encoding-in-3 is a compatible with the encoding-in-1  such that it can be acceptable concat-ed. I don't believe this is a simple or straightforward thing to do with reliability, although the common case is likely easy. But this again sounds like an ffmpeg issue not a youtube-dl issue.

Apologies for being off-topic with this but I realised many people seeking a solution to this issue land here.

I don't believe this is a simple or straightforward thing to do with reliability (...)

I found one case when it worked and one when it didn't so you're probably right – not reliable.

any update?

I'm ~frankly tempted to~ suggest someone should go through and summarize this issue into a new Issue and close this one out, because it has too much stuff in it and is just too hard to read.

I'm frankly tempted to suggest someone should go through and summarize this issue into a new Issue and close this one out, because it has too much stuff in it and is just too hard to read.

Just a question. Does ffmpeg -ss (start time) -i "link" -t (duration you need) -c:v copy -c:a copy work for you? putting the link --get-url and -g gives me gives me a 403 no access error in chrome and in ffmpeg.

Some sites with complicated semi-security or nominal DRM require extensive headers to accompany the request---more than just the URL. Essentially those sites don't work with youtube-dl -g. You can try something like youtube-dl -g --external-downloader-args '-ss 31:00' or whatever, but it's not possible to express all permutations and not always reliable.
But, @Zachary24 , we would need to know the site and likely the url to troubleshoot your problem any further.

any progress on this?

@Sandural This https://github.com/ytdl-org/youtube-dl/issues/622#issuecomment-86163574 worked for me quite well.

@JaySandhu
I did this to cut and download youtube videos using youtube_dl and ffmeg
os.system(             f"ffmpeg -ss {start_time} -i $(youtube-dl -f mp4 --get-url {url}) -t {duration} -c:v copy -c:a copy react-spot.mp4")
first i get the direct video link using youtube_dl (youtube-dl -f mp4 --get-url {url}) then cut and download it by ffmpeg(ffmpeg -ss {start_time} -i -t {duration} -c:v copy -c:a copy react-spot.mp4)
what I need is to separately get the direct video link  by youtube_dl wrapper functions
instead of calling it as a command using os.system

Hi,
Is there any way to implement a download range? To download starting from 1m 30 to 1m 50?
Thanks

For video:
youtube-dl -o "%(title)s.%(ext)s" -f "bestvideo+bestaudio" --ffmpeg-location "C:\ffmpeg\bin" "https://www.youtube.com/watch?v=hTb6ClME6Eg" --postprocessor-args "-ss 01:30 -t 00:20"
For audio:
youtube-dl -o "%(title)s.%(ext)s" -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 --ffmpeg-location "c:\ffmpeg\bin" "https://www.youtube.com/watch?v=hTb6ClME6Eg" --postprocessor-args "-ss 01:30 -t 00:20"
You can use my script:
https://gist.github.com/es3/5373c3aa119b160146c6179378274fe9

Note the solution proposed by @es3, while neater to write, downloads the whole file then throws away the rest, unlike this solution which only downloads the desired portion

One line version:
ffmpeg -ss 14350 -i $(youtube-dl -f 22 --get-url https://www.youtube.com/watch?v=mMZriSvaVP8) -t 11200 -c:v copy -c:a copy react-spot.mp4
This one line version give error:
Unrecognized option '-get-url'.
Error splitting the argument list: Option not found

Path for youtube-dl.exe is set up.

Did you copy/paste it exactly, @hasnogaems?
In particular, it is --get-url, not -get-url. There are two hyphens at the start.
Also, I would suggest you follow my instructions from https://github.com/ytdl-org/youtube-dl/issues/622#issuecomment-320962680 instead, although it shouldn't make much difference.
And I have no expectation that this will work right with Windows 7, but presumably it's clear that this command-line requires bash or similar, not the Windows command prompt ("cmd"). (But that would not explain this error.)

@johnhawkinson apparently default windows cmd not support $

I trying this now with default win cmd:
youtube-dl --postprocessor-args "-ss 1:35 -t 00:20" https://www.youtube.com/watch?v=IFe6ag34eMg
But output have wrong timing completely. Im trying to catch honey on 1:35.

As I said, use bash. You're also not answering the question I asked, so it's going to be hard to help you.

Yeah, something like  command1 $(sub-expression) flag1 is Bash-only, Windows CMD cannot do such a thing.
One of the many reasons why you should use PowerShell! Because it can do sub-expressions:
So try
ffmpeg -ss 3:59:10 -i $(youtube-dl -f 22 -g 'https://www.youtube.com/watch?v=mMZriSvaVP8') -t 3:06:40 -c copy react-spot.mp4

in PowerShell

I did it but is extremely slow for download
It is for audio but u can change the format in -f besvideo+bestaudio and %title%.mp4
@echo OFF
SETLOCAL
SetLocal EnableDelayedExpansion
set url=%1
set "cval=""
set cone=%url:~0,1%
if "%2"=="" (set start_time=) else (set start_time=-ss "%2")
if "%3"=="" (set duration=) else (set duration=-t "%3")
if not !cone!==!cval! goto MSG_INVALID_URL
for /F "delims=" %%i IN ('youtube-dl -f bestaudio -e %url%') DO set "title=%%i"
for /F "delims=" %%i IN ('youtube-dl -f bestaudio -g %url%') DO set "get_url=%%i"
%tools%\ffmpeg\bin\ffmpeg.exe -strict -2 %start_time% -i "%get_url%" %duration% "%title%.mp3"
goto END
:MSG_INVALID_URL
echo Invalid url, use double quote wrapped url
echo Example: "https://www.youtube.com/watch?v=xxxxxx"
goto END
:END

I did it for windows but is extremely slow for download
It is for audio but u can change the format in -f bestvideo+bestaudio and %title%.mp4
Download.bat
@echo OFF
SETLOCAL
SetLocal EnableDelayedExpansion
set url=%1
set "cval=""
set cone=%url:~0,1%
if "%2"=="" (set start_time=) else (set start_time=-ss "%2")
if "%3"=="" (set duration=) else (set duration=-t "%3")
if not !cone!==!cval! goto MSG_INVALID_URL
for /F "delims=" %%i IN ('youtube-dl -f bestaudio -e %url%') DO set "title=%%i"
for /F "delims=" %%i IN ('youtube-dl -f bestaudio -g %url%') DO set "get_url=%%i"
%tools%\ffmpeg\bin\ffmpeg.exe -strict -2 %start_time% -i "%get_url%" %duration% "%title%.mp3"
goto END
:MSG_INVALID_URL
echo Invalid url, use double quote wrapped url
echo Example: "https://www.youtube.com/watch?v=xxxxxx"
goto END
:END

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
Please tell me what I did wrong below...
@echo OFF
SETLOCAL
SetLocal EnableDelayedExpansion
set url=%1
set "cval=""
set cone=%url:~0,1%
if "%2"=="" (set start_time=1:08:15) else (set start_time=-ss "%2")
if "%3"=="" (set duration=0:02:25) else (set duration=-t "%3")
if not !cone!==!cval! goto MSG_INVALID_URL
for /F "delims=" %%i IN ('youtube-dl -f bestvideo+bestaudio -e https://www.youtube.com/watch?v=U8WRGFB_PWM') DO set "title=Sleep Aid"
for /F "delims=" %%i IN ('youtube-dl -f bestvideo+bestaudio -g https://www.youtube.com/watch?v=U8WRGFB_PWM') DO set "get_url=%%i"
%tools%\ffmpeg\bin\ffmpeg.exe -strict -2 1:08:15 -i "https://www.youtube.com/watch?v=U8WRGFB_PWM" 0:02:25 "Zelda.mp3"
goto END
:MSG_INVALID_URL
echo Invalid url, use double quote wrapped url
echo Example: "https://www.youtube.com/watch?v=xxxxxx"
goto END
:END
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). Appreciate any advice from you guys.

I did it for windows but is extremely slow for download
It is for audio but u can change the format in -f bestvideo+bestaudio and %title%.mp4
Download.bat
@echo OFF
SETLOCAL
SetLocal EnableDelayedExpansion
set url=%1
set "cval=""
set cone=%url:~0,1%
if "%2"=="" (set start_time=) else (set start_time=-ss "%2")
if "%3"=="" (set duration=) else (set duration=-t "%3")
if not !cone!==!cval! goto MSG_INVALID_URL
for /F "delims=" %%i IN ('youtube-dl -f bestaudio -e %url%') DO set "title=%%i"
for /F "delims=" %%i IN ('youtube-dl -f bestaudio -g %url%') DO set "get_url=%%i"
%tools%\ffmpeg\bin\ffmpeg.exe -strict -2 %start_time% -i "%get_url%" %duration% "%title%.mp3"
goto END
:MSG_INVALID_URL
echo Invalid url, use double quote wrapped url
echo Example: "https://www.youtube.com/watch?v=xxxxxx"
goto END
:END

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
Please tell me what I did wrong below...
@echo OFF
SETLOCAL
SetLocal EnableDelayedExpansion
set url=%1
set "cval=""
set cone=%url:~0,1%
if "%2"=="" (set start_time=1:08:15) else (set start_time=-ss "%2")
if "%3"=="" (set duration=0:02:25) else (set duration=-t "%3")
if not !cone!==!cval! goto MSG_INVALID_URL
for /F "delims=" %%i IN ('youtube-dl -f bestvideo+bestaudio -e https://www.youtube.com/watch?v=U8WRGFB_PWM') DO set "title=Sleep Aid"
for /F "delims=" %%i IN ('youtube-dl -f bestvideo+bestaudio -g https://www.youtube.com/watch?v=U8WRGFB_PWM') DO set "get_url=%%i"
%tools%\ffmpeg\bin\ffmpeg.exe -strict -2 1:08:15 -i "https://www.youtube.com/watch?v=U8WRGFB_PWM" 0:02:25 "Zelda.mp3"
goto END
:MSG_INVALID_URL
echo Invalid url, use double quote wrapped url
echo Example: "https://www.youtube.com/watch?v=xxxxxx"
goto END
:END
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/
extrat it in a new forlder and copy the path
example c:\ffmpeg
Replace from the original script "Download.bat"
replace %tools%\bin\ffmpeg.exe for ur path that contain c:\ffmpeg\bin\ffmpeg.exe
Now open a command line "cmd.exe"
In the folder where u saved download.bat
execute:
download.bat "https://www.youtube.com/watch?v=U8WRGFB_PWM"

I did it for windows but is extremely slow for download
It is for audio but u can change the format in -f bestvideo+bestaudio and %title%.mp4
Download.bat
@echo OFF
SETLOCAL
SetLocal EnableDelayedExpansion
set url=%1
set "cval=""
set cone=%url:~0,1%
if "%2"=="" (set start_time=) else (set start_time=-ss "%2")
if "%3"=="" (set duration=) else (set duration=-t "%3")
if not !cone!==!cval! goto MSG_INVALID_URL
for /F "delims=" %%i IN ('youtube-dl -f bestaudio -e %url%') DO set "title=%%i"
for /F "delims=" %%i IN ('youtube-dl -f bestaudio -g %url%') DO set "get_url=%%i"
%tools%\ffmpeg\bin\ffmpeg.exe -strict -2 %start_time% -i "%get_url%" %duration% "%title%.mp3"
goto END
:MSG_INVALID_URL
echo Invalid url, use double quote wrapped url
echo Example: "https://www.youtube.com/watch?v=xxxxxx"
goto END
:END

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
Please tell me what I did wrong below...
@echo OFF
SETLOCAL
SetLocal EnableDelayedExpansion
set url=%1
set "cval=""
set cone=%url:~0,1%
if "%2"=="" (set start_time=1:08:15) else (set start_time=-ss "%2")
if "%3"=="" (set duration=0:02:25) else (set duration=-t "%3")
if not !cone!==!cval! goto MSG_INVALID_URL
for /F "delims=" %%i IN ('youtube-dl -f bestvideo+bestaudio -e https://www.youtube.com/watch?v=U8WRGFB_PWM') DO set "title=Sleep Aid"
for /F "delims=" %%i IN ('youtube-dl -f bestvideo+bestaudio -g https://www.youtube.com/watch?v=U8WRGFB_PWM') DO set "get_url=%%i"
%tools%\ffmpeg\bin\ffmpeg.exe -strict -2 1:08:15 -i "https://www.youtube.com/watch?v=U8WRGFB_PWM" 0:02:25 "Zelda.mp3"
goto END
:MSG_INVALID_URL
echo Invalid url, use double quote wrapped url
echo Example: "https://www.youtube.com/watch?v=xxxxxx"
goto END
:END
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/
extrat it in a new folder and copy the path
example c:\ffmpeg
Replace from the original script "Download.bat"
replace %tools%\bin\ffmpeg.exe for ur path that contain c:\ffmpeg\bin\ffmpeg.exe
Now open a command line "cmd.exe"
In the folder where u saved download.bat
execute:
download.bat "https://www.youtube.com/watch?v=U8WRGFB_PWM" xx:xx yy:yy
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:
https://gitlab.com/snippets/1910457
taken from here:
https://unix.stackexchange.com/a/550496/48971

I made a bash script for having this done here:
https://gitlab.com/snippets/1910457
taken from here:
https://unix.stackexchange.com/a/550496/48971

I would like to try this, if possible, on an Android device? If so, can you enlighten us please? I'm using Termux v0.8 with Python v3.7.5, Nano v4.5, and youtube-dl installed in it(if it helps).

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...
tell me the output of this:
whoami
ls -la .

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...
$ users
No command users found, did you mean:
Command fuser in package psmisc
$ whoami
u0_a103
$ ls -la
total 21
drwx------ 6 u0_a103 u0_a103 3488 Nov  6 15:03 .
drwx------ 4 u0_a103 u0_a103 3488 Nov  6 13:02 ..
drwx------ 4 u0_a103 u0_a103 3488 Nov  6 15:13 .cache
drwx------ 3 u0_a103 u0_a103 3488 Nov  6 14:43 .config
drwx------ 2 u0_a103 u0_a103 3488 Nov  6 15:04 bin
drwx------ 2 u0_a103 u0_a103 3488 Nov  6 13:07 storage
Does my Android being Not Rooted will be an issue here? Is there a way around to use your *.sh still?

My apologies. 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 got those others installed as well. To make typing less painful, I installed Hacker's Keyboard to emaulate the physical one. In short, curiosity just got me the desire to try.

@Shintah07 take a look at this: https://wiki.termux.com/wiki/FAQ#Why_do_I_keep_getting_.27permission_denied.27_when_trying_to_launch_a_script.3F

I did as you instructed and got it to work perfectly. It's awesome! Although, the downloaded file is stored to Termux root dir, thus, rooted Android seems to be required to acquire it(which I did using my other rooted device). Thanks Rodsevich!

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.

@Shintah07 take a look at this: https://wiki.termux.com/wiki/FAQ#Why_do_I_keep_getting_.27permission_denied.27_when_trying_to_launch_a_script.3F

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 puth the path in the name. for example:
download_youtube.sh https://www.youtube.com/watch?v=U8WRGFB_PWM 00:10:00 00:15:00 ../intro.mp4 # will create intro.mp4 in the parent dir
download_youtube.sh https://www.youtube.com/watch?v=U8WRGFB_PWM 00:10:00 00:15:00 sorp/intro.mp4 # will create intro.mp4 in the sorp subdir of the current dir

When running the exact code from @Rodsevich in the previous comment (in terminal on macOS), I get this error:
date: illegal time format
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]

@miklide
Windows syntax
for /F "tokens=* delims=" %a in ('youtube-dl --get-url https://oload.stream/embed/Rp8UClDzOKk') do (ffmpeg -ss 00:26:33.091 -i %a -t 9.983 eam.mp4)

(You need phantomjs.exe on PATH to parse the OpenLoad URL in this example)

Much uglier, naturally 😝
Use %a when typing in the command prompt and %%a in batch files
⚠  FFMPEG -to parameter is not supported here! If you use it ffmpeg will download sequentially until start time then process your fragment to end time and output your file. If your video is 2 hours long and you want to extract something from near the end you will download GBs of data only to throw it away. -t does work however, so subtract the start time from the end time to get the duration you need. More information: Seeking – FFmpeg

This solution works for me on Windows, in Anaconda prompt

When I try this code in python, it doesn't work.
Could anyone find the problem on this code, thank you :)
command = ['for /F "tokens=* delims="', '%a',
'in', '(', 'youtube-dl', '--quiet', '--no-warnings', '--get-url', '"%s"' %(url_base + video_identifier),')',
'do', '(', 'ffmpeg', '-ss', str(start_time), '-i', '%a', '-t', str(end_time - start_time),
'-c:v', 'libx264', '-c:a', 'copy',
'-threads', '1',
'-loglevel', 'panic',
'%s' % output_filename,
')']
command = ' '.join(command)
try:
output = subprocess.check_output(command, shell=True,
stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as err:
return status, err.output

When I try this code in python, it doesn't work.
Could anyone find the problem on this code, thank you :)
command = ['for /F "tokens=* delims="', '%a',
'in', '(', 'youtube-dl', '--quiet', '--no-warnings', '--get-url', '"%s"' %(url_base + video_identifier),')',
'do', '(', 'ffmpeg', '-ss', str(start_time), '-i', '%a', '-t', str(end_time - start_time),
'-c:v', 'libx264', '-c:a', 'copy',
'-threads', '1',
'-loglevel', 'panic',
'%s' % output_filename,
')']
command = ' '.join(command)
try:
output = subprocess.check_output(command, shell=True,
stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as err:
return status, err.output

UPDATED- It 's already SOLVED, thanks to the solution of es3.
The download.bat file:
@echo OFF
SETLOCAL
SetLocal EnableDelayedExpansion
set url=%1
set "cval=""
set cone=%url:~0,1%
if "%2"=="" (set start_time=) else (set start_time=-ss "%2")
if "%3"=="" (set duration=) else (set duration=-t "%3")
if not !cone!==!cval! goto MSG_INVALID_URL
for /F "delims=" %%i IN ('youtube-dl -f bestaudio -e %url%') DO set "title=%4"
for /F "delims=" %%i IN ('youtube-dl -f bestaudio -g %url%') DO set "get_url=%%i"
D:\Anaconda3\envs\myenv\bin\ffmpeg.exe -strict -2 %start_time% -i "%get_url%" %duration% "%title%"
goto END
:MSG_INVALID_URL
echo Invalid url, use double quote wrapped url
echo Example: "https://www.youtube.com/watch?v=xxxxxx"
goto END
:END
Then my python code will be like this: (download.bat "[youtube_url]" start_time duration output_file_directory)

Other solution could work well on cmd and python code: (updated from https://github.com/ytdl-org/youtube-dl/issues/622#issuecomment-162337869)
powershell.exe ffmpeg -ss 3 -i $(youtube-dl -f mp4 -g "https://www.youtube.com/watch?v=--0NTAs-fA0") -t 15 -c copy react-spot.mp4
Sample python code for autodownload from csv file:

@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:
youtube-dl -f 22 --get-url https://www.youtube.com/watch?v=mMZriSvaVP8
Then with the link:
ffmpeg -ss 14350 -i (link) -t 11200 -c:v copy -c:a copy react-spot.mp4
One line version:
ffmpeg -ss 14350 -i $(youtube-dl -f 22 --get-url https://www.youtube.com/watch?v=mMZriSvaVP8) -t 11200 -c:v copy -c:a copy react-spot.mp4
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!

Other solution could work well on cmd and python code: (updated from #622 (comment))
powershell.exe ffmpeg -ss 3 -i $(youtube-dl -f mp4 -g "https://www.youtube.com/watch?v=--0NTAs-fA0") -t 15 -c copy react-spot.mp4
Sample python code for autodownload from csv file:

The subprocess.check_output will run the command in Anaconda cmd (As I run this python code in Anaconda cmd) without a popup additional command window, as far as I know.

nice work, sounds good. could you please write a little guide on how to use it?

Other solution could work well on cmd and python code: (updated from #622 (comment))
powershell.exe ffmpeg -ss 3 -i $(youtube-dl -f mp4 -g "https://www.youtube.com/watch?v=--0NTAs-fA0") -t 15 -c copy react-spot.mp4
Sample python code for autodownload from csv file:

The subprocess.check_output will run the command in Anaconda cmd (As I run this python code in Anaconda cmd) without a popup additional command window, as far as I know.

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 video from youtube (such as Kinetics 400 dataset). Therefore a python code for automatically download just a portion of video is needed for storage saving and also time saving :)
Full code for that task could be such like this (I'm, working on Windows 10):
import argparse
import glob
import json
import os
import shutil
import subprocess
import uuid
from collections import OrderedDict
from joblib import delayed
from joblib import Parallel
import pandas as pd
def create_video_folders(dataset, output_dir, tmp_dir):
"""Creates a directory for each label name in the dataset."""
if 'label-name' not in dataset.columns:
this_dir = os.path.join(output_dir, 'test')
if not os.path.exists(this_dir):
os.makedirs(this_dir)
# I should return a dict but ...
return this_dir
if not os.path.exists(output_dir):
os.makedirs(output_dir)
if not os.path.exists(tmp_dir):
os.makedirs(tmp_dir)
label_to_dir = {}
for label_name in dataset['label-name'].unique():
    this_dir = os.path.join(output_dir, label_name)
    if not os.path.exists(this_dir):
        os.makedirs(this_dir)
    label_to_dir[label_name] = this_dir
return label_to_dir

def construct_video_filename(row, label_to_dir, trim_format='%06d'):
"""Given a dataset row, this function constructs the
output filename for a given video.
"""
basename = '%s_%s_%s.mp4' % (row['video-id'],
trim_format % row['start-time'],
trim_format % row['end-time'])
if not isinstance(label_to_dir, dict):
dirname = label_to_dir
else:
dirname = label_to_dir[row['label-name']]
output_filename = os.path.join(dirname, basename)
return output_filename
def download_clip(video_identifier, output_filename,
start_time, end_time,
tmp_dir='/tmp/kinetics',
num_attempts=5,
url_base='https://www.youtube.com/watch?v='):
"""Download a video from youtube if exists and is not blocked.
arguments:
---------
video_identifier: str
Unique YouTube video identifier (11 characters)
output_filename: str
File path where the video will be stored.
start_time: float
Indicates the begining time in seconds from where the video
will be trimmed.
end_time: float
Indicates the ending time in seconds of the trimmed video.
"""
# Defensive argument checking.
assert isinstance(video_identifier, str), 'video_identifier must be string'
assert isinstance(output_filename, str), 'output_filename must be string'
assert len(video_identifier) == 11, 'video_identifier %s must have length 11' %video_identifier
status = False
# Construct command line for getting the direct video link.
# tmp_filename = os.path.join(tmp_dir,
#                             '%s.%%(ext)s' % uuid.uuid4())
# command = ['youtube-dl',
#            '--quiet', '--no-warnings',
#            '-f', 'mp4',
#            '-o', '"%s"' % tmp_filename,
#            '"%s"' % (url_base + video_identifier)]
# command = ' '.join(command)
attempts = 0
# while True:
#     try:
#         output = subprocess.check_output(command, shell=True,
#                                          stderr=subprocess.STDOUT)
#     except subprocess.CalledProcessError as err:
#         attempts += 1
#         if attempts == num_attempts:
#             return status, err.output
#     else:
#         break

# tmp_filename = glob.glob('%s*' % tmp_filename.split('.')[0])[0]
# Construct command to trim the videos (ffmpeg required).
# command = ['download.bat',
#             '"%s"' % (url_base + video_identifier), str(start_time), str(end_time - start_time),
#         #    '-threads', '1',
#         #    '-loglevel', 'panic',
#            '%s' % output_filename]
command = ['powershell.exe ffmpeg',
            '-ss', str(start_time),
            '-i', '$(youtube-dl',
            '-f', 'mp4',
            '-g', '"%s")' % (url_base + video_identifier),
            '-t', str(end_time-start_time),
            '-c:v', 'libx264', '-c:a', 'copy', '%s' % output_filename]
command = ' '.join(command)
try:
    output = subprocess.check_output(command, shell=True,
                                     stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as err:
    return status, err.output
# while True:
#     try:
#         output = subprocess.check_output(command, shell=True,
#                                          stderr=subprocess.STDOUT)
#     except subprocess.CalledProcessError as err:
#         attempts += 1
#         if attempts == num_attempts:
#             return status, err.output
#     else:
#         break
#  command = ['ffmpeg',
#            '-i', '"%s"' % tmp_filename,
#            '-ss', str(start_time),
#            '-t', str(end_time - start_time),
#            '-c:v', 'libx264', '-c:a', 'copy',
#            '-threads', '1',
#            '-loglevel', 'panic',
#            '"%s"' % output_filename]
# command = ' '.join(command)
# try:
#     output = subprocess.check_output(command, shell=True,
#                                      stderr=subprocess.STDOUT)
# except subprocess.CalledProcessError as err:
#     return status, err.output
# for /F "tokens=* delims=" %a in ('youtube-dl --get-url "%s"' %(url_base + video_identifier)) do (ffmpeg -ss 3 -i %a -t 15 output_filename)
# Check if the video was successfully saved.
status = os.path.exists(output_filename)
# os.remove(tmp_filename)
return status, 'Downloaded'

def download_clip_wrapper(row, label_to_dir, trim_format, tmp_dir):
"""Wrapper for parallel processing purposes."""
output_filename = construct_video_filename(row, label_to_dir,
trim_format)
clip_id = os.path.basename(output_filename).split('.mp4')[0]
if os.path.exists(output_filename):
status = tuple([clip_id, True, 'Exists'])
return status
downloaded, log = download_clip(row['video-id'], output_filename,
                                row['start-time'], row['end-time'],
                                tmp_dir=tmp_dir)
status = tuple([clip_id, downloaded, log])
return status

def parse_kinetics_annotations(input_csv, ignore_is_cc=False):
"""Returns a parsed DataFrame.
arguments:
---------
input_csv: str
Path to CSV file containing the following columns:
'YouTube Identifier,Start time,End time,Class label'
returns:
-------
dataset: DataFrame
Pandas with the following columns:
'video-id', 'start-time', 'end-time', 'label-name'
"""
df = pd.read_csv(input_csv)
if 'youtube_id' in df.columns:
columns = OrderedDict([
('youtube_id', 'video-id'),
('time_start', 'start-time'),
('time_end', 'end-time'),
('label', 'label-name')])
df.rename(columns=columns, inplace=True)
if ignore_is_cc:
df = df.loc[:, df.columns.tolist()[:-1]]
return df
def main(input_csv, output_dir,
trim_format='%06d', num_jobs=24, tmp_dir='/tmp/kinetics',
drop_duplicates=False):
# Reading and parsing Kinetics.
dataset = parse_kinetics_annotations(input_csv)
# if os.path.isfile(drop_duplicates):
#     print('Attempt to remove duplicates')
#     old_dataset = parse_kinetics_annotations(drop_duplicates,
#                                              ignore_is_cc=True)
#     df = pd.concat([dataset, old_dataset], axis=0, ignore_index=True)
#     df.drop_duplicates(inplace=True, keep=False)
#     print(dataset.shape, old_dataset.shape)
#     dataset = df
#     print(dataset.shape)

# Creates folders where videos will be saved later.
label_to_dir = create_video_folders(dataset, output_dir, tmp_dir)

# Download all clips.
if num_jobs == 1:
    status_lst = []
    for i, row in dataset.iterrows():
        status_lst.append(download_clip_wrapper(row, label_to_dir,
                                                trim_format, tmp_dir))
else:
    status_lst = Parallel(n_jobs=num_jobs)(delayed(download_clip_wrapper)(
        row, label_to_dir,
        trim_format, tmp_dir) for i, row in dataset.iterrows())

# Clean tmp dir.
shutil.rmtree(tmp_dir)

# Save download report.
with open('download_report.json', 'w') as fobj:
    fobj.write(json.dumps(status_lst))

if name == 'main':
description = 'Helper script for downloading and trimming kinetics videos.'
p = argparse.ArgumentParser(description=description)
p.add_argument('input_csv', type=str,
help=('CSV file containing the following format: '
'YouTube Identifier,Start time,End time,Class label'))
p.add_argument('output_dir', type=str,
help='Output directory where videos will be saved.')
p.add_argument('-f', '--trim-format', type=str, default='%06d',
help=('This will be the format for the '
'filename of trimmed videos: '
'videoid_%0xd(start_time)_%0xd(end_time).mp4'))
p.add_argument('-n', '--num-jobs', type=int, default=24)
p.add_argument('-t', '--tmp-dir', type=str, default='/tmp/kinetics')
p.add_argument('--drop-duplicates', type=str, default='non-existent',
help='Unavailable at the moment')
# help='CSV file of the previous version of Kinetics.')
main(**vars(p.parse_args()))

Other solution could work well on cmd and python code: (updated from #622 (comment))
powershell.exe ffmpeg -ss 3 -i $(youtube-dl -f mp4 -g "https://www.youtube.com/watch?v=--0NTAs-fA0") -t 15 -c copy react-spot.mp4
Sample python code for autodownload from csv file:

The subprocess.check_output will run the command in Anaconda cmd (As I run this python code in Anaconda cmd) without a popup additional command window, as far as I know.

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 video from youtube (such as Kinetics 400 dataset). Therefore a python code for automatically download just a portion of video is needed for storage saving and also time saving :)
Full code for that task could be such like the download.py I attached (I'm working on Windows 10)
download.txt

Other solution could work well on cmd and python code: (updated from #622 (comment))
powershell.exe ffmpeg -ss 3 -i $(youtube-dl -f mp4 -g "https://www.youtube.com/watch?v=--0NTAs-fA0") -t 15 -c copy react-spot.mp4
Sample python code for autodownload from csv file:

The subprocess.check_output will run the command in Anaconda cmd (As I run this python code in Anaconda cmd) without a popup additional command window, as far as I know.

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 :)
Full code for that task could be such like the download.py I attached (I'm working on Windows 10)
download.txt

thanks for the quick reply
DUDE, thats PERFECT for what i need, i have text files full of ids and timestamps, some of which are from 3+ hours long podcasts. unfortunately i dont understand coding at all.
so far i changed download.txt to download.py, put it in to folder with csv file, downloaded anaconda3 and added it to environment variables. so few questions
1.
how should the csv file be named and formated? i could adapt it to your code.
video_id 1,  start_time 1, end_time 1
video_id 1, start_time 2, end_time 2
video_id 2, start_time 1, end_time 1
etc.?
2. how do i run the python code? type download.py + path to the csv file in cmd?
thanks for your patience


Does not work if Ubuntu Server is running via WSL (Windows Subsystem for Linux)

Does not work if Ubuntu Server is running via WSL (Windows Subsystem for Linux)
ERR Error opening browser err="exec: \"xdg-open\": executable file not found in $PATH"
I found what I need to install xdg-utils, but it doesn't work with it either, it can't get to the browser on the host machine
ERR Timeout: Browser did not load the page within 10 seconds.
As a solution, it would be cool to be able to output the result of the program in the form of an image (save to disk) or as an html file

I'm sorry, I just saw the argument for the html output.


Provide CA cert to Blackfire container

When trying to run blackfire via warden against the https secured site via
warden env run blackfire-agent blackfire curl https://${TRAEFIK_SUBDOMAIN:-app}.${TRAEFIK_DOMAIN}

I ran into untrusted certificate issues.
The below works for me on MacOS:
version: "3.5"
services:
    blackfire-agent:
        extra_hosts:
            - ${TRAEFIK_SUBDOMAIN:-app}.${TRAEFIK_DOMAIN}:${TRAEFIK_ADDRESS:-<IP_ADDRESS>}
        volumes:
            - ${WARDEN_SSL_DIR}/rootca/certs/ca.cert.pem:/etc/ssl/certs/ca-certificates.crt:ro

It looks like the php-fpm container updates certificates at run time but I wasn't able to figure out a way to cross link just the generated output from the php-fpm container into the blackfire one.

@fooman Great callout! I've addressed the extra_hosts entry in the 0.4.4 release. The other will require creating a custom Dockerfile to extend the blackfire-agent image with a startup script that does similar to what you found in the startup script for php-fpm. That will perhaps be handled in a future release (ideally 0.5.1), so I'm going to leave this open, but wanted to thank you for sharing here and update with the partial improvement rolled out minutes ago.


doc: provide list of packages for homebrew

When i run this with sudo, i get "cowardly refusing to 'sudo brew install'" error.

Yes, brew uses sudo internally when needed.
Running sudo brew is actively discouraged..

Sory for the slow turnaround. This was just merged in c1370c5561a12be1bbcf953098598f40fff65514.


chore: promote BobyMCbobs & Riaankl to k8s-conformance admins

add administrative access

Attention @RobertKielty @taylorwaggoner @castrojo
This permissions is needed for the work on K8s-conformance repo size reduction. Thanks

I think it needs an ok-to-test label?


RNIap.purchaseUpdatedListener callback returns undefined

Please use Discussion board if you want get some help out of it. Please report issue if there is a bug.

Version of react-native-iap
4.5.4 (I'm trying to upgrade to newer version but failing because of my react-native version. This is the latest version I can use for my project.)
Version of react-native
0.59.8
Platforms you faced the error (IOS or Android or both?)
iOS only (haven't set up Android yet)
Expected behavior
RNIap.purchaseUpdatedListener(()) callback should return a value
Actual behavior
RNIap.purchaseUpdatedListener((purchase) => {
  console.log(purchase); // undefined
})

Tested environment (Emulator? Real Device?)
Simulator: I can only test on simulator
Real Device: I don't why when I call getProducts() it just returns empty array. This might be another issue.
Steps to reproduce the behavior

Purchase a product
Confirm
Dialog will show saying: "You're all set. Your purchase was successful. [Environment: Xcode]"
purchaseUpdatedListener callback doesn't return any value or transaction receipt. It's just undefined.

@jeremiahlachica can you please share more context on what makes it difficult to use the latest version?

(I'm trying to upgrade to newer version but failing because of my react-native version. This is the latest version I can use for my project.)

Do you see an error while compiling?
I'm curious as to how we can make it available to more people

@andresesfm
If I try to use the latest version or any version above 4.5.4, I get this when doing pod install:
[!] Unable to find a specification for `React-Core` depended upon by `RNIap`

You have either:
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

Had the same issue. Had configurated .storekit for testing IAP locally. Always got same Dialog will show saying: "You're all set. Your purchase was successful. [Environment: Xcode]", but listener returns undefined
Created manager as on example: https://react-native-iap.dooboolab.com/docs/usage_instructions/purchase
Package ver. 6.0.6 (also same on latest)

@andresesfm also got requestReceiptDataWithBlock with force refresh: NO.  on xCode terminal. How can I get valid receipt data?

Any update on this ? I have debugged the purchase scenario on iOS and it seems following function is returning nil and thus callback is returning null.
- (NSData *) receiptData {
    NSURL *receiptURL = [[NSBundle mainBundle]appStoreReceiptURL];
    NSData *receiptData = [[NSData alloc]initWithContentsOfURL:receiptURL];
    return receiptData;
}

This was working perfectly fine until couple of days back and all of a sudden it started returning undefined

@andresesfm
If I try to use the latest version or any version above 4.5.4, I get this when doing pod install:
[!] Unable to find a specification for `React-Core` depended upon by `RNIap`

You have either:
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

This is most likely due to the react-native version you are using. I had to do these changes to the sample app to get it to compile: https://github.com/dooboolab/react-native-iap/pull/1465/files

Any update exists? I met same issue.


adding support for WITHSCORES for zrange command (updated from 6.2.0)

Description
Since ZRangeByScore was deprecated from 6.2.0, I've added a small fix for ZRANGE command to allow the WITHSCORES argument

See https://github.com/redis/node-redis/issues/2031#issuecomment-1064532303


Simplified PR template

Pull request information

Status: Ready to merge
Kind of changes: Simplification of PR template
Code affected: PR template

Description

Simplified the PR template (removed the Todo and Logs/Screenshots parts) in order to have shorter and more informative PRs.

Pull Request Test Coverage Report for Build 3446

0 of 0   changed or added relevant lines in 0 files are covered.
No unchanged relevant lines lost coverage.
Overall coverage remained the same at 89.33%

Totals

Change from base Build 3415:
0.0%

Covered Lines:
8037

Relevant Lines:
8997

💛  - Coveralls


⚠ GitLab Server has degraded performance

In df4c983, GitLab Server (https://gitlab01.its-telekom.eu) experienced degraded performance:

HTTP code: 200
Response time: 6773 ms

Resolved: GitLab Server performance has improved in 5370659.


Adding the sick-fr dataset

The currently referred dataset  Lajavaness/SICK-fr has columns sentence_A, sentence_B and relatedness_score so I might need to create a copy in https://huggingface.co/lyon-nlp with renamed columns to match the model of other STS datasets.

Apologies, made a mistake. I wanted to create a pull request from Lyon-NLP:branch to Lyon-NLP:main


otherElems is a value or ptr

When reviewing the logic in https://github.com/ROCmSoftwarePlatform/triton/blob/triton-mlir-phase-2/lib/Conversion/TritonGPUToLLVM/TritonGPUToLLVM.cpp#L1022
Here, otherElems is a Value as my understanding. This will be a bug when do load in LLVM.

I believe this has been addressed in #83 / #84 already. Closing the ticket hereby.