If anyone is compiling their own version for use with IP video streams, here is a modification that adds to the av_read_frame() function a call to the avformat interrupt callback.
This effectively adds the ability to monitor the IP stream for unexpected termination.
The current implementation of av_read_frame() will hang if, for example, a human trips over a camera's cables and the stream abruptly terminates. Without modification to the API, this change to av_read_frame() calls the avformat interrupt callback each loop through av_read_frame()'s reading of packets. All the callback needs to do is look at the time, and signal error if the time between callbacks exceeds something reasonable.
I am not sure why, but this change was not accepted by the ffmpeg developers. I find it essential for working with IP video and IP video cameras.
https://gist.github.com/bsenftner/ba3d493fa36b0b201ffd995e8c...
This effectively adds the ability to monitor the IP stream for unexpected termination.
The current implementation of av_read_frame() will hang if, for example, a human trips over a camera's cables and the stream abruptly terminates. Without modification to the API, this change to av_read_frame() calls the avformat interrupt callback each loop through av_read_frame()'s reading of packets. All the callback needs to do is look at the time, and signal error if the time between callbacks exceeds something reasonable.
I am not sure why, but this change was not accepted by the ffmpeg developers. I find it essential for working with IP video and IP video cameras.