Hello,
I'm trying to turn a Windows batch file using the youtube-dlp.exe binary to a Python script. They're such a pain over there in the issues section that I'd rather ask elsewhere.
Although I kept the "ext:mp4" bit, for some reason, the following script downloads the file as .webm instead of .mp4.
Any idea why?
Thank you.
Code:import yt_dlp yt_opts = { 'extractor-args': 'youtube:lang=fr', 'S':'width:640,ext:mp4,lang:fr-FR', 'trim-filenames':'128', 'compat':'filename-sanitization', 'console-title':'', 'progress':'', 'progress-template':'%(progress._percent_str)s', } with yt_dlp.YoutubeDL(yt_opts) as ydl: ydl.download("https://www.youtube.com/watch?v=fHT2CtiEAhM")
Support our site by donate $5 directly to us Thanks!!!
Try StreamFab Downloader and download streaming video from Netflix, Amazon!
Try StreamFab Downloader and download streaming video from Netflix, Amazon!
		
			+ Reply to Thread
			
		
		
		
			
	
	
				Results 1 to 8 of 8
			
		- 
	
- 
	Don't know about Python.. and I'm not sure if this is the YT_DLP you're talking : https://github.com/yt-dlp/yt-dlp 
 
 To download a video in a specific format using the command-line in YT-DLP you need to use the --format parameter (also -f ).. in your case YT_DLP.exe --format mp4 <url of the video>
- 
	Yes, it works with the CLI, but not in Python, hence my question here. 
- 
	I also can not help with Python. 
 I use command line.
 Here is what I use:
 I start with
 I tried the largest files first but some of those were "Forbidden".Code:yt-dlp --list-formats https://www.youtube.com/watch?v=fHT2CtiEAhM 
 There are the largest size numbers that worked:
 This also worked but the file size was much smaller:Code:yt-dlp -f 140+137 https://www.youtube.com/watch?v=fHT2CtiEAhM 
 I hope there is a way you can use these with Python.Code:yt-dlp -f ba*+bv* yt-dlp1 https://www.youtube.com/watch?v=fHT2CtiEAhM 
- 
	
- 
	Because you need to specify the extension. This should work: 
 You can also force the H.264/AVC codec:Code:yt-dlp -f bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4] https://www.youtube.com/watch?v=xxxxxxxxxxx 
 Code:yt-dlp -f bestvideo[ext=mp4][vcodec^=avc1]+bestaudio[ext=m4a]/best[ext=mp4] https://www.youtube.com/watch?v=xxxxxxxxxxx 
Similar Threads
- 
  Yt-dlp: embedding subtitles and remuxing video QuestionBy doctorm in forum Video Streaming DownloadingReplies: 0Last Post: 20th May 2025, 18:02
- 
  Download youtube with yt-dlpBy axnspain in forum Video Streaming DownloadingReplies: 8Last Post: 1st Apr 2025, 10:32
- 
  youtube's maybe new webm download is not working withgom player v5270-ishBy sommers in forum Newbie / General discussionsReplies: 0Last Post: 26th Nov 2024, 20:22
- 
  how to download SRT files from youtube video with yt-dlp please?By inklara in forum Video Streaming DownloadingReplies: 5Last Post: 10th Jun 2022, 09:50
- 
  Youtube-dl and Youtube-dlp no longer work with nbc. Help with dl this link?By PennyHartz in forum Video Streaming DownloadingReplies: 27Last Post: 30th Dec 2021, 02:59


 
		
		 View Profile
				View Profile
			 View Forum Posts
				View Forum Posts
			 Private Message
				Private Message
			 
 
			
			
 Quote
 Quote

 
 
			
			