-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FFmpegWriter.release() does not wait for ffmpeg process completion #31
Comments
This is because |
Workaround found:
|
Sorry for replying late. I agree with you that there is a bug of video release. Very thanks for your pointing it out.
To fix that bug, it's not a good idea to use I believe the bug matters in specifical cases, however I didn't meet the bug in most my cases. In my opinion, I would add a |
I would appreciate if you can create a |
Yes, you right: psutil is not supported on ARM64 (giampaolo/psutil#1782), so the most desired fix would be to get rid of psutil. BTW, why don't you use subprocess.Popen? (https://docs.python.org/3/library/subprocess.html) |
I do use #ffmpegcv/video_info.py
import subprocess
from subprocess import Popen, PIPE
...
def run_async(args):
quiet = True
stderr_stream = subprocess.DEVNULL if quiet else None
bufsize = -1
return Popen(
args,
stdin=PIPE,
stdout=PIPE,
stderr=stderr_stream,
shell=isinstance(args, str),
bufsize=bufsize,
) |
This is nother important issue for me. What is the current status? |
This causes race condition, when video file is still being written by running ffmpeg process while
FFmpegWriter
object is released.Details:
run_async()
invideo_info.py
actually returns the PID of the shell, not the PID of ffmpeg process.So
release_process()
waits for shell process completion, not ffmpeg process completion.On some environments (like in Google Colab) it takes quite a while for ffmpeg to finish.
The following code demonstrates the problem:
The sample output is like this:
As you can see, the writer.process.pid == 25371, which corresponds to
pid=25371, name='sh'
, not ffmpeg.The text was updated successfully, but these errors were encountered: