python - Python Youtube-dl 转换为 mp4
问题描述
(如果重要的话,我在窗户上)
因此,我正在尝试下载带有音频的 Mp4 格式的 Youtube 视频(我放入的程序的兼容性有限),但无论我在网上找到什么都不能像人们所说的那样工作(让我相信它是过时、缺少上下文或用于不同的操作系统)或以没有意义的方式格式化。
我当前的代码是:
if PreferredOutput == 1:
with youtube_dl.YoutubeDL({'format' : 'bestvideo+bestaudio[ext=m4a]/bestvideo+bestaudio/best', 'merge-output-format' : 'mp4'}) as ydl:
ydl.download([url])
但是当我测试它时,它似乎只是正常输出文件。(我猜这是视频文件上传到 youtube 的格式,好像我可能弄错了)我应该做什么/我错过了只做这个输出(最终)Mp4s?(事实上ffmpeg转换或类似的东西对我来说很好)
解决方案
Add the below option to convert videos to mp4.
'postprocessors': [{
'key': 'FFmpegVideoConvertor',
'preferedformat': 'mp4'
}]
After downloading the video, it will get converted to mp4 and the original file will get deleted.
Note: The conversion of the video will take a lot of time.
推荐阅读
- ios - 在 Flutter iOS 中从 Firebase Firestore 访问数据时出错
- laravel - Laravel - 在插入新记录之前尝试删除旧记录
- r - 从 Shiny 中的选择输入中提取数字 id 值
- css - 使用 CSS Grid 将所有项目放在屏幕中央
- github - 致命的无法访问存储库 - 对等方重置 TCP 连接
- python - 如何从不同的模型上传一个或多个文件,而不是使用与 ModelSerializer 的外键关系存储它们的模型?
- php - 使用 mailto 链接,如何防止 Gmail 从 URL 的查询字符串中删除 = 符号及其后面的所有内容?
- java - 更新 Android Studio 后出现的错误
- pandas - Tensorflow 使用来自 Datarame 的“值”加载图像
- android - 重用布局和片段