In order to avoid having to run proprietary code from Google I cobbled together a script a few days ago combining youtube-dl and vlc. The result is far from perfect, but allows me to both download videos off of YouTube for safekeeping and make use of features in vlc such as fixing aspect ratios and incorrect cropping. I'm placing the following script in the public domain, in the hope that it will be useful to someone:
TITLE=$(youtube-dl -j $1 | sed -e 's/.*"fulltitle": "//;s/".*//')
echo $TITLE
cd /tmp
youtube-dl $1 -o "$.mp4" &
# A bit of an ugly hack here, but it works
#if [ -f "$.mp4" ]
#do
# # Already have the file
# vlc "$.mp4"
# exit 0
#done
# Wait for the download to start
while [ ! -f "$.mp4.part" ]
do
echo Waiting
sleep 1
done
# Wait a little more so we have some data..
sleep 1
vlc "$.mp4.part"
Some improvements could still be made. One issue is that sometimes the download finished during the final sleep, so vlc get the wrong filename. Meh!
edit: this feature is now built into both vlc and mpv, and implemented much better. Yay!