aws/amazon-kinesis-video-streams-parser-library

Slow Decoding in H264FrameDecoder

Closed this issue · 4 comments

I am using the get media call to get a live playback of a 1920x1080 30FPS stream. Getting the data is fast but we are seeing a significant delay in decoding the fragments. Specifically in H264FrameDecoder.java decodeH264Frame()

Changing the source video resolution down to 1280x720 significantly reduces the delay in the decoding.

Is there anyway increase the performance of that decoder? Ideally we would like to keep the source stream at 1920x1080. Is there anyway to decode it at the lower resolution?

Thank You!

@ColbyMor the sample is based on the Java software decoder which is super-slow and inefficient. In a real application you might want to consider some sort of native decoder, ideally, based on hardware but that's out-of-scope for this project itself.

Indeed, increasing the resolution would increase the the decoding complexity. Similarly, the video encoder profiles and the quality values chosen would also have an impact on the decoding performance.

Decoding produces the same resolution bitmap. It's the job of a rasterizer (or as it's know in some platforms as bit-blitter or surface flinger) to resize the image for your actual screen/surface/canvas resolution.

Thank you for the reply!

I will start looking at the next steps for a native decoder. Any recommendations or aware of any libraries/players out there that would be a good starting point. We were looking at FFMPEG

FFMPEG is more of a media pipeline. You could use FFMPEG with some hardware decoder ideally. If you are running your solution on a generic backend instance then you are likely to use a software encoder. I believe FFMPEG comes with pre-packaged x264 encoder. There is also GStreamer which also has x264 encoder wrapper plugin.

I am going to resolve this issue as the main question seem to have been answered.