FFMPEG for iPhone 录制视频编码

发布于 2024-12-21 10:05:43 字数 2174 浏览 1 评论 0原文

您好,发现了很多很多通过 ffmpeg 进行视频编码的链接12,3,4 等,但它们都是从使用终端命令开始的,但是当我尝试实现任何终端如:

git clone git://github.com/lajos/iFrameExtractor.git它说-bash:git:找不到命令。

另外据我所知,不可能在 iPhone 上使用终端命令。任何人都可以指出如何对通过 ffmpeg 录制的视频进行 mp4 格式的编码,并减少视频的大小?提前致谢。

编辑: 我已经实现了这种方法来调整我的视频大小,并且它成功发生,我能够在服务器上发送视频,但随后在服务器端它在检索数据和使用它时出现问题。

- (void)imagePickerController:(UIImagePickerController *)picker 
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    [self convertVideoToLowQuailtyWithInputURL:videoURL1 outputURL:[NSURL fileURLWithPath:videoStoragePath] handler:^(AVAssetExportSession *exportSession)
     {
         if (exportSession.status == AVAssetExportSessionStatusCompleted)
         {
             NSLog(@"%@",exportSession.error);
             printf("completed\n");
         }
         else
         {
             NSLog(@"%@",exportSession.error);
             printf("error\n");
         }
     }];
}

- (void)convertVideoToLowQuailtyWithInputURL:(NSURL*)inputURL 
                                   outputURL:(NSURL*)outputURL 
                                     handler:(void (^)(AVAssetExportSession*))handler
{
    [[NSFileManager defaultManager] removeItemAtURL:outputURL error:nil];
    AVURLAsset *asset = [AVURLAsset URLAssetWithURL:inputURL options:nil];
    AVAssetExportSession *exportSession = [[AVAssetExportSession alloc] initWithAsset:asset presetName:AVAssetExportPresetLowQuality];
    exportSession.outputURL = outputURL;
    exportSession.outputFileType = AVFileTypeQuickTimeMovie;
    [exportSession exportAsynchronouslyWithCompletionHandler:^(void) 
     {
         handler(exportSession);
         [exportSession release];
     }];
}

Hi found lots and lots of links for video encoding through ffmpeg 1,2,3,4 etc but they all start with using terminal commands but when i try to implement any on terminal like:

git clone git://github.com/lajos/iFrameExtractor.gitit says that-bash: git: command not found.

Also as per my knowledge it is not possible to use terminal command on iPhone. Can anybody point out how to encode a video recorded through ffmpeg in mp4 format and also to reduce the size of the video?Thanks in advance.

EDIT:
I am already implementing this method to resize my video and it successfully takes place and I am able to send the video on server but then on server side it's giving problem in retrieving the data and to use it.

- (void)imagePickerController:(UIImagePickerController *)picker 
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    [self convertVideoToLowQuailtyWithInputURL:videoURL1 outputURL:[NSURL fileURLWithPath:videoStoragePath] handler:^(AVAssetExportSession *exportSession)
     {
         if (exportSession.status == AVAssetExportSessionStatusCompleted)
         {
             NSLog(@"%@",exportSession.error);
             printf("completed\n");
         }
         else
         {
             NSLog(@"%@",exportSession.error);
             printf("error\n");
         }
     }];
}

- (void)convertVideoToLowQuailtyWithInputURL:(NSURL*)inputURL 
                                   outputURL:(NSURL*)outputURL 
                                     handler:(void (^)(AVAssetExportSession*))handler
{
    [[NSFileManager defaultManager] removeItemAtURL:outputURL error:nil];
    AVURLAsset *asset = [AVURLAsset URLAssetWithURL:inputURL options:nil];
    AVAssetExportSession *exportSession = [[AVAssetExportSession alloc] initWithAsset:asset presetName:AVAssetExportPresetLowQuality];
    exportSession.outputURL = outputURL;
    exportSession.outputFileType = AVFileTypeQuickTimeMovie;
    [exportSession exportAsynchronouslyWithCompletionHandler:^(void) 
     {
         handler(exportSession);
         [exportSession release];
     }];
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

瑾兮 2024-12-28 10:05:43

ffmpeg 是一个过时的方法,请尝试 AVFoundation 框架中的 AVAssetWriter

ffmpeg is an obsolete method try AVAssetWriter in AVFoundation framework.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文