There is so much entertaining, funny and educative material available on Youtube, most of which is in english. Some of the video’s have Dutch subtitles.
This is my wishlist for these video’s:
- Preference for Dutch and English subtitles, if youtube has them available (automatically translated or not)
- Best quality available – this is the default setting for youtube-dl according to the documentation – but specifically for merging into mp4
- Converted to MP4, so I can watch it both in the web browser, as well as on the RasPlex, without transcoding (my NAS is not fast enough)
This is my method to watch these video’s with Plex:
- Log in to my private google account and give the video a like
- On the NAS make two directories
- In the
youtube-dl --username \ --cookies _youtube-dl-cookies.txt \ --keep-video \ --ignore-errors \ --write-auto-sub \ --sub-lang 'nl,en' \ --prefer-ffmpeg \ --format 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4' \ --merge-output-format mp4 \ cd ../youtube-likes IFS=$(echo -en "\n\b") ; for i in $(ls ../youtube-likes-workdir/*vtt) ; do ln -f "$i" . ; done IFS=$(echo -en "\n\b") ; for i in $(ls ../youtube-likes-workdir/*mp4 | egrep -v 'f[0-9]*.mp4') ; do ln -f "$i" . ; done
The separation between
youtube-likes is required to prevent Plex to list video’s twice, which it will do since both separate audio/video and merged video files exist in the workdir, and I want to keep the original files to prevent excessive downloads. As a workaround, Plex is directed to the
youtube-likes folder, where only the merged videos and subtitles are linked from the working directory. The last two commands above create these links. Hardlinks in stead of symlinks are required in order for Plex to play the video.
This method works with the latest Plex versions that supports vtt subtitles, as well as youtube 2FA google account authentication.