ffmpeg-python icon indicating copy to clipboard operation
ffmpeg-python copied to clipboard

Asyncio support

Open hdk5 opened this issue 5 years ago • 5 comments

This pull request is based on #201 and solves #200

I added compatibility with Python version prior to 3.4. These changes are also not compatible with not yet released Python 3.10, though.

hdk5 avatar Apr 30 '20 19:04 hdk5

@kkroening, this looks good to merge, no? Looks good from my testing and implements an important feature for anyone who wants to run ffmpeg as a coroutine in an asyncio application

tonycpsu avatar Feb 06 '21 18:02 tonycpsu

These changes are also not compatible with not yet released Python 3.10, though.

Just tried this on Python 3.10 and not noticing any issues. Would still love to see it included in the pip release so I don't have to keep pointing at a fork to make use of asyncio.

tonycpsu avatar Nov 06 '21 20:11 tonycpsu

Just tried this on Python 3.10 and not noticing any issues. Would still love to see it included in the pip release so I don't have to keep pointing at a fork to make use of asyncio.

Well, asyncio docs say:

Support for generator-based coroutines is deprecated and is scheduled for removal in Python 3.10.

and

Deprecated since version 3.8, removed in version 3.10: Use async def instead.

I think it is possible to add conditional import there, like:

if sys.version_info >= (3, 5):
    # import async-def based
elif sys.version_info >= (3, 4):
    # import asyncio.coroutine based

The proper solution in this day would be to drop python<3.5 support, but that's not for me to decide

hdk5 avatar Nov 07 '21 10:11 hdk5

This is sorely needed still -- alternatively you could add an additional argument to run, loop=None, and return a future if loop is not None. Then you wouldn't have to deal with Python version compatibility and you'd have to be explicit you want to use asyncio.

blakev avatar Dec 03 '21 17:12 blakev

whats the holdup on this, this is crucial for large workloads, python3.6 is EOL and no longer supported so this should be a no issue

rjy7wb avatar Sep 19 '22 01:09 rjy7wb