我是ffmpeg的新手,我正在尝试创建直播应用程序(HLS),并且我希望直播而不是VOD。
我可以通过终端使用ffmpeg并从m4v创建.ts文件,但是我没有得到如何在iPhone中实现相同功能的信息。
我的方法是在iPhone端创建.ts文件,然后将其发送到服务器。
我不确定这种方法是否正确,如果这种正确的方法可以创建.ts文件,那么正确的方法是什么?
如果您想从iPhone创建.ts文件,则需要FFmpegWrapper库,然后执行此操作,
NSString *outputPath = [documentDirectoryPath stringByAppendingPathComponent:@"out.m3u8"];
FFmpegWrapper *wrapper = [[FFmpegWrapper alloc] init];
[wrapper convertInputPath:inputPath outputPath:outputPath segmentDuration:SEGMENT_DURATION options:nil progressBlock:
^(NSUInteger bytesRead, uint64_t totalBytesRead, uint64_t totalBytesExpectedToRead) {
//Do loading here
} completionBlock:^(BOOL success, NSError *error) {
// Do whatever after it is complete
}];
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句