How to concat multiple audio inputs without using files
Thank you for this wonderful library! I am wondering how I can translate the code below to be able to concatenate multiple opus audio files using the `BytesIO` API.
In this contrived example I am reading files off disk, but in reality I am reading files from S3. I am trying to avoid any intermediate writes to disk and instead just stream directly to ffmpeg. Is this possible?
```py
from pathlib import Path
import ffmpeg
input = Path.cwd().joinpath("input.txt")
with input.open("w") as f:
for i, obj in enumerate(Path.cwd().glob("recording*.webm")):
content = Path.cwd().joinpath(f"input-{i}.webm")
content.write_bytes(obj.read_bytes())
f.write(f"file '{content}'\n")
output = Path.cwd().joinpath("combined.webm")
ffmpeg.input(str(input), format="concat", safe=0).output(str(output), c="copy").run()
```
0 条评论