Nov-22-2019, 01:28 PM
Hello there.
I've got a problem with the python library "subprocess" and a ffprobe.
Environment:
OS - Ubuntu 18
RTSP link - rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov (The links fully working, I use ffprobe via a terminal and VLC player to test it)
Python 3.7.3 (default, Apr 3 2019, 19:16:38)
ffprobe version 3.4.6-0ubuntu0.18.04.1 Copyright © 2007-2019 the FFmpeg developers
My code:
'print('Process poll = ', process.poll())' always prints "Process poll = None"
But that code is working:
After the 6th repetition 'print('Process poll = ', process.poll())' prints "Process poll = 0"
The different is in the ffprobe parameter (row 8) - '-read_intervals %+#110' / '-read_intervals %+#120' ('-read_intervals %+#110' means - read 110 frames and exit)
In Ubuntu terminal both commands works correctly.
But in Python the first command doesn't works.
What am I doing wrong?
P.S.
Sorry for my English.
I hope it's not a ffprobe issue.
I've got a problem with the python library "subprocess" and a ffprobe.
Environment:
OS - Ubuntu 18
RTSP link - rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov (The links fully working, I use ffprobe via a terminal and VLC player to test it)
Python 3.7.3 (default, Apr 3 2019, 19:16:38)
ffprobe version 3.4.6-0ubuntu0.18.04.1 Copyright © 2007-2019 the FFmpeg developers
My code:
import subprocess import time import datetime command = ['ffprobe', '-rtsp_transport', 'tcp', '-i', 'rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov', '-show_frames', '-select_streams', 'v', '-read_intervals', '%+#120'] process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) count = 0 while count < 50: count += 1 print('\nProcess PID = ', process.pid) print('Process poll = ', process.poll()) print(datetime.datetime.now()) time.sleep(1)It doesn't work. The process doesn't terminate.
'print('Process poll = ', process.poll())' always prints "Process poll = None"
But that code is working:
import subprocess import time import datetime command = ['ffprobe', '-rtsp_transport', 'tcp', '-i', 'rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov', '-show_frames', '-select_streams', 'v', '-read_intervals', '%+#110'] process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) count = 0 while count < 50: count += 1 print('\nProcess PID = ', process.pid) print('Process poll = ', process.poll()) print(datetime.datetime.now()) time.sleep(1)It works correctly.
After the 6th repetition 'print('Process poll = ', process.poll())' prints "Process poll = 0"
The different is in the ffprobe parameter (row 8) - '-read_intervals %+#110' / '-read_intervals %+#120' ('-read_intervals %+#110' means - read 110 frames and exit)
In Ubuntu terminal both commands works correctly.
But in Python the first command doesn't works.
What am I doing wrong?
P.S.
Sorry for my English.
I hope it's not a ffprobe issue.