Created
August 24, 2019 15:53
-
-
Save trapexit/86c951e50cfc536283229002b4263d25 to your computer and use it in GitHub Desktop.
youtube-dl setup for archiving
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "${1}" == "-d" ]; then | |
ARCHIVE="--download-archive ${2}" | |
shift | |
shift | |
fi | |
youtube-dl \ | |
${ARCHIVE} \ | |
-f "(bestvideo[vcodec^=av01][height>=1080][fps>30]/bestvideo[vcodec=vp9.2][height>=1080][fps>30]/bestvideo[vcodec=vp9][height>=1080][fps>30]/bestvideo[vcodec^=av01][height>=1080]/bestvideo[vcodec=vp9.2][height>=1080]/bestvideo[vcodec=vp9][height>=1080]/bestvideo[height>=1080]/bestvideo[vcodec^=av01][height>=720][fps>30]/bestvideo[vcodec=vp9.2][height>=720][fps>30]/bestvideo[vcodec=vp9][height>=720][fps>30]/bestvideo[vcodec^=av01][height>=720]/bestvideo[vcodec=vp9.2][height>=720]/bestvideo[vcodec=vp9][height>=720]/bestvideo[height>=720]/bestvideo[width>=640][vcodec=vp9]/bestvideo[width>=640]/bestvideo[vcodec^=av01]/bestvideo[vcodec=vp9.2]/bestvideo[vcodec=vp9]/bestvideo)+(bestaudio[acodec=opus]/bestaudio)/best" \ | |
--add-metadata \ | |
--embed-subs \ | |
--embed-thumb \ | |
--embed-thumbnail \ | |
--fragment-retries 10 \ | |
--ignore-errors \ | |
--merge-output-format=mkv \ | |
--no-continue \ | |
--playlist-reverse \ | |
--retries 10 \ | |
--sub-lang=en \ | |
--write-all-thumbnails \ | |
--write-annotations \ | |
--write-auto-sub \ | |
--write-description \ | |
--write-info-json \ | |
--write-sub \ | |
--write-thumbnail \ | |
--xattrs \ | |
--exec 'yt-dl-to-mkv {}' \ | |
--output "%(uploader)s (%(uploader_id)s)/%(upload_date)s - %(id)s - %(title)s/%(upload_date)s - %(id)s - %(title)s.%(ext)s" \ | |
$@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
SRC=${1} | |
TGT=${SRC%.*}.mkv | |
BASEPATH=$(dirname "${SRC}") | |
TMPFILE=$(mktemp -u -p "${BASEPATH}") | |
ffmpeg \ | |
-hide_banner \ | |
-i "file:${SRC}" \ | |
-c copy \ | |
-c:s webvtt \ | |
-f matroska \ | |
"file:${TMPFILE}" && \ | |
mv -fv "${TMPFILE}" "${TGT}" | |
if [ "${SRC}" != "${TGT}" ]; then | |
rm -fv "${SRC}" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment