Skip to content

Instantly share code, notes, and snippets.

@isaactzab
Last active August 4, 2023 03:12
Show Gist options
  • Select an option

  • Save isaactzab/4f7c566d6a17c2addbef to your computer and use it in GitHub Desktop.

Select an option

Save isaactzab/4f7c566d6a17c2addbef to your computer and use it in GitHub Desktop.

Revisions

  1. isaactzab revised this gist Mar 3, 2016. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion download-mp3-youtube-dl.md
    Original file line number Diff line number Diff line change
    @@ -7,8 +7,10 @@ From the online help:
    ```
    -x, --extract-audio convert video files to audio-only files (requires
    ffmpeg or avconv and ffprobe or avprobe)
    Bear in mind as well that youtube-dl defaults to using avconv so you should consider specifying either avconv or FFmpeg at the commandline. From the online help:
    ```

    Bear in mind as well that youtube-dl defaults to using avconv so you should consider specifying either avconv or FFmpeg at the commandline. From the online help:
    ```
    --prefer-avconv Prefer avconv over ffmpeg for running the
    postprocessors (default)
    --prefer-ffmpeg Prefer ffmpeg over avconv for running the
  2. isaactzab revised this gist Mar 3, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions download-mp3-youtube-dl.md
    Original file line number Diff line number Diff line change
    @@ -13,5 +13,5 @@ Bear in mind as well that youtube-dl defaults to using avconv so you should cons
    postprocessors (default)
    --prefer-ffmpeg Prefer ffmpeg over avconv for running the
    postprocessors
    Further options for keeping the original video, adjusting the bitrate or quality of the audio and a few others can be seen by looking at youtube -h.
    ```
    ```
    Further options for keeping the original video, adjusting the bitrate or quality of the audio and a few others can be seen by looking at youtube -h.
  3. isaactzab revised this gist Mar 3, 2016. 1 changed file with 17 additions and 0 deletions.
    17 changes: 17 additions & 0 deletions download-mp3-youtube-dl.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    #How to download an MP3 track from a YouTube video
    You can also download the mp3 directly from youtube without converting using ffmpeg

    `youtube-dl --extract-audio --audio-format mp3 <video URL>`

    From the online help:
    ```
    -x, --extract-audio convert video files to audio-only files (requires
    ffmpeg or avconv and ffprobe or avprobe)
    Bear in mind as well that youtube-dl defaults to using avconv so you should consider specifying either avconv or FFmpeg at the commandline. From the online help:
    --prefer-avconv Prefer avconv over ffmpeg for running the
    postprocessors (default)
    --prefer-ffmpeg Prefer ffmpeg over avconv for running the
    postprocessors
    Further options for keeping the original video, adjusting the bitrate or quality of the audio and a few others can be seen by looking at youtube -h.
    ```
  4. isaactzab created this gist Mar 3, 2016.
    96 changes: 96 additions & 0 deletions install-youtube-dl.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,96 @@
    #Install YouTube-DL in Ubuntu/Linux Mint and Debian
    Ubuntu users can download and install latest youtube-dl version from the webupd8 PPA as shown.
    ```
    $ sudo add-apt-repository ppa:nilarimogard/webupd8
    $ sudo apt-get update
    $ sudo apt-get install youtube-dl
    ```
    **Update**: Similarly, instead using any third party PPA, you can use curl or wget command to install latest version of youtube-dl script as shown.
    ```
    $ sudo curl https://yt-dl.org/latest/youtube-dl -o /usr/local/bin/youtube-dl
    ```
    OR
    ```
    sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
    ```
    After downloading the script, set the executable permission.
    ```
    $ sudo chmod a+rx /usr/local/bin/youtube-dl
    ```
    #Update YouTube-DL
    Youtube-dl itself can be updated to the latest version using the following command.
    ```
    # youtube-dl -U
    ```
    Sample Output
    ```
    Updating to version 2015.09.03 ...
    Updated youtube-dl. Restart youtube-dl to use the new version.
    ```
    #How to Use YouTube-DL to Download Videos
    To download a video file, simply run the following command. Where “VIDEO_URL” is the url of the video that you want to download.
    ```
    # youtube-dl https://www.youtube.com/watch?v=iRYvuS9OxdA
    ```
    Sample Output
    ```
    [youtube] iRYvuS9OxdA: Downloading webpage
    [youtube] iRYvuS9OxdA: Downloading video info webpage
    [youtube] iRYvuS9OxdA: Extracting video information
    [youtube] iRYvuS9OxdA: Downloading js player new-en_US-vflCeB3p5
    [youtube] iRYvuS9OxdA: Downloading DASH manifest
    [download] Destination: Amy Macdonald - This Is The Life-iRYvuS9OxdA.mp4
    [download] 100% of 10.33MiB in 00:01
    ```
    To list all available formats of video, use option “–list-formats” with the youtube-dl command.
    ```
    # youtube-dl --list-formats https://www.youtube.com/watch?v=iRYvuS9OxdA
    ```
    Sample Output
    ```
    [youtube] vKtwZmhX0lw: Downloading webpage
    [youtube] vKtwZmhX0lw: Downloading video info webpage
    [youtube] vKtwZmhX0lw: Extracting video information
    [youtube] vKtwZmhX0lw: Downloading DASH manifest
    [youtube] vKtwZmhX0lw: Downloading DASH manifest
    [info] Available formats for vKtwZmhX0lw:
    format code extension resolution note
    171 webm audio only DASH audio 113k , vorbis@128k (44100Hz), 1.86MiB
    140 m4a audio only DASH audio 128k , m4a_dash container, aac @128k (44100Hz), 2.14MiB
    141 m4a audio only DASH audio 255k , m4a_dash container, aac @256k (44100Hz), 4.30MiB
    278 webm 180x144 DASH video 63k , webm container, vp9, 1fps, video only, 946.76KiB
    160 mp4 180x144 DASH video 112k , avc1.4d400c, 15fps, video only, 1.86MiB
    242 webm 300x240 DASH video 170k , vp9, 1fps, video only, 2.50MiB
    133 mp4 300x240 DASH video 247k , avc1.4d400d, 25fps, video only, 4.11MiB
    243 webm 400x320 DASH video 288k , vp9, 1fps, video only, 4.07MiB
    13 3gp unknown small
    17 3gp 176x144 small , mp4a.40.2, mp4v.20.3
    36 3gp 320x240 small , mp4a.40.2, mp4v.20.3
    5 flv 400x240 small
    43 webm 640x360 medium , vorbis, vp8.0
    18 mp4 640x360 medium , mp4a.40.2, avc1.42001E (best)
    ```
    To download a preferred file format, use the option ‘-f’ (video format code). For example, I would like to download mp4 format, So I use format code as ‘18‘ as shown below.
    ```
    # youtube-dl -f 18 https://www.youtube.com/watch?v=iRYvuS9OxdA
    ```
    Sample Output
    ```
    [youtube] iRYvuS9OxdA: Downloading webpage
    [youtube] iRYvuS9OxdA: Downloading video info webpage
    [youtube] iRYvuS9OxdA: Extracting video information
    [youtube] iRYvuS9OxdA: Downloading DASH manifest
    [download] Amy Macdonald - This Is The Life-iRYvuS9OxdA.mp4 has already been downloaded
    [download] 100% of 10.33MiB
    ```
    To download a list of video files, create a file and place all the YouTube links that you wish to download.
    ```
    # youtube-dl -a youtube_links.txt
    ```
    Type the following command in a terminal to list all the avialable options.
    ```
    # youtube-dl --help
    ```
    For other distributions, youtube-dl can be downloaded from the youtube-dl download page.
    http://rg3.github.io/youtube-dl/download.html