YouTube, MP4 and FFMPEG

Benjamin Tegge benjaminosm at googlemail.com
Thu Feb 25 21:47:31 UTC 2016


Am Donnerstag, den 25.02.2016, 22:10 +0200 schrieb Amichai Rotman:
>      1. This is the video I am trying to
>         download: https://www.youtube.com/watch?v=625LPUACix0

Thank you for the link, I don't understand why people brought up all
*they* could think about without any details about the actual problem.
Just a reminder: giving false, inaccurate or confusing advice is the
opposite of being helpful.

I looked at the file and you shouldn't have any issues with this video,
it plays fine here on a 14.04 installation with vlc or totem.

    $ youtube-dl --list-formats
https://www.youtube.com/watch?v=625LPUACix0
    [youtube] Setting language
    [youtube] 625LPUACix0: Downloading webpage
    [youtube] 625LPUACix0: Downloading video info webpage
    [youtube] 625LPUACix0: Extracting video information
    [info] Available formats for 625LPUACix0:
    format code extension resolution  note 
    171         webm      audio only  DASH webm audio , audio@ 48k
(worst)
    140         m4a       audio only  DASH audio , audio at 128k
    160         mp4       192p        DASH video 
    242         webm      240p        DASH webm 
    133         mp4       240p        DASH video 
    243         webm      360p        DASH webm 
    134         mp4       360p        DASH video 
    249         unknown_videounknown     
    250         unknown_videounknown     
    251         unknown_videounknown     
    278         unknown_videounknown     
    17          3gp       176x144     
    36          3gp       320x240     
    5           flv       400x240     
    43          webm      640x360     
    18          mp4       640x360     (best)

As youtube-dl (the version from the repositories of 14.04) suggests "18
mp4" is the best download option for this video, given that you have
installed the ubuntu-restricted-extras package, otherwise you probably
want to get the webm version, but mp4 has broader support outside the
open source community. It should be noted that this is an old upload
from 2007, so there are no higher resolutions or higher bitrate/quality
options available. You want to avoid downloading the DASH formats, these
are only audio or only video streams, which are incompatible with
software in Ubuntu 14.04 or older releases. Youtube introduced these
formats after 14.04 was released. Another thing worth to mention is that
you don't need to install a newer version of ffmpeg, you can get static
Linux builds instead [1], in case you need them (these have support for
DASH and many other improvements).

If you just run youtube-dl with the URL provided it will automatically
choose to download the "best" format of the video:

    $ youtube-dl https://www.youtube.com/watch?v=625LPUACix0
    [youtube] Setting language
    [youtube] 625LPUACix0: Downloading webpage
    [youtube] 625LPUACix0: Downloading video info webpage
    [youtube] 625LPUACix0: Extracting video information
    [download] Destination: Welcome to Free Geek-625LPUACix0.mp4
    [download] 100% of 22.33MiB in 00:01

You also can specify the exact version (format) to download, it will
skip files already downloaded:

    $ youtube-dl -f 18 https://www.youtube.com/watch?v=625LPUACix0
    [youtube] Setting language
    [youtube] 625LPUACix0: Downloading webpage
    [youtube] 625LPUACix0: Downloading video info webpage
    [youtube] 625LPUACix0: Extracting video information
    [download] Welcome to Free Geek-625LPUACix0.mp4 has already been
downloaded

Here is the mediainfo about the file, it has very conservative settings
and should play on any modern device or player software:

    $ mediainfo Welcome\ to\ Free\ Geek-625LPUACix0.mp4 
    General
    Complete name                            : Welcome to Free
Geek-625LPUACix0.mp4
    Format                                   : MPEG-4
    Format profile                           : Base Media / Version 2
    Codec ID                                 : mp42
    File size                                : 22.3 MiB
    Duration                                 : 5mn 13s
    Overall bit rate mode                    : Variable
    Overall bit rate                         : 597 Kbps
    Encoded date                             : UTC 2014-01-28 02:24:42
    Tagged date                              : UTC 2014-01-28 02:24:42
    gsst                                     : 0
    gstd                                     : 313608

    Video
    ID                                       : 1
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : Baseline at L3.0
    Format settings, CABAC                   : No
    Format settings, ReFrames                : 1 frame
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 5mn 13s
    Bit rate                                 : 523 Kbps
    Maximum bit rate                         : 1 586 Kbps
    Width                                    : 640 pixels
    Height                                   : 360 pixels
    Display aspect ratio                     : 16:9
    Frame rate mode                          : Constant
    Frame rate                               : 29.970 fps
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Bits/(Pixel*Frame)                       : 0.076
    Stream size                              : 19.5 MiB (88%)
    Tagged date                              : UTC 2014-01-28 02:24:46

    Audio
    ID                                       : 2
    Format                                   : AAC
    Format/Info                              : Advanced Audio Codec
    Format profile                           : LC
    Codec ID                                 : 40
    Duration                                 : 5mn 13s
    Bit rate mode                            : Variable
    Bit rate                                 : 72.0 Kbps
    Maximum bit rate                         : 77.4 Kbps
    Channel(s)                               : 1 channel
    Channel positions                        : Front: C
    Sampling rate                            : 44.1 KHz
    Compression mode                         : Lossy
    Stream size                              : 2.69 MiB (12%)
    Title                                    : IsoMedia File Produced by
Google, 5-11-2011
    Encoded date                             : UTC 2014-01-28 02:24:44
    Tagged date                              : UTC 2014-01-28 02:24:46

Alternatively you can pass the --prefer-free-formats to download the
WebM version (or --all-formats if you want to try all):

    $ mediainfo Welcome\ to\ Free\ Geek-625LPUACix0.webm 
    General
    Complete name                            : Welcome to Free
Geek-625LPUACix0.webm
    Format                                   : WebM
    Format version                           : Version 2
    File size                                : 32.4 MiB
    Duration                                 : 5mn 13s
    Overall bit rate mode                    : Variable
    Overall bit rate                         : 866 Kbps
    Writing application                      : google
    Writing library                          : google

    Video
    ID                                       : 1
    Format                                   : VP8
    Codec ID                                 : V_VP8
    Bit rate                                 : 727 Kbps
    Width                                    : 640 pixels
    Height                                   : 360 pixels
    Display aspect ratio                     : 16:9
    Frame rate mode                          : Variable
    Compression mode                         : Lossy
    Default                                  : Yes
    Forced                                   : No

    Audio
    ID                                       : 2
    Format                                   : Vorbis
    Format settings, Floor                   : 1
    Codec ID                                 : A_VORBIS
    Duration                                 : 5mn 13s
    Bit rate mode                            : Variable
    Bit rate                                 : 96.0 Kbps
    Channel(s)                               : 1 channel
    Sampling rate                            : 44.1 KHz
    Compression mode                         : Lossy
    Stream size                              : 3.59 MiB (11%)
    Default                                  : Yes
    Forced                                   : No

These are also very conservative settings, just VP8 and Vorbis, no VP9
or Opus which are not fully supported by older Ubuntu releases.


[1]: http://johnvansickle.com/ffmpeg/






More information about the ubuntu-users mailing list