question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Youtube-dl downloads two formats of same video

See original GitHub issue

Checklist

  • [X ] I’m reporting a broken site support issue
  • [X ] I’ve verified that I’m running youtube-dl version 2021.06.06
  • [X ] I’ve checked that all provided URLs are alive and playable in a browser
  • [X ] I’ve checked that all URLs and arguments with special characters are properly quoted or escaped
  • [X ] I’ve searched the bugtracker for similar bug reports including closed ones
  • [X ] I’ve read bugs section in FAQ

Verbose log

Below is the command I run when I want to download a few videos,

while ! youtube-dl --verbose -a 11ú\ Méan\ Fómhair.txt -c --socket-timeout 5; do echo DISCONNECTED; sleep 5; done                                               

Usually, I go to my YT subscriptions & copy the URLs of the videos I want to watch and save them in a text file, then I execute the above command that reconnects if I get disconnected until all videos are downloaded.

Below is a verbose log of a download

 

 ~/Íosluchtuithe  while ! youtube-dl --verbose -a 11ú\ Méan\ Fómhair.txt -c --socket-timeout 5; do echo DISCONNECTED; sleep 5; done                             INT х  took 14s  at 14:23:43 
[debug] System config: []
[debug] User config: ['-o', '~/Físeáin/Íosluchtuithe/%(title)s.%(ext)s', '-f', 'bestvideo[height<=1080]+bestaudio/best[height<=1080]']
[debug] Custom config: []
[debug] Command-line args: ['--verbose', '-a', '11ú Méan Fómhair.txt', '-c', '--socket-timeout', '5']
[debug] Batch file urls: ['https://www.youtube.com/watch?v=M576WGiDBdQ']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.06.06
[debug] Python version 3.9.5 (CPython) - Linux-5.14.2-051402-generic-x86_64-with-glibc2.33
[debug] exe versions: ffmpeg 4.3.2-0, ffprobe 4.3.2-0, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] M576WGiDBdQ: Downloading webpage
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[debug] Invoking downloader on 'https://r3---sn-xpgjvh-q0cd.googlevideo.com/videoplayback?expire=1631388257&ei=Aa48YY6jGM3N0wXq96TICQ&ip=212.129.73.154&id=o-AFuzzycGCjhFnTckAwhY94b-2x6ynjOvT538f-_K5iwP&itag=299&aitags=133%2C134%2C135%2C136%2C160%2C242%2C243%2C244%2C247%2C278%2C298%2C299%2C302%2C303&source=youtube&requiressl=yes&mh=_P&mm=31%2C29&mn=sn-xpgjvh-q0cd%2Csn-q0c7rn76&ms=au%2Crdu&mv=m&mvi=3&pl=21&initcwndbps=427500&vprv=1&mime=video%2Fmp4&ns=NumSxER5_Rmo8vsJm0QL9iQG&gir=yes&clen=4578203069&dur=58931.058&lmt=1631088374895899&mt=1631366234&fvip=3&keepalive=yes&fexp=24001373%2C24007246&beids=9466587&c=WEB&txp=6316222&n=pwmb1J-n0NrToZqN&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRAIgElonSXu7JRakC_C2F_CinRGvNna6U1kC2XVCgWQLsX8CIBq76qVmKtXTdbz8LZGwfV5QhBTBudp4mnvx7jKzzLTR&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhAM28EVV2D8kL-PjpVXOx5KPx_KGI9vVlPnkCakZ5L_RtAiEArpyhwAP3_YrtRl8rSuZkxtwRgIhFw5jevMCwagUEEXI%3D'
[download] Destination: /home/aindriu/Físeáin/Íosluchtuithe/Solidity, Blockchain, and Smart Contract Course – Beginner to Expert Python Tutorial.f299.mp4
[download]   0.0% of 4.26GiB at 79.51KiB/s ETA 15:37:13^C
ERROR: Interrupted by user
DISCONNECTED
^C%                                                                                                                                                                                            ~/Íosluchtuithe  

The following is the config file of youtube-dl

# Always extract audio
# -x

# Do not copy the mtime
# --no-mtime

# Use this proxy
# --proxy 127.0.0.1:3128

# Save all videos under Movies directory in your home directory
 -o ~/Físeáin/Íosluchtuithe/%(title)s.%(ext)s

# Specifiying the quality of video
-f 'bestvideo[height<=1080]+bestaudio/best[height<=1080]'

Description

I am having an issue with youtube-dl downloading both .MP4 and .MKV formats of the same video. See the image below :

https://i.imgur.com/DrKPvaK.png

How can I force youtube-dl to either download either .MP4 OR .MKV? You can see with big files it’s really frustrating

Is there somehow I can specify to download either MP4 or MKV?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
aindriu80commented, Sep 13, 2021

But some YouTube videos have better sound than video, would you not be lowering the quality?

I only specified the resolution to 1080p the rest is default bestvideo bestaudio/best :S

# Specifiying the quality of video
-f 'bestvideo[height<=1080]+bestaudio/best[height<=1080]'
1reaction
dirkfcommented, Sep 10, 2021

Do feel free to

PASTE VERBOSE LOG HERE

if you would like assistance.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using youtube-dl to download multiple formats? : r/DataHoarder
Im trying to download a youtube channel that has a mix of 720p and 1080p videos using youtube-dl. Is there any way to...
Read more >
Downloading multiple files with youtube-dl - Ask Ubuntu
Videos not in the same playlist or channel. First create a batch file which is a text file containing a list of URLs...
Read more >
How to download multiple formats using youtube-dl
How to download the video and audio with specified format together rather than issuing youtube-dl multiple times one for downloading video ...
Read more >
Specify multiple format options, use the first available for each ...
This will download the video(s) in either format 22, 18 or 17, choosing the first format from the list available for each video....
Read more >
Why youtube-dl is converting my downloaded video to a ...
MP4 is a container format capable of containing many different video and audio formats. WebM is the same. MKV takes that to infinity...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found