Tag: 电影

给定一个电影的URL,如何检索它的信息?

在iOS下,我需要获取用于制作animation的编解码器(H.264,MJPEG等),电影的宽度和高度,文件大小以及电影中的帧数。 我试图使用AVAsset的电影持续时间等,但持续时间始终为零。 相同的宽度/高度。 我也尝试使用电影播放器​​控制器,但也没有工作(见下面的代码)。 文件有点混乱,并有多种方式到达相同的地方,你似乎无法到达同一个地方。 有没有人得到上述信息正常工作? 我相信我错过了一些东西,但我希望的示例代码和/或指针? 编辑:我添加了一个更好的代码示例。 但是,还存在一些问题。 如何获取电影的创builddate,用于压缩的编解码器以及电影的文件大小? 有人弄清楚这些吗? 谢谢 – (IBAction)getMovieInfo { int hours = 0, minutes = 0, seconds = 0; NSURL* sourceMovieURL = [NSURL URLWithString:@"http://trailers.apple.com/movies/summit/stepuprevolution/stepuprevolution-tlr1_h480p.mov"]; AVURLAsset* movieAsset = [AVURLAsset URLAssetWithURL:sourceMovieURL options:nil]; NSArray *tracks = [movieAsset tracksWithMediaType:AVMediaTypeVideo]; if ([tracks count] != 0) { AVAssetTrack *videoTrack = [tracks objectAtIndex:0]; NSTimeInterval durationSeconds = […]

AVPlayerLayeranimation帧更改

每当我改变我的AVPlayerLayer帧,video不会立即resize,但animation到新的大小。 例如:我将帧从(0,0,100,100)更改为(0,0,400,400),视图的帧将立即更改,但video的大小将dynamic调整为新的大小。 有没有人遇到过这个问题? 如果是的话,有人知道一种方法来禁用默认animation? 谢谢!

在iOS中访问所有电影帧的最佳方法

我试图编辑现有的电影与顶部的附加效果,因此我需要能够扫描所有电影帧,获得他们作为UIImage,应用效果,然后或者更新该帧或写入到新的电影。 我发现有人build议使用AVAssetImageGenerator。 下面是我最后编辑的样品,我如何做到这一点: -(void)processMovie:(NSString*)moviePath { NSURL* url = [NSURL fileURLWithPath:moviePath]; AVURLAsset *asset=[[AVURLAsset alloc] initWithURL:url options:nil]; float movieTimeInSeconds = CMTimeGetSeconds([movie duration]); AVAssetImageGenerator *generator = [[AVAssetImageGenerator alloc] initWithAsset:asset]; generator.requestedTimeToleranceBefore = generator.requestedTimeToleranceAfter = kCMTimeZero; generator.appliesPreferredTrackTransform=TRUE; [asset release]; // building array of time with steps as 1/10th of second NSMutableArray* arr = [[[NSMutableArray alloc] init] retain]; for(int i=0; i<movieTimeInSeconds*10; […]

MPMoviePlayerController切换电影导致白色闪光

我有一个小UIView,显示一个重复的电影。 当用户点击一个button时,另一个电影被加载并显示在相同的UIView中。 问题是在第一个电影的移除和第二个电影的显示之间有半秒的“闪光”。 有没有删除这个? – (void) setUpMovie:(NSString*)title { NSString *url = [[NSBundle mainBundle] pathForResource:title ofType:@"mp4"]; MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:url]]; [[player view] setFrame:self.movieView.bounds]; [self.movieView addSubview:player.view]; if ([title isEqualToString:@"Bo_idle_02"]) { [player setRepeatMode:MPMovieRepeatModeOne]; } else { [player setRepeatMode:MPMovieRepeatModeNone]; } [player setControlStyle:MPMovieControlStyleNone]; [player play]; } – (void) startDanceAnimation { [self setUpMovie:@"Bo_dance_02"]; return; }