shithub: wiki.9front.org

ref: e126bb18f34ffaedce4cede803539f20468a2492
dir: /youtube.md/

View raw version
Youtube
=======

Commit [treason](https://git.sr.ht/~ft/treason).

Install [youtubedr](https://github.com/ftrvxmtrx/youtubedr):

	9fs ftrv.se
	gunzip /n/ftrv.se/bin/youtubedr.amd64.gz > $home/bin/amd64/youtubedr

## Playing just audio alone

	mcfs -t 1 `"{youtubedr -i 140 -o /tmp/audio.mp4 ybGOT4d2Hs8} | audio/aacdec > /dev/audio

## Playing video and/or audio

The easiest way to play ANY video on Youtube is to use H.264 baseline stream. It's of pretty bad
quality image-wise, but contains audio in the container itself and doesn't require too much CPU
resources.

	treason `"{youtubedr -i 18 ybGOT4d2Hs8}

If you want to find the best possible format, use the following script:

	#!/bin/rc
	rfork ne
	vitag=`{youtubedr -info $1 | awk '/av01/ { print $2; exit }'}
	if(~ $#vitag 0)
		treason `"{youtubedr -i 18 -o /tmp/_vid.mp4 $1}
	if not
		treason -a `"{youtubedr -i 140 -o /tmp/_aud.mp4 $1} `"{youtubedr -i $vitag -o /tmp/_vid.mp4 $1}
	#rm -f /tmp/_^(aud vid)^.mp4

## Caveats

Many. Patches welcome.