【问题标题】:iPhone:Create video from imagesiPhone:从图像创建视频
【发布时间】:2012-07-24 10:01:06
【问题描述】:

我正在尝试从没有音频文件的 png 图像创建视频。

我已经实现了以下代码,但我的图像运行不顺畅。

- (void)viewDidLoad
{
    totalImages = 121;
    counter=1;
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}
-(void)viewDidAppear:(BOOL)animated
{
    levelTimer = [NSTimer scheduledTimerWithTimeInterval:0.40 target: self selector: @selector(levelTimerCallback:) userInfo: nil repeats: YES];
}

- (void)levelTimerCallback:(NSTimer *)timer 
{

    if(counter <= totalImages)
    {
        NSString *fileName = [NSString stringWithFormat:@"image_iphone_%d",counter];
        NSLog(@"filenameEasy:%@",fileName);
        NSString *fileLocation = [[NSBundle mainBundle] pathForResource:fileName ofType:@"png"];

        UIImage *imageName = [[UIImage alloc] initWithContentsOfFile:fileLocation];
        imgV.image = imageName; 
        counter++;
        NSLog(@"counter:%d",counter);
        [imageName release];
        [self viewDidAppear:NO];
    }

}

如果你有任何想法请分享。 提前谢谢。

【问题讨论】:

    标签: iphone objective-c uiimageview


    【解决方案1】:

    你可以看看这个话题

    Make movie file with picture Array and song file, using AVAsset

    如果你之前没有尝试过 AVFoundation,那会有点混乱。

    它的概念是这样的:
    1. 设置 Assetwriter(编写视频的助手)。
    2.告诉作者你想输入什么曲目(添加视频和音频 writerInput)
    3.如果一切正常,请尝试将您的图像放入视频轨道
    4. 请作者编码。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-02-17
      • 2019-04-12
      • 2011-08-08
      • 1970-01-01
      • 1970-01-01
      • 2018-03-01
      • 2012-08-21
      相关资源
      最近更新 更多