0
我正在尝试使用Brad Larson的GPUImage库来录制视频文件。到目前为止,我遇到的问题是下面的一段代码:GPUImage和AVAssetWriter将文件写入哪里?
NSString *pathToMovie = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Movie.m4v"];
unlink([pathToMovie UTF8String]); // If a file already exists, AVAssetWriter won't let you record new frames, so delete the old movie
NSURL *movieURL = [NSURL fileURLWithPath:pathToMovie];
movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:movieURL size:CGSizeMake(480.0, 640.0)];
这是直接从他的榜样,从他的GitHub页面 https://github.com/BradLarson/GPUImage
拿起现在,我看了看源代码,我看到他做了通常的AVFoundation的东西 - 创建AVAssetWriter实例并为其添加输入。我在这里的问题是,@“Documents/Movie.m4v”位于何处?我怎样才能播放这个视频?或者我怎样才能访问它?我知道它位于应用程序包在运行时复制的任意位置。我的目标是能够将视频写入画廊或至少由我的应用创建的画廊中的相册。有谁知道文件正在写入哪里?
是的你是对的。出于某种原因,我的大脑冻结在那里,我无法理解如何访问路径。 虽然很快,但当我尝试访问AVPlayerViewController时,XCode给了我错误消息:Unknown typename:AVPlayerViewController。这必须是一个XCode错误,因为我看到它的文档,并且我已经包含了AVFoundation框架并且正在使用其他AV类 - AVCaptureSession,AVAssetWriter等。 现在我正在使用MPMoviePlayerController来播放视频,但它被弃用想避开它 – noobuntu
您是否导入过AVKit.h? –
是的,我有。我通过做一个干净的然后构建来解决这个问题。我想有些东西被搞糟..感谢你的帮助! – noobuntu