![]() If I try to convert using ffmpeg the MP4 file created using CODE: ffmpeg -i out.mp4 -vcodec copy out2.mp4įfmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developersĬonfiguration: -extra-cflags=-KPIC -g -disable-mmx If I take the H.264 data alone and convert it: ffmpeg -i recording.h264 -vcodec copy recording.mp4Īll but the "footer" of the files are the same. Send other frames except pps & sps which are caught and storedįinally to close the file off: av_write_trailer(oc) Pkt.size = dataLen + spsFrameLength + ppsFrameLength Įlse if (videoFrameType != 0圆7 & videoFrameType != 0圆8) SetLength(&videoFrame, ppsFrameLength-4) overwrite the start code (00 00 00 01 with a 32-bit length) Memcpy(&videoFrame, ppsFrame, ppsFrameLength) Memcpy(videoFrame, spsFrame, spsFrameLength) Unsigned char* videoFrame = new unsigned char ![]() combine the SPS PPS & I frames together If (videoFrameType = 0圆5 || videoFrameType = 0x41)ĭecodeIFrame(videoFrameNumber, spsFrame, spsFrameLength, ppsFrame, ppsFrameLength, data, dataLen) Memcpy(spsFrame, block->getData(), spsFrameLength) Memcpy(ppsFrame, block->getData(), ppsFrameLength) ĭelete spsFrame spsFrameLength = 0 spsFrame = NULL If (avio_open(&oc->pb, filename, AVIO_FLAG_WRITE) getData() ĭelete ppsFrame ppsFrameLength = 0 ppsFrame = NULL If (!(oc->oformat->flags & AVFMT_NOFILE)) ![]() VideoContext->flags |= CODEC_FLAG_GLOBAL_HEADER If (oc->oformat->flags & AVFMT_GLOBALHEADER) VideoContext->pix_fmt = decoder->pix_fmt VideoContext->gop_size = decoder->gop_size VideoContext->codec_id = decoder->codec_id VideoContext->codec_type = AVMEDIA_TYPE_VIDEO So when the first IFrame is encountered, I create the video stream and write the av header etc: void addVideoStream(AVCodecContext* decoder) Part of this prototype app I have is creating a png file for each IFrame. Init: AVOutputFormat* fmt = av_guess_format( 0, "out.mp4", 0 ) ![]() I suspect it has to be something with the way the stream is being created or something. I've done a binary comparison on the files and the issue seems to be somewhere in what is being written to the footer (trailer) of the MP4 file. There appear to be no errors in saving this H.264 Annex B data out to an MP4 file, but the file fails to playback. I am trying to mux H.264 data into a MP4 file.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |