我使用此代码从图像创建视频 . 它将为一个图像创建完美的修复时间 . 但我的问题是为一帧的固定timimg创建视频 . 这是我的代码 .

imageArray是所有图像的数组,在数组中有每个对象的时间间隔 . 请帮我 .

CVPixelBufferRef buffer = NULL;

int frameCount = 0;
NSUInteger fps = 60;

for (int i=0; i<[imageArray count]; i++)
{
    double numberOfSecondsPerFrame = [[[array  objectAtIndex:i] objectForKey:@"timeinterval"] doubleValue];
    double frameDuration = fps * numberOfSecondsPerFrame;

    UIImage *img = [imageArray objectAtIndex:i];
    buffer = [self pixelBufferFromCGImage:[img CGImage]size:size];


    BOOL append_ok = NO;
    int j = 0;
    while (!append_ok && j < 60)
    {
        if (adaptor.assetWriterInput.readyForMoreMediaData)
        {
            //print out status:
            NSLog(@"Processing video frame (%d,%d)",frameCount,[imageArray count]);

            CMTime frameTime = CMTimeMake(frameCount*frameDuration,(int32_t) fps);
            append_ok = [adaptor appendPixelBuffer:buffer withPresentationTime:frameTime];
            if(!append_ok)
            {
                NSError *error = videoWriter.error;
                if(error!=nil)
                {
                    NSLog(@"Unresolved error %@,%@.", error, [error userInfo]);
                }
            }
        }
        else {
            printf("adaptor not ready %d, %d\n", frameCount, j);
            [NSThread sleepForTimeInterval:0.1];
        }
        j++;
    }
    if (!append_ok) {
        printf("error appending image %d times %d\n, with error.", frameCount, j);
    }
    frameCount++;
}

NSLog(@"**************************************************");

//Finish the session:
[videoWriterInput markAsFinished];
[videoWriter finishWriting];
NSLog(@"Write Ended");

我有一些问题需要了解CMTIME . 请帮我解决这个问题 .