kkroening / ffmpeg-python

Python bindings for FFmpeg - with complex filtering support
Apache License 2.0
10k stars 886 forks source link

ffmpeg falls into zombie proccess while reading from rtsp #332

Open ccdsad opened 4 years ago

ccdsad commented 4 years ago

I trying to read rstp video stream to a pipe:

def get_input_stream(stream_name, width, height):
    cmd = 'ffmpeg -rtsp_transport tcp -loglevel fatal -max_delay 1000000'
    args = (
        ffmpeg
        .input(stream_name)
        .output('pipe:', format='rawvideo', pix_fmt='bgr24')
        .compile()
    )
    cmd = shlex.split(cmd) + args[1:]
    logger.info(f'Starting input stream "{stream_name}"')
    return subprocess.Popen(cmd, stdout=subprocess.PIPE)

It's generate this comand:

['ffmpeg', '-rtsp_transport', 'tcp', '-loglevel', 'fatal', '-max_delay', '1000000', '-i', 'rtsp://127.0.0.1:554', '-f', 'rawvideo', '-pix_fmt', 'bgr24', 'pipe:']

At first it works fine, but after a while ffmpeg falls into a zombie.

root          58  3.1  0.0      0     0 pts/0    Z+   12:57   0:42 [ffmpeg] <defunct>
bulingda commented 3 years ago

Have you solved the problem?