[Libav-user] av_read_frame() hangup (no timeout)

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Libav-user] av_read_frame() hangup (no timeout)

Gonzalo Garramuño
I am implementing rtmp reading into my viewer and have run into the
unfortunate event that av_read_frame() hangs when reaching the end of
the video being sent over the protocol.  I was hoping it would return
AVERROR_EOF or a timeout error, but none of the sort seems to happen. 
Thus, my viewer just hangs at the end of the video.

I tested with ffplay and the same seems to happen there, where the
window close button becomes ineffective.

Is there any way around this?

_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: av_read_frame() hangup (no timeout)

Richard Hussong


On Thu, Nov 14, 2019 at 5:32 PM gga <[hidden email]> wrote:
I am implementing rtmp reading into my viewer and have run into the
unfortunate event that av_read_frame() hangs when reaching the end of
the video being sent over the protocol.  I was hoping it would return
AVERROR_EOF or a timeout error, but none of the sort seems to happen. 
Thus, my viewer just hangs at the end of the video.

I tested with ffplay and the same seems to happen there, where the
window close button becomes ineffective.

Is there any way around this?

It sounds like you need to implement your own timeout. You can do that by setting an interrupt callback in the input format context, and checking in the callback to see if the timeout interval has passed. Search for "interrupt_callback" in the documentation for AVFormatContext. It's very general, and won't give you specific help with timing out, but it isn't hard to construct a timeout for yourself.

- Richard

_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: av_read_frame() hangup (no timeout)

Blake Senftner


>I am implementing rtmp reading into my viewer and have run into the
>unfortunate event that av_read_frame() hangs when reaching the end of
>the video being sent over the protocol.  I was hoping it would return
>AVERROR_EOF or a timeout error, but none of the sort seems to happen. 
>Thus, my viewer just hangs at the end of the video.
>
>I tested with ffplay and the same seems to happen there, where the
>window close button becomes ineffective.
>

Please take a look at this:
https://ffmpeg.org/pipermail/libav-user/2017-February/010086.html

It is a 5 line addition to libavformat/utils.c that adds an av_read_frame() I/O callback.
I added this a few years ago to my local ffmpeg compile, tried to get it adopted by the official ffmpeg dev maintainers, but they felt it was (incorrectly, IMHO) too specific to streaming playback.
My company uses this av_read_frame()callback to identify when a network stream unexpectedly terminates, often caused by someone turning off or tripping over a security camera cable.


-Blake Senftner, geek.
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: av_read_frame() hangup (no timeout)

Gonzalo Garramuño
El 16/11/19 a las 17:51, [hidden email] escribió:

>> I am implementing rtmp reading into my viewer and have run into the
>> unfortunate event that av_read_frame() hangs when reaching the end of
>> the video being sent over the protocol.  I was hoping it would return
>> AVERROR_EOF or a timeout error, but none of the sort seems to happen.
>> Thus, my viewer just hangs at the end of the video.
>>
>> I tested with ffplay and the same seems to happen there, where the
>> window close button becomes ineffective.
>>
> Please take a look at this:
> https://ffmpeg.org/pipermail/libav-user/2017-February/010086.html
>
> It is a 5 line addition to libavformat/utils.c that adds an av_read_frame() I/O callback.
> I added this a few years ago to my local ffmpeg compile, tried to get it adopted by the official ffmpeg dev maintainers, but they felt it was (incorrectly, IMHO) too specific to streaming playback.
> My company uses this av_read_frame()callback to identify when a network stream unexpectedly terminates, often caused by someone turning off or tripping over a security camera cable.

Hi, Blake.

Your solution works like a charm and it is extremely simple.  It is a
pity that it was not adopted by the ffmpeg maintainers.

Very thankful,
Gonzalo

_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: av_read_frame() hangup (no timeout)

Paul B Mahol
In reply to this post by Blake Senftner
On 11/16/19, [hidden email] <[hidden email]> wrote:

>
>
>>I am implementing rtmp reading into my viewer and have run into the
>>unfortunate event that av_read_frame() hangs when reaching the end of
>>the video being sent over the protocol.  I was hoping it would return
>>AVERROR_EOF or a timeout error, but none of the sort seems to happen.
>>Thus, my viewer just hangs at the end of the video.
>>
>>I tested with ffplay and the same seems to happen there, where the
>>window close button becomes ineffective.
>>
>
> Please take a look at this:
> https://ffmpeg.org/pipermail/libav-user/2017-February/010086.html
>
> It is a 5 line addition to libavformat/utils.c that adds an av_read_frame()
> I/O callback.
> I added this a few years ago to my local ffmpeg compile, tried to get it
> adopted by the official ffmpeg dev maintainers, but they felt it was
> (incorrectly, IMHO) too specific to streaming playback.

Where is such statement?

> My company uses this av_read_frame()callback to identify when a network
> stream unexpectedly terminates, often caused by someone turning off or
> tripping over a security camera cable.
>
>
> -Blake Senftner, geek.
> _______________________________________________
> Libav-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/libav-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".