Skip to content

Instantly share code, notes, and snippets.

@creaktive
Last active October 13, 2019 11:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save creaktive/51f8481c5cf339676b12278163b5f5a6 to your computer and use it in GitHub Desktop.
Save creaktive/51f8481c5cf339676b12278163b5f5a6 to your computer and use it in GitHub Desktop.
CLI VJ
# requirements: curl, ffmpeg, youtube-dl
mkdir ttaass.com
chdir ttaass.com
curl https://www.ttaass.com |\
perl -nE 'say $1 while m{"(http://www\.youtube\.com[^"]+)}g' |\
sort -u |\
xargs -n 1 youtube-dl -f 'bestvideo[ext=mp4,width=1920,height=1080]'
# delete the unwanted ones...
# normalize videos
find -type f -name \*.mp4 -print0 |\
xargs -0 -n1 -I % ffmpeg -i % -q 0 %.mts
# adjust the ARGV multiplier for longer sets
perl -MList::Util=shuffle -E "say qq(file '\$_') for shuffle ((@ARGV) x 10)" *.mts > playlist.txt
# re-encode with quality recommended for YouTube
ffmpeg -safe 0 -f concat -i playlist.txt \
-vf mpdecimate,setpts=N/30/TB -r 30 \
-codec:v libx264 -crf 21 -bf 2 -flags +cgop -pix_fmt yuv420p -b:v 15m \
ttaass.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment