I had a 2-hour school convocation video on YouTube that I wanted to save for my own future reference. I first tried using a GUI downloader, but it kept spinning and never actually downloaded the video. The working solution was to use yt-dlp, plus a JavaScript runtime and FFmpeg support.
This guide documents the exact process that worked on Windows.
1. Install yt-dlp
Download yt-dlp from the official GitHub release page:
https://github.com/yt-dlp/yt-dlp/releases
After downloading, place yt-dlp.exe in a folder such as:
D:\ch-software
Then open Command Prompt and go to that folder:
cd /d D:\ch-software
Test that it works:
yt-dlp --version
2. Install Deno for YouTube JavaScript Challenges
When I first ran yt-dlp, I saw a warning like this:
No supported JavaScript runtime could be found.
YouTube extraction without a JS runtime has been deprecated.
To fix this, I installed Deno using Windows Package Manager:
winget install DenoLand.Deno
Then I closed Command Prompt, reopened it, and checked:
deno --version
If winget is not recognized, install or update App Installer from the Microsoft Store.
3. Install FFmpeg
FFmpeg is important because YouTube livestream replays may download as HLS fragments. Without FFmpeg, the file may have timestamp issues or slight audio/video sync problems.
Install FFmpeg:
winget install Gyan.FFmpeg
Then close and reopen Command Prompt.
Check:
ffmpeg -version
4. Check Available Video Formats
Before downloading, I checked what quality options were actually available:
yt-dlp -F "https://www.youtube.com/watch?v=yZFp6eo91rM"
The output showed this:
91 mp4 256x144 15
92 mp4 426x240 30
93 mp4 640x360 30
94 mp4 854x480 30
95 mp4 1280x720 30
This confirmed that the best available version was 720p, not 1080p. If YouTube does not provide a 1080p stream, yt-dlp cannot create one.
5. Create a Custom Download Folder
I wanted to save the video into:
D:\my videos
So I created the folder:
mkdir "D:\my videos"
6. Best Working Download Command
The final command that worked was:
yt-dlp --fixup force --remux-video mp4 -o "D:\my videos\%(title)s_%(height)sp.%(ext)s" "https://www.youtube.com/watch?v=yZFp6eo91rM"
What this command does
| Command part | Meaning |
|---|---|
yt-dlp | Runs the downloader |
no -f option | Lets yt-dlp choose the best available format automatically |
--fixup force | Forces post-download fixes for timestamp/container issues |
--remux-video mp4 | Repackages the video into a clean MP4 without re-encoding |
-o "D:\my videos\%(title)s_%(height)sp.%(ext)s" | Saves the file to the custom folder and includes the resolution in the filename |
| YouTube URL | The video to download |
7. Important Note About -f best
I originally tried using:
-f "best"
But yt-dlp gave this warning:
"-f best" selects the best pre-merged format which is often not the best option.
To let yt-dlp download and merge the best available formats, simply do not pass any format selection.
So the better approach is to omit -f entirely and let yt-dlp pick the best available video/audio combination.
8. Understanding the Fragment Download
During the download, I saw:
[hlsnative] Total fragments: 1216
This is normal for a YouTube livestream replay. YouTube serves the video as many small HLS fragments. yt-dlp downloads all the fragments and assembles them into one file.
9. If Audio Is Slightly Out of Sync
After one earlier download, the file had a slight audio/video sync issue. The fix is to remux the MP4 using FFmpeg:
ffmpeg -i "input.mp4" -c copy "fixed_remux.mp4"
This does not reduce quality. It simply rebuilds the container.
If audio is still slightly off, shift the audio manually.
If audio is early
ffmpeg -i "input.mp4" -itsoffset 0.25 -i "input.mp4" -map 0:v -map 1:a -c copy "fixed_audio_delayed.mp4"
If audio is late
ffmpeg -i "input.mp4" -itsoffset -0.25 -i "input.mp4" -map 0:v -map 1:a -c copy "fixed_audio_advanced.mp4"
A small issue is usually around 0.1 to 0.4 seconds.
Final Command to Keep for Future Use
For the same type of YouTube school convocation video, this is the command I would keep:
mkdir "D:\my videos"
yt-dlp --fixup force --remux-video mp4 -o "D:\my videos\%(title)s_%(height)sp.%(ext)s" "YOUTUBE_URL_HERE"
Example:
mkdir "D:\my videos"
yt-dlp --fixup force --remux-video mp4 -o "D:\my videos\%(title)s_%(height)sp.%(ext)s" "https://www.youtube.com/watch?v=yZFp6eo91rM"
Bottom Line
The GUI downloader did not work, but yt-dlp worked once the proper supporting tools were installed. The key pieces were:
yt-dlpfor downloading.Denofor YouTube JavaScript challenge handling.FFmpegfor clean MP4 remuxing and timestamp fixes.No
-f best; letyt-dlpchoose the best available format automatically.Use
--fixup forceand--remux-video mp4for cleaner final output.