ffmpeg-python
ffmpeg-python copied to clipboard
Asyncio support
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.
@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
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.
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
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.
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