Skip to content

FFmpeg exits with failure but no exception is sent to after function #10324

@japaneseTemmie

Description

@japaneseTemmie

Summary

No exception is sent to after function even if ffmpeg died with a non-0 exit code.

Reproduction Steps

Play a source using discord.VoiceClient.play() and wait for ffmpeg to stop due to an internal error (e.g 403 / 404 from HLS source).

Minimal Reproducible Code

async def play_next() -> None:
    url = "url-string" # some code to get the url here

    await play_track(url)

async def play_track(url: str) -> None:
    source = discord.FFmpegPCMAudio(url)
    voice_client.play(source, after=lambda e: handle_playback_end(e))

def handle_playback_end(error):
    if error:
        # this doesn't get executed if ffmpeg exits with errors
        asyncio.run_coroutine_threadsafe(handle_player_crash(), client.loop)

    asyncio.run_coroutine_threadsafe(play_next(), client.loop)

Expected Results

discord.py should send an exception to the error parameter of the after function on all fatal ffmpeg failures (not just exit code 1)

Actual Results

FFmpeg crashes (stderr full of errors) with exit code 183 and error is None.

Intents

all

System Information

Latest stable version (2.6.4).

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

I'm unable to handle a bug due to this issue. discord.py with FFmpeg is a bit frustrating to work with.

Metadata

Metadata

Assignees

No one assigned

    Labels

    unconfirmed bugA bug report that needs triaging

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions