-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Using RPI2 h264 decode frame delay #533
Comments
The fix in #232 will apply to Pi1 and Pi2. |
Mmm, running the latest but I see that I only get the port change event after the second frame. |
Are you passing in the correct flags (e.g. OMX_BUFFERFLAG_ENDOFFRAME)? |
Yes. |
I think you'll have to provide a small program that demonstrates the issue. |
O.k. let me come up with something. |
Actually, it looks like it might be specific to the bit stream. If I use the video_decode sample with buck bunny a similar thing happens where you only get the port change after 9 frames. |
I can see the buck bunny video has out of order frames, but the first I frame should push the decoder to output it immediately. Is there some reason why the decoder can't activate the port change after the first I frame ? |
What is your timing on presenting input frames? |
I'm using the default video_decode buffers which is 20 @ 80K. Also using the example hello_video app with buck bunny video seems to give similar behaviour where after a number of frames you get the port change event. If there's a reason why the hello_video app can't present after the first I frame ? it might help me understand my issue. |
hello_video plays a raw bitstream without framing. |
So I've added OMX_BUFFERFLAG_ENDOFFRAME to the hello_video app and used a sample of my h264 video, but I still see port changed after one I frame and two P frames. Which is the same symptoms I'm seeing in my standalone app. I'm setting CodedPicture too in the BrcmDataUnit. |
The decoder only starts to display frames once the DPB is full (or once reorder limits are hit); it needs to do this because there's nothing to stop an encoder from subsequently coding a frame that's earlier in display order. It does look ahead, so it doesn't need to have decoded subsequent frames all the way to pixels, but it at least needs to have seen the metadata at the start of the first slice of each subsequent picture that affects the DPB. In the case of Big Buck Bunny, there are lots of versions out there, but at least some use a large DPB; for such streams, you're not going to get a frame emitted (and thus the port change generated) until several frames in, once the DPB fills. |
Sorry for the delay on this. I've got a standalone app with sample h264 file. Do you need the source code as well ? |
Source would be the easiest way, as then we can tweak if we see something broken. |
Attached are binaries just to see the problem for now. After the SPS/PPS/SEI packets we get an IDR frame then two P frames, and it's only on the second which forces the video to show. I'm wondering if the SPS/PPS data has something that spawns this issue, but I'd need some guidance on what that is. Oh, it sleeps for 1 second after each frame. |
Anyone had chance to run the binary and see what happens ? |
Ping ? |
Source code at the ready. Just ping when you are ready. |
Sorry, been busy with other stuff. I'll take a look when I get a chance. |
O.k. I'll keep an eye on this thread when you reply. |
Any news, is there anything else I can do to move this along ? |
Don't worry, got it. |
For the sake of the curious, could you elaborate on the solution? |
@6by9 @popcornmix I tried to set num_reorder_frames=0 and max_dec_frame_buffering=1 in sps, append OMX_BUFFERFLAG_ENDOFFRAME and OMX_BUFFERFLAG_ENDOFNAL in buffer flag, add NAL delimator (9) or even add some meanless SEI after pps. None of them really work. The best result is, currently it always hold 1 single frame. That is, push IDR, push P, then get the first frame, and later always get the previous frame instead of the current frame which has just been pushed. This happens for several encoders: openh264, vaapi, etc. Those streams should be valid for no delay output (certainly, option for the encoders are carefully set for no delay output, e.g., B frame is forbidden) as many software decoders and arm SoC hardware decoders could generate immediate no delay result frame. Until, I got one mystery stream (maybe generated by x264 which I didn't test) which dramatically be able to be decoded without any delay. I modified the stream and removed some SEI and type 9 NAL, now it only contains 1 SPS/PPS and one leading IDR NAL. It could still be decoded without delay. I tried to carefully tune my test encoder to generate a stream which have similar SPS/PPS as it, but still have delay. Now I have 2 streams, both have 1 SPS/PPS and one single IDR NAL, both 1920x1080, both have num_reorder_frames=0 and max_dec_frame_buffering=1 in sps. But one can be decoded without delay, another can not. I think they are helpful to narrow this issue down. Could you help to point out what's the key difference and how can we forcely get frames decoded immediately? I upload the 2 test stream with only one IDR frame, and my test program in a zip, with the source code. The impact of different flag or IL configuration could be ruled out as 2 streams are tested with same program. delay.h264 -- stream with delay
I'm running on Raspbian GNU/Linux 8 \n \l with kernel Linux raspberrypi 4.9.34-v7+ |
I am experiencing the same issue on Raspeberry pi Zero-2 with bookworm O.S. (Linux bookworm-dev 6.1.0-rpi7-rpi-v7 #1 SMP Raspbian 1:6.1.63-1+rpt1 (2023-11-24) armv7l GNU/Linux). Thanks, |
Commenting on an issue that was closed 8 years ago is not going to get much response. This issue is related to the openmax api which has been deprecated for many years. |
Hi all,
Getting this exact problem on an RPI2.
#232
Wondering if a firmware bump was needed for the RPI2 as well ?
The text was updated successfully, but these errors were encountered: