Sometimes, you just want to link to a specific segment of a YouTube video. Deep-linking to a specific start time in a YouTube video is fairly common — but sometimes specifying an end-time is as (or more!) important.
After much fruitless Googling, I’ve found a way to do this:
Use the embed URL (https://youtube.com/embed/ID) rather than the watch URL (https://youtube.com/watch?v=ID or https://youtube.com/watch/ID)
Specify the start time, end time, or both, using the URL parameters
end. The units are seconds. I haven't figured out a way to use other units but it might be possible.
Here are seven seconds from the middle of a Joel Spolsky talk:
(When you use embed URLs as links, it’s just the video — no sidebars or comments. In my view, that's a good thing.)
Here’s an actual embed of the above embed URL, so you can see the query parameters at work without leaving the page:
Here’s the same video, starting one minute in:
Here’s just the first minute of the talk:
[For those who aren’t familiar with URL query strings: a question mark goes after the URL and before the first query parameter, and additional key-value pairs are separated with an ampersand.]
I’d run across mention of YouTube allowing one to link to a segment of a video using
?start=30&end=60 (or in some cases
stop rather than
end) in various articles, but these parameters don’t work on the watch URL. When sharing a regular YouTube link,
start=30 turns into
t=30s and the
end parameter gets thrown out.
At first, I assumed YouTube had removed this useful functionality. But the docs for the embedded player still mentioned the end parameter, so I tried using them on the embed URL when not embedded — and it worked!
I hope this helps anyone who has the same question I had.