这是我用来将视频合并在一起的方法的开始
-(void) mergeVideosAndAudio:(AVAsset *)audioAsset{
//Load Video Assets
NSError *error;
NSArray *dirFiles;
if ((dirFiles = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:[self documentsDirectory] error:&error]) == nil) {
// handle the error
};
// find all the temp files
NSArray *movFiles = [dirFiles filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"self BEGINSWITH 'temp'"]];
NSLog(@"The are %i temp files",movFiles.count);
//Create assets array
NSMutableArray *assets = [[NSMutableArray alloc]init];
for (int i = 0; i < movFiles.count; i++) {
NSString *videoURL = [[self documentsDirectory] stringByAppendingPathComponent:
[NSString stringWithFormat:@"temp%i.mov", i]];
NSURL *url = [NSURL fileURLWithPath:videoURL];
AVURLAsset *videoAsset …Run Code Online (Sandbox Code Playgroud) 我正在尝试从一系列位图创建电影。我想以 API 19 为目标,但也可以利用 API 21(如果它在设备上可用)。
我一直在阅读 bigflake CTS 测试,尤其是这里的EncodeAndMux 和 EncodeDecodeTest
我想使用 MediaCodec 和 MediaMuxer 类,而不是 FFMpeg 或 Jcodec 等。
如果您能指出我哪里出错以及如何解决,我将不胜感激。我是 Android 新手,为此苦苦挣扎了好几天!我正在三星 Galaxy Note 3 上进行测试
更新:我能够访问 EOS,但在尝试释放编码器时出现编解码器错误。
这是更新后的代码:
public void createMovie(View view) {
Log.v(TAG,"CREATING MOVIE");
//1. Prepare the encoder and the GPUImageView
try {
prepareEncoder();
presentationTime = 0;
int j = 0;
for (int i = firstImageIndex; i <= lastImageIndex; i++) {
Log.v(TAG, "inLoop: " + i);
//1
durationInNanosec = (long) ((float) durations.get(j) * 100000); …Run Code Online (Sandbox Code Playgroud)