简体   繁体   English

iOS上的原始H264 NALU硬件解码

[英]Raw H264 NALU hardware decode on iOS

I receive raw H.264 NALUs from an IP camera (via Live555) and I want to decode them using hardware because FFmpeg is great but it's too slow (the camera sensor is large). 我从IP摄像机(通过Live555)接收原始的H.264 NALU,我想用硬件解码它们,因为FFmpeg很棒,但它太慢(相机传感器很大)。

The only solution I see is to write the NALUs to some movie container file such as MPEG-4, and then read and decode that file using an AVAssetReader . 我看到的唯一解决方案是将NALU写入某些电影容器文件(如MPEG-4),然后使用AVAssetReader读取和解码该文件。

Am I off in the weeds? 我在杂草中走了吗? Is anyone having success decoding H.264 NALUs from a stream? 是否有人成功解码了流中的H.264 NALU? Does anyone have any tips for writing NALUs to an MPEG-4 file? 有没有人有任何关于将NALU写入MPEG-4文件的技巧? Other ideas? 其他想法?

Like Matt mentioned, there is no direct access to Apple's H264 decoder. 像Matt提到的那样,没有直接访问Apple的H264解码器。

However, I have had success with ffmpeg and h264 decoding. 但是,我在ffmpeg和h264解码方面取得了成功。 Like you mentioned, I have built ffmpeg with LGPL I was able to decode H264 streams all the way to real-time HD stream with no latency on both ipad and iphone. 就像你提到的那样,我用LGPL构建了ffmpeg我能够将H264流一直解码为实时高清视频流,ipad和iphone都没有延迟。 Nothing fancy is required from ffmpeg, you can find bunch of standard decoding c++ code that will work just fine on iOS. ffmpeg不需要任何花哨的东西,你可以找到一堆标准的解码c ++代码,它们在iOS上运行得很好。 Also, in my case H264 NALUs were delivered via RTP/RTSP in real-time. 此外,在我的情况下,H264 NALU通过RTP / RTSP实时传送。

Also, if I was you I would run your app through xcode instruments to truly see where you bottleneck is, but I would be highly surprised it is in ffmpeg decoding step.. Hopefully this info helps. 此外,如果我是你,我会通过xcode仪器运行你的应用程序,以真正看到你的瓶颈在哪里,但我会非常惊讶它是在ffmpeg解码步骤..希望这个信息有帮助。

Unfortunately, you cannot do this at present. 不幸的是,你目前无法做到这一点。 Feel free to file a radar with Apple about wanting this sort of access to the hardware decoder. 随意向Apple提交有关想要对硬件解码器进行此类访问的雷达。 It'll certainly be resolved as a duplicate :-). 它肯定会被重复解决:-)。 I assume it is for licensing reasons why they can't give this sort of access to the hardware codec. 我认为这是出于许可的原因,为什么他们无法提供对硬件编解码器的这种访问。

So, you're going to have to use a software decoder. 所以,你将不得不使用软件解码器。 Please be aware that if you're going to ship to the App Store then you need something with a non-GPL license (unless you want to open source your app as well). 请注意,如果您要运送到App Store,那么您需要具有非GPL许可证的东西(除非您想要开源您的应用程序)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM