python – Interrupt stream while ffmpeg processing
I receive video from server like raw stream, then I take that to ffmpeg through pipe, but if downloading interrupt for few seconds, processing fail with message: ‘Invalid NAL unit siz’ and ‘missing picture in access’.
I want to do something like buffer, but I don’t know how to pause ffmpeg processing while I receive bytes from server and continue it from right place.
My ffmpeg command:
def writer():
for chunk in iter(partial(stream.read, 1024), b''):
process.stdin.write(chunk)
process = subprocess.Popen(('ffmpeg -i pipe: -f flv -codec copy -listen 1 '
'-flvflags no_duration_filesize '
'http://127.0.0.1:8080 -re '), stdin=subprocess.PIPE)
Read more here: Source link
