我想使用 Libav 将 .mkv 文件转换为 .mp4,但是当我尝试解码视频 h.264 流时,我的代码出现故障
无效的 NAL 单元大小 21274662>141
将输入拆分为 NAL 单元时出错
该流似乎包含 AVCC 额外数据,其中附件 B 格式的数据无效。无框!
无法发送数据包进行解码(“处理输入时出现错误无效数据”)
下面提供了相关的代码部分。
while(!(ret = av_read_frame(ifmt_ctx, &input_packet))&&(ret>=0)){
if ((ret = avcodec_send_packet(avctx, &input_packet)) < 0) {
fprintf(stderr, "Could not send packet for decoding (error '%s')\n",get_error_text(ret));
return ret;
}
ret = avcodec_receive_frame(avctx, iframe);
if (ret == AVERROR(EAGAIN)) {
goto read_another_frame;
/* If the end of the input file is reached, stop decoding. */
} else if (ret == AVERROR_EOF) {
break;
} else if (ret < 0) {
fprintf(stderr, "Could not decode frame (error '%s')\n",get_error_text(ret));
break;
}
// Default case: encode data
else {
}
Run Code Online (Sandbox Code Playgroud)
我主要使用新的 API(发送/接收数据包/帧),并且存在混乱,因为似乎 h.264 需要特殊的实现。我期待着从哪里开始调试的任何想法。
| 归档时间: |
|
| 查看次数: |
29413 次 |
| 最近记录: |