[CMD] Download videos & snippets in seconds
Just wanted a page to add all the yt-dlp code as I learn it. If you don’t want to download video’s via command line, check this post instead to download full videos from all sites: Free Online Video Downloader and to download just clips from YouTube-only videos, you can use the online website: Save.Tube
Rest of this post will be code for yt-dlp to make it easier for me to find again :)
If you want to learn how to do the same, check this post for instructions on how to install Python and FFMPEG first. [Notes] OpenAi Whisper For Video Subtitles
Download Videos in seconds
See this post if you haven’t got yt-dlp installed
- yt-dlp: https://github.com/yt-dlp/yt-dlp
- for my pc: https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.exe
Adjusting commands for my use. I want the smallest filesize (most of my videos are for telegram / mobile users). I also want to download the thumbnail, any available english subtitles, video description, and url. I don’t want funky filenames with weird characters.
The command “–embed-thumbnail” looks useful for telegram videos which often come up black; it looks like it embeds the thumbnail at the beginning of the video, but I just checked if it uses this thumbnail on telegram and it doesn’t, which is unfortunate.
A useful command is “–embed-subs” which will embed the already generated subtitles into the video, however if the subtitles are already junk, this might not be ideal.
So far I’ve figured out the following:
yt-dlp -f "(mp4)[height<480]" https://youtu.be/7QPbfKDOkO4 --write-subs --write-auto-subs --sub-format "srt" --sub-langs "en.*" --write-thumbnail --convert-thumbnails "jpg" --compat-options embed-thumbnail-atomicparsley --write-link --restrict-filenames --windows-filenames --write-description --embed-subs
To use, I browse to the folder where I have saved yt-dlp.exe files and ffmpeg.exe files (i.e. c:\bin), then I type CMD in that folder.
(note: I just tested and it works from any folder for me – probably because I followed the steps on the other post to register the python in windows, so you could do the same thing from the folder where you want the video to be stored, but I like doing it this way and moving the files manually, so I only have one folder open and then after watching the video work out “where it belongs” because certain clips of the same video might be categorized differently for me if it covers multiple topics.)
To download just the audio file for transcribing (and download any available english or auto-subtitles in english if possible at the same time):
yt-dlp --extract-audio --audio-format mp3 --audio-quality 5 --write-subs --write-auto-subs --sub-format "srt" --sub-langs "en.*" "https://www.youtube.com/watch?v=oHg5SJYRHA0"
Works with Rumble videos (just change the youtube url to the normal Rumble url… example:)
yt-dlp -f "(mp4)[height<480]" https://rumble.com/v2gpa6k-graham-interviews-nada-about-her-story-and-loss-of-frank....html --write-subs --write-auto-subs --sub-format "srt" --sub-langs "en.*" --write-thumbnail --convert-thumbnails "jpg" --compat-options embed-thumbnail-atomicparsley --write-link --restrict-filenames --windows-filenames --write-description --embed-subs
Just tested audio-only from Odysee and it worked too:
yt-dlp --extract-audio --audio-format mp3 --audio-quality 5 --write-subs --write-auto-subs --sub-format "srt" --sub-langs "en.*" "https://odysee.com/@drsambailey:c/Why-Are-We-Doing-This:c"
Been working for every site I tried until Brighteon – resolved by installing an extra extension:
- https://pypi.org/project/ytdlp-brighteon/
- python3 -m pip install –upgrade ytdlp-brighteon
- or if that doesn’t work, try:
- py -m pip install –upgrade ytdlp-brighteon
After doing the above, Brighteon videos now work with the same code, just replacing url with the brighteon video url:
yt-dlp -f "(mp4)[height<480]" https://www.brighteon.com/0a879511-4eea-48d6-afa0-a716688e82b3 --write-auto-subs --sub-format "srt" --sub-langs "en.*" --write-thumbnail --convert-thumbnails "jpg" --compat-options embed-thumbnail-atomicparsley --write-link --restrict-filenames --windows-filenames --write-description --embed-subs
This is a list of supported sites
Download just the snippet between two timestamps using YT-DLP
To download just the snippet (just like save.tube, but this also works on most video sites):
For me to download the 480p mp4 version between timestamp: 00:26-00:36:
yt-dlp -f "(mp4)[height<480]" https://rumble.com/v2f5dpm-who-pandemic-treaty-debate-smear-campaign.html --write-subs --write-auto-subs --sub-format "srt" --sub-langs "en.*" --write-thumbnail --convert-thumbnails "jpg" --compat-options embed-thumbnail-atomicparsley --write-link --restrict-filenames --windows-filenames --write-description --download-sections "*00:26-00:36"
For BitChute (or if you come across a video that doesn’t have an available mp4 format with my specifications above) I also added the “recode” to convert the format into mp4 after it’s done (if it’s not already in mp4 format) Download between timestamp “*6:02-6:22”.
yt-dlp https://www.bitchute.com/video/joZF7GsUmbfd/ --write-subs --write-auto-subs --sub-format "srt" --sub-langs "en.*" --write-thumbnail --convert-thumbnails "jpg" --compat-options embed-thumbnail-atomicparsley --write-link --restrict-filenames --windows-filenames --write-description --download-sections "*6:02-6:22" --recode-video "aac>mp4/m4a>mp4/mov>mp4/mkv>mp4/mp4"
Alternatively, you could also force yt-dlp to use ffmpeg to download the snippet:
yt-dlp https://rumble.com/v2f5dpm-who-pandemic-treaty-debate-smear-campaign.html --external-downloader ffmpeg --external-downloader-args "-ss 00:00:26.00 -t 00:00:36.00"
Download video (YT/Rumble/BC) then automatically cut the video to snip/timestamp
Alternatively, you can also get it to download the entire video, then create a clip between timestamps (similar to save.tube, works on youtube, rumble, and bitchute (using yt-dlp & ffmpeg)
Downloads entire video, then makes a video from the pre-selected timestamps:
- https://github.com/zackees/ytclip
- py -m pip install ytclip
- example code given for use:
- ytclip https://www.youtube.com/watch?v=CLXt3yh2g0s –start_timestamp 00:32 –end_timestamp 00:52 –outname myoutputfile
- for help: ytclip –help
- When I ran the example code, it created a new folder called myoutputfile where it did all it’s work. At the end, it deleted the new folder and I was left with just the clip.
I would prefer to keep both files (the full video, AND the snippet it created).
For that, I would use this prompt:
ytclip https://www.bitchute.com/video/joZF7GsUmbfd/ --start_timestamp 00:32 --end_timestamp 00:52 --outname myoutputfile --keep
Although this is a great alternative to save.tube, to be able to do the same with Rumble & BitChute videos, and I’m sure it will be useful in some cases, since it downloads and keeps the full video anyway.
I would rather just use yt-dlp to do the same thing except ONLY download the clip instead of the full video (because this will save you downloading a 12 hour video just for a 1 minute clip).
So, I don’t really need this extension because I could just use yt-dlp.
Convert .mp4 to .mp3 in a couple of minutes
See Encoding VBR (Variable Bit Rate) mp3 audio (https://trac.ffmpeg.org/wiki/Encode/MP3)
Testing which one is best for me by trying 3 different options (0-5-9):
V0 Highest filesize (converted 318Mb video to 101Mb audio – sounds great)
ffmpeg -i "pfizerdocs.mp4" -q:a 0 -map a pfizerdocs.mp3
V5 (converted 318Mb video to 45Mb audio – sounds great – undetectable to my ears that it is a smaller file)
ffmpeg -i "pfizerdocs.mp4" -q:a 5 -map a pfizerdocs.mp3
V9 (converted 318Mb video to 26.7Mb audio – maybe something wrong with my hearing, but it still sounds the same to me, undetectable to my ears that this is a lowest quality? so I think I’ll just use this one as my go to for my needs (to transcribe/create subtitles faster)
ffmpeg -i "pfizerdocs.mp4" -q:a 9 -map a pfizerdocs.mp3
Split Large Videos in seconds
Alternatively, if you already have a full video, you can use LosslessCut to split huge videos into smaller videos much faster than any video editing software:
Instructions: timestamp 10:20 from first video (YouTube)
- Using https://github.com/mifi/lossless-cut/releases
- For me: https://github.com/mifi/lossless-cut/releases/download/v3.54.0/LosslessCut-win-x64.7z
- Open LosslessCut exe
- Drag video into app
- Change timestamp
- Export the cut
- (WOW, that was so fast… normally this takes a long time with video editing software, it split the video in seconds!)
Even faster by command line (almost instantaneous! – so useful!)
ffmpeg -ss 00:36:30 -t 00:03:15 -i input.mp4 -vcodec copy -acodec copy output.mp4
Convert Mp4 to Mp4 (to edit in Camtasia)
Convert broken MP4 files to work in programs that can’t import the file: (I use this code for videos that don’t work in Camtasia)
ffmpeg -i input.mp4 -pix_fmt yuv420p -crf 18 output.mp4
Convert to smaller video size (for Telegram/mobile apps)
Change Resolution / Convert to smaller videos:
Option 1: 320×240 (source)
ffmpeg -i input.mp4 -threads 0 -preset slow -s 320x240 -c:v libx264 output240.mp4
Option 2: 640×480 (source)
ffmpeg -i input.mp4 -s 640x480 -c:a copy output480.mp4
Add thumbnail to blank videos (for Telegram, etc.) – 5 seconds
What I need is a way to add a thumbnail to the start of the video, but not perceptible when you play the video for those videos that I upload on Telegram that for some reason have a black screen (and people have to read the text to get an idea of what the video is; not ideal).
I tried all sorts of things wasting the last 3 hours with various code snippets I found online, but finally found a way that works but it’s a 3 step process, so I lost 3 hours today but I’ll save many hours later because the previous way of doing this involved camtasia.
Maybe I’ll find an even easier, more straight-forward way, another day, but I finally found something that works lol, so this is what I will do until then:
- First you need to convert the thumbnail into a video.
- Then you temporarily convert both the thumbnail video and the real video into 2 temp files so they can match resolutions/dimensions
- Then you combine each file into the final output
Step One: Convert Image to Video (this is instantaneous)
ffmpeg -i THUMBNAIL.jpg -vcodec libx264 -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" -r 24 -y -an IMAGEVIDEO.mp4
Step Two: Convert both your Source Video and the Image Video into the same format temporarily (this takes about 2 seconds)
ffmpeg -i IMAGEVIDEO.mp4 -c copy -bsf:v h264_mp4toannexb temp1.ts
ffmpeg -i MAINVIDEO.mp4 -c copy -bsf:v h264_mp4toannexb temp2.ts
Step Three: Join the Temp Files together and output as your final (this also takes about 2 seconds)
ffmpeg -i "concat:temp1.ts|temp2.ts" -c copy -bsf:a aac_adtstoasc FINAL.mp4
To combine Mp4 clips into one file:
If your image video and source video are already the same size & resolution, you can combine multiple clips together by creating a batch file.
First example: Move all your clips into one folder (clip1, clip2, clip3, clip4, etc.), create a new text file and name it “combine.bat“, then from within cmd, run combine and it will clip them in order. (This automatically writes a list of all files in that folder, and then automatically combines the clips and outputs the final result as “output.mp4”)
:: Create File List
for %%i in (*.mp4) do echo file '%%i'>> mylist.txt
:: Concatenate Files
ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4
Second example: This code enables you to manually list which files you want to combine. Save as a .bat file (ie. combine.bat).
:: Create File List
echo file clip1.mp4 >> mylist.txt
echo file clip2.mp4 >> mylist.txt
echo file clip3.mp4 >> mylist.txt
echo file clip4.mp4 >> mylist.txt
echo file clip5.mp4 >> mylist.txt
echo file clip6.mp4 >> mylist.txt
echo file clip7.mp4 >> mylist.txt
:: Concatenate Files
ffmpeg -f concat -i mylist.txt -c copy output2.mp4
Useful links while learning:
- FFMPEG -map option
- FFMPEG main options
- FFMPEG snippets
- FFMPEG Metadata
- FFMPEG Documentation
- Alternatives to check out in future:
- AtomicParsley https://github.com/wez/atomicparsley
- AtomicParsley Manual | SourceForge | CommandLines
- tageditor https://github.com/Martchus/tageditor
Embed a logo
ffmpeg.exe -i video.mp4 -i logo.png -filter_complex “overlay=X:Y” output.mp4
- Please SAVE & SHARE With Other RESEARCHERS (https://pennybutler.com/truthseeker-tools/)
- Useful Tools for TruthSeekers (https://pennybutler.com/sleuth-tools/)
- Free Online Video Downloader (https://pennybutler.com/video-dl/)
- [Notes] OpenAi Whisper for Video Subtitles (https://pennybutler.com/notes-openai-whisper-for-video-subtitles/)
Site Notifications/Chat:
- Telegram Post Updates @JourneyToABetterLife (channel)
- Telegram Chatroom @JourneyBetterLifeCHAT (say hi / share info)
- Gettr Post Updates @chesaus (like fakebook)
Videos: