【问题标题】:Why doesn't FFmpeg work when using yt-dlp in python script?为什么在 python 脚本中使用 yt-dlp 时 FFmpeg 不起作用?
【发布时间】:2022-05-12 07:11:38
【问题描述】:

我正在尝试在 python 中使用 yt-dlp 下载视频。

ydl_opts = {'format': 'bv+ba/b'}
with YoutubeDL(ydl_opts) as ydl:
     ydl.download('https://www.reddit.com/r/cats/comments/re37dn/weve_been_feeding_this_stray_for_several_years/')

但我在日志中遇到 FFmpeg 错误

[generic] 1o8t9ollwx481: Requesting header
[redirect] Following redirect to https://www.reddit.com/r/cats/comments/re37dn/weve_been_feeding_this_stray_for_several_years/
[Reddit] re37dn: Downloading JSON metadata
[Reddit] re37dn: Downloading m3u8 information
[Reddit] re37dn: Downloading MPD manifest
[info] 1o8t9ollwx481: Downloading 1 format(s): dash-video_4419291+dash-audio_0_133951
WARNING: You have requested merging of multiple formats but ffmpeg is not installed. The formats won't be merged.
[download] Destination: We’ve been feeding this stray for several years, but she’s lost a lot of weight and I don’t think she would last outside for another winter, so I brought her in. [1o8t9ollwx481].fdash-video_4419291.mp4
[download] 100% of 5.18MiB in 00:00               
[download] Destination: We’ve been feeding this stray for several years, but she’s lost a lot of weight and I don’t think she would last outside for another winter, so I brought her in. [1o8t9ollwx481].fdash-audio_0_133951.m4a
[download] 100% of 161.32KiB in 00:00

FFmpeg 通过 pip 安装并添加到 PATH 中。

【问题讨论】:

  • ffmpeg 不会通过 pip 安装。它不是 python 模块。关于如何在此处进行 dl 的说明:ffmpeg.org/download.html
  • 我已经通过官网下载并添加了FFpeg到PATH,遗憾的是没有解决问题。 @mechinal_meat
  • 好的,但您至少收到了不同的错误消息吗?你能从你的命令行成功调用 ffmpeg 吗?
  • 是的,ffmpeg 在命令行中运行良好

标签: python ffmpeg


【解决方案1】:

同样的错误信息,然后我意识到我的 yt-dlp 是通过 snap 安装的。所以我只是从 snap 中删除它,然后从 pip 安装它。现在一切正常。

【讨论】:

    猜你喜欢
    • 2021-12-20
    • 1970-01-01
    • 2023-02-21
    • 2021-12-18
    • 1970-01-01
    • 2017-05-30
    • 2013-05-23
    • 1970-01-01
    • 2013-11-18
    相关资源
    最近更新 更多