0

Starting from 1080p resolution YouTube has separate audio and video tracks. In the following example youtube-dl considers 1280x720 stream (22) as the best because higher resolution video lacks audio track.

format code  extension  resolution note
249          webm       audio only DASH audio   51k , opus @ 50k (48000Hz), 709.40KiB
250          webm       audio only DASH audio   71k , opus @ 70k (48000Hz), 956.67KiB
171          webm       audio only DASH audio  112k , vorbis@128k (44100Hz), 1.49MiB
140          m4a        audio only DASH audio  127k , m4a_dash container, mp4a.40.2@128k (44100Hz), 1.74MiB
251          webm       audio only DASH audio  140k , opus @160k (48000Hz), 1.80MiB
278          webm       256x144    DASH video  104k , webm container, vp9, 30fps, video only, 1.32MiB
160          mp4        256x144    DASH video  116k , avc1.4d400c, 30fps, video only, 1.53MiB
242          webm       426x240    DASH video  255k , vp9, 30fps, video only, 3.04MiB
133          mp4        426x240    DASH video  256k , avc1.4d4015, 30fps, video only, 3.37MiB
243          webm       640x360    DASH video  490k , vp9, 30fps, video only, 5.57MiB
134          mp4        640x360    DASH video  645k , avc1.4d401e, 30fps, video only, 7.85MiB
244          webm       854x480    DASH video  910k , vp9, 30fps, video only, 10.19MiB
135          mp4        854x480    DASH video 1170k , avc1.4d401f, 30fps, video only, 14.50MiB
247          webm       1280x720   720p 1550k , vp9, 30fps, video only, 20.09MiB
136          mp4        1280x720   720p 2331k , avc1.4d401f, 30fps, video only, 27.85MiB
302          webm       1280x720   DASH video 2731k , vp9, 60fps, video only, 34.08MiB
248          webm       1920x1080  1080p 2819k , vp9, 30fps, video only, 35.25MiB
298          mp4        1280x720   DASH video 3483k , avc1.4d4020, 60fps, video only, 41.24MiB
137          mp4        1920x1080  1080p 4393k , avc1.640028, 30fps, video only, 50.39MiB
303          webm       1920x1080  DASH video 4488k , vp9, 60fps, video only, 56.82MiB
299          mp4        1920x1080  DASH video 5889k , avc1.64002a, 60fps, video only, 70.59MiB
271          webm       2560x1440  1440p 9105k , vp9, 30fps, video only, 110.54MiB
264          mp4        2560x1440  DASH video 9401k , avc1.640032, 30fps, video only, 101.08MiB
308          webm       2560x1440  DASH video 13802k , vp9, 60fps, video only, 157.70MiB
313          webm       3840x2160  2160p 18658k , vp9, 30fps, video only, 232.08MiB
266          mp4        3840x2160  DASH video 23285k , avc1.640033, 30fps, video only, 269.17MiB
315          webm       3840x2160  DASH video 27682k , vp9, 60fps, video only, 345.88MiB
17           3gp        176x144    small , mp4v.20.3,  mp4a.40.2@ 24k
36           3gp        320x180    small , mp4v.20.3,  mp4a.40.2
43           webm       640x360    medium , vp8.0,  vorbis@128k
18           mp4        640x360    medium , avc1.42001E,  mp4a.40.2@ 96k
22           mp4        1280x720   hd720 , avc1.64001F,  mp4a.40.2@192k (best)

Can the program "merge" audio and video? If not, can the process be automated with FFmpeg?

UPDATE: I have accidentally used youtube-dl -f best [URL] command when only youtube-dl [URL] is needed. FFmpeg does indeed merge the tracks by default

0
1

If you have ffmpeg/avconv installed it should merge them by default, but you can force it to merge them using -f bestvideo+bestaudio.

5
  • Without forcing, do I have to download both video and audio separately? – user598527 Feb 14 '17 at 20:49
  • @user598527 Yes, I think that's your only option. You can easily merge later with ffmpeg: ffmpeg -i <video> -i <audio> -c copy -map 0:v -map 1:a output.mkv – slhck Feb 14 '17 at 21:12
  • Yes, but you can add -f bestvideo+bestaudio/best to your configuration file to always use that option. – jaimeMF Feb 14 '17 at 22:51
  • @slhck: Is changing the file format necessary? – user598527 Feb 15 '17 at 11:57
  • 1
    @user598527 Not necessarily, but some codecs cannot be used in all containers. For example, VP9 video and Opus audio cannot be saved in MP4, whereas MKV can store more or less everything. – slhck Feb 15 '17 at 14:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.