Skip to content

Asyncio support async/await #200

@akolpakov

Description

@akolpakov

Now I'm working on Asynchronous application. And using asyncio library which is built in python3. And uses async/await syntax.

Good to have possibility to return ffmpeg process as a coroutine and use it in a asyncio way.

For example:

process = await (
    ffmpeg
    .input('input.mp4')
    .output('pipe:', format='rawvideo', pix_fmt='rgb24')['v']
    .run_asyncio(pipe_stdout=True, quiet=False)
)

while True:
    frame_bytes = await process.stdout.read(video_frame_size)
    if len(frame_bytes) == 0:
        break

await process.wait()

It would be very handy for asynchronous applications.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions