Antony's Logo

Antony's pages of stuff

  • Geek Home
  • HTML & Web Code
    • 2d Canvas
    • 3d Canvas
    • Javascript
  • Command Line
    • Windows CL
    • Windows CL Elevated
    • Windows Powershell
    • Unix & Linux
  • Other Stuff
    • Electronics
    • TV & Radio
    • Excel
    • Powerpoint
    • Word
  • Contact

F*@#ing Linux



Things I have found out about whilst trying to use youtube-dl



What is a youtube-dl -?

youtube-dl is a command-line program to download videos from YouTube.com and a few more .. List of all the supported sites. like BBC Iplayer etc It requires the Python interpreter (2.6, 2.7, or 3.2+)

Installing youtube-dl

sudo apt install youtube-dl

Check Version installed

youtube-dl --version

Updating to latest version

sudo -H pip install --upgrade youtube-dl

Working with BBC Iplayer

youtube-dl 'http://www.bbc.co.uk/programmes/p053d10k'

Working with YouTube

youtube-dl 'https://www.youtube.com/watch?v=RMINSD7MmT4'

Dependant of your requirements, (I actually wanted mp4), sometimes the format created is mkv like this.

youtube-dl 'https://www.youtube.com/watch?v=MM2qq5J5A1s'

youtube-dl -f option to get all available formats

youtube-dl -f 'https://www.youtube.com/watch?v=MM2qq5J5A1s'
[youtube] MM2qq5J5A1s: Downloading webpage
[youtube] MM2qq5J5A1s: Downloading video info webpage
[youtube] MM2qq5J5A1s: Extracting video information
[info] Available formats for MM2qq5J5A1s:
format code  extension  resolution note
249          webm       audio only DASH audio   55k , opus @ 50k, 2.19MiB
250          webm       audio only DASH audio   73k , opus @ 70k, 2.91MiB
140          m4a        audio only DASH audio  128k , m4a_dash container, mp4a.40.2@128k, 5.40MiB
171          webm       audio only DASH audio  133k , vorbis@128k, 4.91MiB
251          webm       audio only DASH audio  141k , opus @160k, 5.71MiB
278          webm       192x144    144p   90k , webm container, vp9, 30fps, video only, 3.06MiB
160          mp4        192x144    144p  117k , avc1.4d400c, 15fps, video only, 4.63MiB
242          webm       320x240    240p  189k , vp9, 30fps, video only, 6.29MiB
133          mp4        320x240    240p  257k , avc1.4d400d, 30fps, video only, 10.40MiB
243          webm       480x360    360p  353k , vp9, 30fps, video only, 11.44MiB
134          mp4        480x360    360p  604k , avc1.4d401e, 30fps, video only, 12.93MiB
244          webm       640x480    480p  665k , vp9, 30fps, video only, 20.66MiB
135          mp4        640x480    480p 1104k , avc1.4d401e, 30fps, video only, 25.82MiB
17           3gp        176x144    small , mp4v.20.3, mp4a.40.2@ 24k
36           3gp        320x240    small , mp4v.20.3, mp4a.40.2
18           mp4        480x360    medium , avc1.42001E, mp4a.40.2@ 96k
43           webm       640x360    medium , vp8.0, vorbis@128k (best)

You can choose mp4 by typing
youtube-dl -f 18 'https://www.youtube.com/watch?v=MM2qq5J5A1s'
To get the best video quality (480p - format "135") and best audio quality (DASH audio - format "140"), you must use the following command: youtube-dl -f 135+140

Or otherwise you could use somthing like this in handbrake-cli to convert the output but it takes ages.

sudo HandBrakeCLI -i 'Moments in History - The Fall of the Berlin Wall-MM2qq5J5A1s.mkv' -o 'Moments in History - The Fall of the Berlin Wall-MM2qq5J5A1s.mp4' -e x264 -q 20

Thumbnails

If you want to get the thumbnail use --write-thumbnail or just list --list-thumbnail

Read the readme for more commands here...
https://github.com/rg3/youtube-dl/blob/master/README.md

Jump to Ubuntu, Linux and me on....

  • Uncomplcated Fire Wall (UFW)
  • Fail2ban
  • HandBrakeCLI
  • Screen
  • htpassword
  • apt
  • Nginx
  • CHOWN
  • rsync
  • youtube-dl
  • vi
  • Putty

by Ant Monkey on Juice © 

Contact me here