iOS硬编码的h264流,用ffmpeg解不出来?

AVMedia2010 2016-05-05 10:39:16
每个nalu已经手动加上00 00 00 01的起止符了
用x264编码出来的是可以解出来的

Format h264 detected only with low score of 1, misdetection possible!
[h264 @ 0x7fda49000400] sps_id 0 out of range
[h264 @ 0x7fda49000400] non-existing PPS 0 referenced
[h264 @ 0x7fda49000400] sps_id 0 out of range
[h264 @ 0x7fda49000400] non-existing PPS 0 referenced
[h264 @ 0x7fda49000400] decode_slice_header error
[h264 @ 0x7fda49000400] no frame!
[h264 @ 0x7fda49000400] non-existing PPS 0 referenced
...全文
3771 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
yuedongdong521 2019-03-04
  • 打赏
  • 举报
回复
请问楼主输出 buffer 写小了是什么意思?是编码写小了还是解码小写了?
firefly09999999 2017-01-17
  • 打赏
  • 举报
回复
楼主能不能发个例子给我啊?多谢啦。。。。1870327941@qq.com
AVMedia2010 2016-05-16
  • 打赏
  • 举报
回复
可以解的,犯了个低级错误,demo里输出buffer写小了,导致出错。。。
twtldn 2016-05-09
  • 打赏
  • 举报
回复
跟编码有关了,如果是用ffmpeg编码的,直接编码出来h264文件的话应该是带了sps和pps的,不需要手动加,但是如果是mp4、flv之类的格式是不带的。编码时候设置pOutVideoStream->codec->flags |= CODEC_FLAG_GLOBAL_HEADER来控制加不加头信息。
AVMedia2010 2016-05-05
  • 打赏
  • 举报
回复
谢谢sharkka 回复。 PPS 和SPS貌似是有的,只是解不出来 if (keyframe) { CMFormatDescriptionRef format = CMSampleBufferGetFormatDescription(sampleBuffer); size_t sparameterSetSize, sparameterSetCount; const uint8_t *sparameterSet; OSStatus statusCode = CMVideoFormatDescriptionGetH264ParameterSetAtIndex(format, 0, &sparameterSet, &sparameterSetSize, &sparameterSetCount, 0 ); if (statusCode == noErr) { size_t pparameterSetSize, pparameterSetCount; const uint8_t *pparameterSet; OSStatus statusCode = CMVideoFormatDescriptionGetH264ParameterSetAtIndex(format, 1, &pparameterSet, &pparameterSetSize, &pparameterSetCount, 0 ); if (statusCode == noErr) { encoder->sps = [NSData dataWithBytes:sparameterSet length:sparameterSetSize]; encoder->pps = [NSData dataWithBytes:pparameterSet length:pparameterSetSize]; if (encoder->_delegate) { [encoder->_delegate gotSpsPps:encoder->sps pps:encoder->pps]; } } } }
AVMedia2010 2016-05-05
  • 打赏
  • 举报
回复
这个码流直接用VideoToolbox里的解码器是可以硬解的
百灵工作室 2016-05-05
  • 打赏
  • 举报
回复
硬编有没有编码参数,比如关于pps,sps的设置,gop设置的是否正确 Flag indicating whether VPS, SPS and PPS headers should be output with * each keyframe. Default false 这个flag设置的是否是true over 珍重

2,542

社区成员

发帖
与我相关
我的任务
社区描述
专题开发/技术/项目 多媒体/流媒体开发
社区管理员
  • 多媒体/流媒体开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧