ffmpeg – What causes ‘Error number -10054’ while listening to an RTMP stream using PyAV in Python?

When I use PyAV to listen a rtmp stream

import av,cv2
container = av.open('rtmp://localhost:1935/stream/live',options={'listen': '1'})
for frame in container.decode(video=0):
    frame = frame.to_ndarray(format="bgr24")
    cv2.imshow('live',frame)
    cv2.waitKey(1)

I use this ffmpeg command to push stream:

ffmpeg -re -i "live.flv" -c copy -f flv "rtmp://localhost:1935/stream/live"

ffmpeg exited with this error:

av_interleaved_write_frame(): Error number -10054 occurred0 bitrate=4616.8kbits/s speed=0.993x
[out#0/flv @ 000001d329ad9ac0] Error muxing a packet
[flv @ 000001d32bfaf040] Failed to update header with correct duration.6.9kbits/s speed=0.997x
[flv @ 000001d32bfaf040] Failed to update header with correct filesize.
[out#0/flv @ 000001d329ad9ac0] Error writing trailer: Error number -10054 occurred
[out#0/flv @ 000001d329ad9ac0] Error closing file: Error number -10054 occurred
[out#0/flv @ 000001d329ad9ac0] video:1293kB audio:49kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.030142%
frame=  151 fps= 60 q=-1.0 Lsize=    1342kB time=00:00:02.51 bitrate=4366.9kbits/s speed=0.996x
Conversion failed!

and python exited without any error.

I tried OBS to push the stream,but I got the same result

This may be a problem with PyAV

Read more here: Source link