Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example api2-decode fail #127

Open
ywangwxd opened this issue Dec 27, 2023 · 9 comments
Open

example api2-decode fail #127

ywangwxd opened this issue Dec 27, 2023 · 9 comments

Comments

@ywangwxd
Copy link

I compiled ffmpeg with rockchip mpp. I have tested ffmpeg command to transcode a rtsp stream to a video file, it is working well.
But if I use api2-decode or api2-decode-encode-video, neither of them success.

This is the final part of the screen message. It seems that the decoder get many empty frame. The final error is hard to understand.


Read packet: 58410*1/90000 / 0.649 / 1/90000 / st: 0
[hevc_rkmpp_decoder @ 0x55c18e25e0] Received a frame.
  Frame: 3840x2160, size=27372544, ts=9000*1/90000, tm: 0.1, tb: 1/90000, ref=1:1
Read packet: 62910*1/90000 / 0.699 / 1/90000 / st: 0
[hevc_rkmpp_decoder @ 0x55c18e25e0] Wrote 18189 bytes to decoder
[hevc_rkmpp_decoder @ 0x55c18e25e0] Received a frame.
  Frame: 3840x2160, size=27372544, ts=13500*1/90000, tm: 0.15, tb: 1/90000, ref=1:1
Read packet: 67410*1/90000 / 0.749 / 1/90000 / st: 0
[hevc_rkmpp_decoder @ 0x55c18e25e0] Received a frame.
  Frame: 3840x2160, size=27372544, ts=18000*1/90000, tm: 0.2, tb: 1/90000, ref=1:1
Read packet: 71910*1/90000 / 0.799 / 1/90000 / st: 0
**Error: FFmpegError:-11, Resource temporarily unavailable**
@mmomtchev
Copy link
Contributor

Are you using the latest release or a git checkout? I fixed a number of small problems related to these examples very recently. Try compiling a vanilla ffmpeg 6.1 and try transcoding file to file, if this doesn't work, then there is a problem.

@h4tr3d
Copy link
Owner

h4tr3d commented Dec 29, 2023

'-11' means EAGAIN. You can try to make access again, something like:

if (ec) {
  if (ec == av::make_ffmpeg_condition(-EGAIN)) {
    continue;
  }
  ...
}

@ywangwxd
Copy link
Author

I git pull the latest commit from the master branch. The last commit is Dec 21.
As I said, if I use ffmpeg command line to transcoe, it is working. Does this mean there is no problem with
the rockchip-mpp backend?

Are you using the latest release or a git checkout? I fixed a number of small problems related to these examples very recently. Try compiling a vanilla ffmpeg 6.1 and try transcoding file to file, if this doesn't work, then there is a problem.

@h4tr3d
Copy link
Owner

h4tr3d commented Dec 29, 2023

Are you sure, I found return code <0 is error in the document.

In common way - you are right. But there is cases, when, for example, data is not ready yet but system work properly and you should just a wait a little. EBUSY, EAGAIN just a way say it.

In any case, HW can just stuck and maybe some proper configuration is needed in additional to generic SW setup.

@ywangwxd
Copy link
Author

Are you sure, I found return code <0 is error in the document.

In common way - you are right. But there is cases, when, for example, data is not ready yet but system work properly and you should just a wait a little. EBUSY, EAGAIN just a way say it.

In any case, HW can just stuck and maybe some proper configuration is needed in additional to generic SW setup.

The original code is something like this


while (Packet pkt = ictx.readPacket(ec)) {
//some other code here
VideoFrame frame = vdec.decode(pkt, ec);
//some other code here
}

You mean I should do a while in the while? eg, do a while loop after each packet or do it on the read packet & decode together?

@ywangwxd
Copy link
Author

Are you sure, I found return code <0 is error in the document.

In common way - you are right. But there is cases, when, for example, data is not ready yet but system work properly and you should just a wait a little. EBUSY, EAGAIN just a way say it.
In any case, HW can just stuck and maybe some proper configuration is needed in additional to generic SW setup.

The original code is something like this


while (Packet pkt = ictx.readPacket(ec)) {
//some other code here
VideoFrame frame = vdec.decode(pkt, ec);
//some other code here
}

You mean I should do a while in the while? eg, do a while loop after each packet or do it on the read packet & decode together?

I have tried doing a for loop on VideoFrame frame = vdec.decode(pkt, ec); but it never stops after get -11 return value.

@ywangwxd
Copy link
Author

Are you sure, I found return code <0 is error in the document.

In common way - you are right. But there is cases, when, for example, data is not ready yet but system work properly and you should just a wait a little. EBUSY, EAGAIN just a way say it.
In any case, HW can just stuck and maybe some proper configuration is needed in additional to generic SW setup.

The original code is something like this


while (Packet pkt = ictx.readPacket(ec)) {
//some other code here
VideoFrame frame = vdec.decode(pkt, ec);
//some other code here
}

You mean I should do a while in the while? eg, do a while loop after each packet or do it on the read packet & decode together?

Neither of the two approaches work. But if I use ffmpeg command line to do anything, decode or transcode. It is working.
With the vallina ffmpeg compiled, this is no problem.

@ywangwxd
Copy link
Author

An update again. I have tried the example code of decode_video.c in the official ffmpeg repo under /doc/examples.
This example program is working with ffmpeg-mpp. So it is highly possible that there is some problem with api2-decode here.

@h4tr3d
Copy link
Owner

h4tr3d commented Mar 9, 2024

@ywangwxd , could you please send me a sample of the problematic video? Also, issue are mpp related only? Does video successfully processed by the software decoder?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants