[Libav-user] Decoding mpeg4 has delay in 3.1.1 (3.0 works correctly)

Hwangho Kim loveall0926 at gmail.com
Thu Jul 7 06:15:54 CEST 2016


I build ffmpeg 3.1.1 for iOS (arm64 only, for iOS 8.0 target) and decoding it with this alrorithm


- (NSArray *) decodeFrames: (CGFloat) minDuration
{
    if(-1 == _videoStream &&
        -1 == _audioStream)
        return nil;

    NSMutableArray *result = [NSMutableArray array];

    AVPacket packet;

    CGFloat decodedDuration = 0;

    BOOL finished = NO;

    while(!finished)
    {
        if(!_formatCtx)
            break;

        /*
         * reads in a packet and stores it in the AVPacket struct
         */
        if(0 > av_read_frame(_formatCtx, &packet))
        {
            _isEOF = YES;
            break;
        }

        if(packet.stream_index ==_videoStream)
        {
            int pktSize = packet.size;

            while(0 < pktSize)
            {
                int gotframe = 0;
                /*
                 * Decode video frame
                 */
                int len = avcodec_decode_video2(_videoCodecCtx,
                                                _videoFrame,
                                                &gotframe,
                                                &packet);

                if(0 > len)
                {
                    LoggerVideo(0, @"decode video error, skip packet");
                    break;
                }

                if(gotframe)
                {
			….


I only update the ffmpeg version and avcodec_decode_video2 takes double time than 3.0 for 1920x1280 video.

Please let me know which things should I try.


Thanks.


> 2016. 7. 5., 오후 7:22, Carl Eugen Hoyos <cehoyos at ag.or.at> 작성:
> 
>> mpeg 3.0 but 
>> lagging occurred when I updated it to 3.1.1.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160707/6a67f5a6/attachment.html>


More information about the Libav-user mailing list