Kim Jin
Kim Jin

Reputation: 180

How to hardcode a MP4 stream file with iOS VideoToolbox and FFMPEG?

Guys!

I have found a demo in github that is :-VideoToolboxDemo. And I also found a question in stackoverflow how-to-use-videotoolbox-to-decompress-h-264-video-stream which someone has implemented in github:https:/ /github.com/lileilei1119/VTDemo

But there is a different between they in finding SPS and PPS.

The VideoToolboxDemo is:

uint8_t *data = pCodecCtx -> extradata;
int size = pCodecCtx -> extradata_size;

it uses extradata of pCodecCtx from FFMPEG to find start code like 0x00 00 01(or 0x00 00 00 01)

but the introduction in stackoverflow is:

[_h264Decoder decodeFrame:packet.data withSize:packet.size];

use data of packet?

I have try these two ways, but I still can't find start code of SPS and PPS. Does anyone know why? Is there something wrong in my file?

My mp4 file is http:/ /7u2m53.com1.z0.glb.clouddn.com/201601131107187320.mp4

Upvotes: 1

Views: 1523

Answers (1)

szatmary
szatmary

Reputation: 31110

Videotoolbox does not use annex b, hence does not produce a start code. Read more here. Possible Locations for Sequence/Picture Parameter Set(s) for H.264 Stream

Upvotes: 1

Related Questions