Discussion:
[Libav-user] Issues with avcodec_send_packet stalling
Omar Álvarez
2018-11-15 12:30:58 UTC
Permalink
I am trying to decode a h264 3Kx3K video file using NVDEC and ffmpeg 4.0.

I am having a problem when avcodec_receive_frame() returns AVERROR(EAGAIN),
and I try to get the next packet with avcodec_send_packet(). It sometimes
takes 40-60 ms to return, which is really slow and results in frame
stuttering.

I followed more or less the hardware decoding example.

What could be the cause of this? Did I make a mistake? Is AVERROR(EAGAIN)
common when using local video files?
Carl Eugen Hoyos
2018-11-17 14:16:48 UTC
Permalink
Post by Omar Álvarez
I am trying to decode a h264 3Kx3K video file using NVDEC and ffmpeg 4.0.
Please test current FFmpeg git head (and current drivers).

Carl Eugen
Omar Álvarez
2018-11-19 12:23:50 UTC
Permalink
First of all, thanks for the response.

I just tested git head and current drivers, and the problem persists.

My hardware:

Intel i5-6400
Nvidia GTX 1050

Right now, I am decoding more or less like this:

while
{
avcodec_send_packet()
while (more_frames)
{
avcodec_receive_frame()
if ( ret == AVERROR(EAGAIN) ) {
more_frames = false;
}
...
}
...
}

Is this the correct way? Is there anything that could be improved?

I thought about doing send_packet() in a different thread, but not sure if
it will improve anything. Because receive frame would still have to wait
for it to finish.

Anyway, any suggestions are appreciated. Thanks again!
Post by Carl Eugen Hoyos
Post by Omar Álvarez
I am trying to decode a h264 3Kx3K video file using NVDEC and ffmpeg 4.0.
Please test current FFmpeg git head (and current drivers).
Carl Eugen
_______________________________________________
Libav-user mailing list
http://ffmpeg.org/mailman/listinfo/libav-user
Carl Eugen Hoyos
2018-11-19 14:31:01 UTC
Permalink
Post by Omar Álvarez
I am trying to decode a h264 3Kx3K video file using NVDEC and ffmpeg 4.0.
I am having a problem when avcodec_receive_frame() returns AVERROR(EAGAIN),
and I try to get the next packet with avcodec_send_packet(). It sometimes
takes 40-60 ms to return, which is really slow and results in frame
stuttering.
I followed more or less the hardware decoding example.
What could be the cause of this? Did I make a mistake? Is AVERROR(EAGAIN)
common when using local video files?
For real-world files, I would expect that AVERROR(EAGAIN) is
common because if B-frames are used, you have a certain delay
(depending on encoding options).

Carl Eugen
Omar Álvarez
2018-11-19 17:16:24 UTC
Permalink
So the way I am decoding should be correct, if I am not mistaken.

Is there a way to get around my avcodec_send_packet() performance issues?
Can you pre-send packets or use an option to increase buffer size?
Post by Omar Álvarez
Post by Omar Álvarez
I am trying to decode a h264 3Kx3K video file using NVDEC and ffmpeg 4.0.
I am having a problem when avcodec_receive_frame() returns
AVERROR(EAGAIN),
Post by Omar Álvarez
and I try to get the next packet with avcodec_send_packet(). It sometimes
takes 40-60 ms to return, which is really slow and results in frame
stuttering.
I followed more or less the hardware decoding example.
What could be the cause of this? Did I make a mistake? Is AVERROR(EAGAIN)
common when using local video files?
For real-world files, I would expect that AVERROR(EAGAIN) is
common because if B-frames are used, you have a certain delay
(depending on encoding options).
Carl Eugen
_______________________________________________
Libav-user mailing list
http://ffmpeg.org/mailman/listinfo/libav-user
Loading...