ASN

Notes by Akhil Saji

Categories

Youtube-DLP the most useful command line tool for YouTube

YT-DLP has to be one of my all time favorite open-source and publically availiable command line tools for YouTube (and thousands of other video sites). This project allows users to download youtube videos or entire playlists from YouTube for whatever offline purpose. My primary use case is downloading videos for offline use primarily while flying. Despite having a fairly comprehensive github page, using yt-dlp can be obtuse at times so I've constructed a list of my favorite commands you can use quickly as a reference.

Download entire YouTube Playlist in 720p MP4 Format

yt-dlp -f "bestvideo[height<=720][ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" --merge-output-format mp4 --yes-playlist -o "%(playlist_index)02d-%(title)s.%(ext)s" --embed-thumbnail "playlist_url_here"

Download single YouTube video in 720p MP4 Format

yt-dlp -f "bestvideo[height<=720][ext=mp4]+bestaudio[ext=m4a]/best[height<=720][ext=mp4]/best[height<=720]" --merge-output-format mp4 --embed-thumbnail --embed-metadata -o "%(title)s.%(ext)s" "video_url_here"

Download a YouTube Music video AUDIO ONLY in best quality MP3 format

yt-dlp -f bestaudio -x --audio-format mp3 --audio-quality 0 --embed-thumbnail --embed-metadata -o "%(title)s.%(ext)s" "video_url_here"

Enjoy!


A method to download streaming video from any website

Have you ever encountered some web video you find immensely helpful but can't bookmark or save for later viewing? Most streaming plugins prevent saving of such video contents for later viewing; however, there are ways to save such content for offline viewing and personal consumption. Below is a technique I have used multiple times to save educational content for future offline viewing.

Step 1: Download Video Download Helper chrome extension
Once you have the extension installed, you can go to any streaming video content you wish to save and see if it is able to detect a streaming URL to copy. Once you find such content the plugin works on, move onto step 2.

Step 2: Install a downloader tool such as JDownloader On MacOS you can install jDownloader using brew brew install -cask jdownloader

Step 3: Paste the URL from the helper extension into jDownloader

Reminder: This method is solely for saving content for personal consumption, I do not endorse using such techniques to circumvent copyright law.

Enjoy!


Editing EXIF Data in Photo Files

There is currently no easy way to edit EXIF data especially in batch fashion on Mac or iOS devices. Importing photos into your iCloud photo library with incorrect Date Time information can result in the disaster of your photo timeline being bombarded with photos from incorrect dates. I recently had to import a large number of photos into my iCloud photo library and encountered this exact issue. Unfortunately, the date time editing function seen in the Photos App on MacOS and iOS (see image > adjust date and time) does not actually change the original date time for an entire sequence of photos but rather applys an offset resulting in batch edits of photos leading to photos with incorrect timestamps into the future. After trying a multitude of free EXIF editing apps on the Mac App Store which all have paywalls or limits, I stumbled on exiftool, a command line focused tool for batch editing photo files.

Exiftool can be installed via Brew brew install exiftool.

To change the original date time of a large sequence of photos you will want to edit the Date/Time Original metadata tag by using the following command: exiftool "-DateTimeOriginal=YY:MM:DD HH:MM:SS" -r TargetFolder

The tool will change all the exifdata for the files you target and additionally will backup the original file in case errors are encountered. Changes can be viewed by running exiftool -common targetfile.jpg which will output something akin to the following:

File Name                       : file.JPG
File Size                       : 18 MB
Camera Model Name               : ILCE-9
Date/Time Original              : 2020:01:01 07:30:00
Image Size                      : 6000x4000
Quality                         : RAW + Extra Fine
Focal Length                    : 12.0 mm
Shutter Speed                   : 1/100
Aperture                        : 4.0
ISO                             : 1250
White Balance                   : Auto
Flash                           : Off, Did not fire

Enjoy!