Why youtube-dl is converting my downloaded video to a different format

10,575

Solution 1

youtube-dl isn't converting anything. It has separately downloaded the audio and video stream. But the audio can't be muxed into a MP4 so it's muxing them into a MKV. There's no compression involved. Use -f 133+140 to get a MP4.

Solution 2

The video in question may be older. If it pre-dates the switch from flash to html5 video on youtube it may be in a video or audio format that is not ideal for playing from a computer.

It's important to note that you can't know the video format from the extension of the file. MP4 is a container format capable of containing many different video and audio formats. WebM is the same. MKV takes that to infinity and beyond (afaik there are literally no limits on what MKV can contain other than it must be a data stream of some kind or text).

You might want to get ahold of Mediainfo (it's probably in your package manager). This will let you see what video/audio formats are being used.

EDIT: Accounting for the fact that something is different between your computer and the other, there are a couple possibilities. FFmpeg on the other computer could have been compiled with additional features. Not all features of FFmpeg are compiled by default... and it would be up to the maintainer for the exact binary release of the FFmpeg package used on each computer as to what additional features would or would not be compiled into the binaries. This also goes for additional patches that might have been applied to it. Even on windows there are a number of different binary version of FFmpeg that might be being used.

The same could be true of youtube-dl itself. It could also be the result of different versions of python being installed or different python packages with different maintainers being installed (since youtube-dl is a python application).

It could be that either or both are missing optional dependencies on one machine that the other has.

I mean there are a lot of possibilities.

It's also worth noting that the files shown in the two logs are not the same one. It might be the same video, but each is downloading different files. YouTube serves different files based on selected quality/detected connection speed.

Share:
10,575
user2262511
Author by

user2262511

Updated on September 18, 2022

Comments

  • user2262511
    user2262511 over 1 year

    I am downloading a video but youtube-dl is converting it to something else using ffmeg. This doesn't usually happens, what should I do ?

    Here is the log,

    enter image description here

    Edit

    If I try to download same video on a different computer this is the log I get,

    enter image description here

    Here is the link to playlist - https://www.youtube.com/playlist?list=PLF88E87B145457F95

    There is 100% something different on my computer :(

    • Daniel B
      Daniel B over 6 years
      Are you sure you’re using the same version of youtube-dl? They release updates a lot.
    • user2262511
      user2262511 over 6 years
      yes, using latest youtube-dl and just updated python on machine having problem, but it presists
  • user2262511
    user2262511 over 6 years
    Please see my edit
  • user2262511
    user2262511 over 6 years
    Please see my edit
  • Gyan
    Gyan over 6 years
    What's to see? The new log refers to a different video than the original (youtube.com/watch?v=3oWLX5ATXhM)
  • user2262511
    user2262511 over 6 years
    I know but I tried this one on 2 different computers on my computer the behaviour is consistent as explained in first picture :)
  • Cliff Armstrong
    Cliff Armstrong over 6 years
    Updated answer to account for additional info.
  • slhck
    slhck over 6 years
    Your answer is quite verbose but missing the point. The video and audio streams are served separately via MPEG-DASH (as indexed by the MPD manifest file). youtube-dl simply joins them into one container format so they can be played simultaneously.
  • slhck
    slhck over 6 years
    @user2262511 Your question does not show that. We have to assume that, based on your logs, you are comparing apples and oranges. If you can show the log from two different machines with the same version of youtube-dl and the same video being treated differently, then that'd be something to investigate.
  • Gyan
    Gyan over 6 years
    @slhck the original video doesn't offer 135. There may be an argument to fetch best available streams for a MP4 but I don't know it offhand.
  • slhck
    slhck over 6 years
    @Mulvya The first video from the playlist the OP linked to does offer 135, I just checked. Or maybe you were referring to the other video? Not aware of any option for best streams that limits to H.264 either.
  • slhck
    slhck over 6 years
  • slhck
    slhck over 6 years
    Would you mind if I edited your answer to explain a little more? The OP seems confused about why there's a conversion happening at all, and the suggestion to use these two particular (lower quality) format codes won't work in all cases – especially if you think of other folks arriving at this question asking themselves why youtube-dl is converting something.
  • Gyan
    Gyan over 6 years
    Ok. Go ahead,..