【问题标题】:ffmpeg error that causes songs to be skipped in discord.py music bot导致在 discord.py 音乐机器人中跳过歌曲的 ffmpeg 错误
【发布时间】:2022-09-29 02:49:04
【问题描述】:

我正在用 python 制作一个音乐机器人。有时在播放音乐时,可能会出现这样的错误

[tls @ 0x56540863c280] Error in the pull function.
[matroska,webm @ 0x565408639460] Read error
[tls @ 0x56540863c280] The specified session has been invalidated for some reason.
[https @ 0x55ef3042ae80] HTTP error 403 Forbidden
https://rr5---sn-qxoedne7.googlevideo.com/videoplayback?expire=1643908737&ei=ILr7YYvvOfeA_tcP1P-O6AE&ip=34.70.213.61&id=o-AP2Y_3KL9ByYzaHpK9BTYU-rXEdyhVBdmAya4-RDcnhA&itag=249&source=youtube&requiressl=yes&mh=up&mm=31%2C26&mn=sn-qxoedne7%2Csn-5goeen7d&ms=au%2Conr&mv=u&mvi=5&pl=20&vprv=1&mime=audio%2Fwebm&ns=R7IIdhU6N1T67hOi5mk4h1gG&gir=yes&clen=1237668&dur=200.101&lmt=1643350535759614&mt=1643886547&fvip=4&keepalive=yes&fexp=24001373%2C24007246&c=WEB&txp=5432434&n=f5o7FLev4k11Jt4&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl&lsig=AG3C_xAwRQIhAI7fuWyVPY7zdiGm2FemrcqsDuQWjcqfSnLKxw66QoSwAiBOJHGVpoRCKu2ZnW3DPGxK8bKS-FfvyyxG2hRgg2TRVw%3D%3D&sig=AOq0QJ8wRQIgOWU5ecufOjhtuwQNdWX5l140N5cW7Hu01SfC9b6Zkg4CIQC0ZzrrXwUtf4qkvWZaQCEfWpOmZJhBmca0sYqqmxh75A==: Server returned 403 Forbidden (access denied)
[dash @ 0x5596ac7e6460] Could not read complete fragment.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5596acb12940] Stream #0: not enough frames to estimate rate; consider increasing probesize
[dash @ 0x5596ac7e6460] Could not read complete fragment.

一段启动歌曲的代码:

YDL_OPTIONS = {\'format\': \'bestaudio/best\',\'outtmpl\': \'%(extractor)s-%(id)s-%(title)s.%(ext)s\',\'restrictfilenames\': True,\'noplaylist\': True,\'nocheckcertificate\': True,\'ignoreerrors\': False,\'logtostderr\': False,\'quiet\': True,\'no_warnings\': True, \'forceipv4\': True,\'cookies\': True, \'default_search\': \'auto\',\'encoding\': \'utf-8\', \"simulate\": True, \'audioformat\': \"mp3\",\'audioquality\': 5,\'source_address\': \'0.0.0.0\',\"bitrate\": 320000,\"prefer_ffmpeg\": True,\"usenetrc\": True,\"verbose\": False}
FFMPEG_OPTIONS = {\'options\': \'-vn\'}
vc.play(discord.FFmpegPCMAudio( source = URL, **FFMPEG_OPTIONS))
vc.source = discord.PCMVolumeTransformer(vc.source)
vc.source.volume = 1

如何捕获这些错误或如何修复它们?

    标签: python ffmpeg discord.py


    【解决方案1】:

    选项之前的ffmpeg应该是:

    before_options='-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5'
    

    【讨论】:

      猜你喜欢
      • 2020-08-31
      • 2021-04-29
      • 2021-05-05
      • 1970-01-01
      • 2021-05-24
      • 2021-09-19
      • 1970-01-01
      • 1970-01-01
      • 2020-06-27
      相关资源
      最近更新 更多