PyAV
PyAV copied to clipboard
Segmentation fault on rtmp stream
Hey, I am trying to use PyAV to open (listen for) rtmp stream. My code is:
import av
print("opening video...")
container = av.open("rtmp://127.0.0.1:12345", options={'listen': '1'})
print("running test")
for packet in container.demux():
for frame in packet.decode():
print("frame", frame)
and I stream to it with
ffmpeg -r 30 -f lavfi -i testsrc -vf scale=1280:960 -vcodec libx264 -profile:v baseline -pix_fmt yuv420p -f flv rtmp://127.0.0.1:12345
or OBS studio, does not matter. I always get:
opening video... Unexpected stream , expecting 127.0.0.1:12345 Unexpected stream , expecting 127.0.0.1:12345 Segmentation fault
At the same time when I use ffmpeg to open (listen for) stream with
ffmpeg -listen 1 -i rtmp:/127.0.0.1:12345 1.mp4
no errors happen, everything goes ok. ffmpeg is able to receive stream and save to 1,mp4