2)這裏就是我如何分塊的文件,從而無需太多的框架:
- (void) segmentRecording:(NSTimer*)timer {
AVAssetWriter *tempAssetWriter = self.assetWriter;
AVAssetWriterInput *tempAudioEncoder = self.audioEncoder;
AVAssetWriterInput *tempVideoEncoder = self.videoEncoder;
self.assetWriter = queuedAssetWriter;
self.audioEncoder = queuedAudioEncoder;
self.videoEncoder = queuedVideoEncoder;
//NSLog(@"Switching encoders");
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
[tempAudioEncoder markAsFinished];
[tempVideoEncoder markAsFinished];
if (tempAssetWriter.status == AVAssetWriterStatusWriting) {
if(![tempAssetWriter finishWriting]) {
[self showError:[tempAssetWriter error]];
}
}
if (self.readyToRecordAudio && self.readyToRecordVideo) {
NSError *error = nil;
self.queuedAssetWriter = [[AVAssetWriter alloc] initWithURL:[self newMovieURL] fileType:(NSString *)kUTTypeMPEG4 error:&error];
if (error) {
[self showError:error];
}
self.queuedVideoEncoder = [self setupVideoEncoderWithAssetWriter:self.queuedAssetWriter formatDescription:videoFormatDescription bitsPerSecond:videoBPS];
self.queuedAudioEncoder = [self setupAudioEncoderWithAssetWriter:self.queuedAssetWriter formatDescription:audioFormatDescription bitsPerSecond:audioBPS];
//NSLog(@"Encoder switch finished");
}
});
}
https://github.com/chrisballinger/FFmpeg-iOS-Encoder/blob/master/AVSegmentingAppleEncoder.m
3)這裏有一個腳本來連接服務器
import glob
import os
run = os.system # convenience alias
files = glob.glob('*.mp4')
out_files = []
n = 0
for file in files:
out_file = "out-{0}.ts".format(n)
out_files.append(out_file)
full_command = "ffmpeg -i {0} -f mpegts -vcodec copy -acodec copy -vbsf h264_mp4toannexb {1}".format(file, out_file)
run(full_command)
n += 1
out_file_concat = ''
for out_file in out_files:
out_file_concat += ' {0} '.format(out_file)
cat_command = 'cat {0} > full.ts'.format(out_file_concat)
print cat_command
run(cat_command)
run("ffmpeg -i full.ts -f mp4 -vcodec copy -acodec copy -absf aac_adtstoasc full.mp4")
https://github.com/chrisballinger/FFmpeg-iOS-Encoder/blob/master/concat-mp4.py上的文件
你不能在公開場合提出這些問題。正如你是)引人注目的iOS開發者打破他們與蘋果公司的NDA,以及b)如果你自己也是一個付費的iOS開發者,那麼與蘋果公司打破你的NDA。將您的iOS 5開發職位限制在官方**私人**和**機密** Apple主辦的論壇中是明智/謹慎的做法。 – twilson
如果您不是付費的iOS開發人員,那麼您就沒有地方使用iOS 5 beta SDK,並且必須等到Apple發佈iOS 5正式版! – twilson