伙计们!
我在 github 中找到了一个演示:-VideoToolboxDemo。而且我还在stackoverflow how-to-use-videotoolbox-to-decompress-h-264-video-stream中发现了一个问题,有人在github中实现了这个问题:https://github.com/lileilei1119/VTDemo
但是他们在寻找 SPS 和 PPS 方面存在差异。
VideoToolboxDemo 是:
uint8_t *data = pCodecCtx -> extradata;
int size = pCodecCtx -> extradata_size;
它使用来自 FFMPEG 的 pCodecCtx 的额外数据来查找像 0x00 00 01(或 0x00 00 00 01)这样的起始代码
但是stackoverflow中的介绍是:
[_h264Decoder decodeFrame:packet.data withSize:packet.size];
使用数据包的数据?
这两种方法我都试过了,还是找不到SPS和PPS的起始码。有谁知道为什么?我的文件有问题吗?
我的 mp4 文件是 http://7u2m53.com1.z0.glb.clouddn.com/201601131107187320.mp4