H264 stream writing using AVAssetWriter issue
i am working on an application that receives the H264 stream from network and writes that stream to the MOV file. For writing to MOV I am using AVAssetWriter(with AVAssetWriterInput settings nil). Although I am able to dump and play the stream in MOV format using AVAsssetWriter in Quicktime, if the movie is seeked in QUicktime while playing the movie gets fully distorted until the next I frame occurs. With MOV files such behavior is not expected.
Also tried with specifying the AVAssetWriterInput settings to QuicktimeMovie, Width, Height, Bitrate. But this fails while writing from the first frame. Also observed that if raw frames are used instead of H264 stream and specify output settings, seeing is working correctly.
Also tried with specifying the following Attachments to CMSampleBuffer before giving it to AVAssetWriterInput. But still seeking is not proper with the MOV file.
kCMSampleAttachmentKey_IsDependedOnByOthers
for I frame and
kCMSampleAttachmentKey_DependsOnOthers
kCMSampleAttachmentKey_NotSync
for P frames
Please give suggestion on how to correct the seeking for MOV file using AVAssetWriter. I guess there is some sync frame offset table problem when using AVAssetWriter for already encoded H264 frames.
链接地址: http://www.djcxy.com/p/72040.html上一篇: AVAssetWriter不录制音频