菜鸟教程小白 发表于 2022-12-12 14:49:05

ios - 在 iOS 中使用 ffmpeg 进行 hls 直播


                                            <p><p>我是 ffmpeg 的新手,我正在尝试创建直播应用 (HLS),我想要直播而不是 VOD。</p>

<p>我可以通过终端使用 ffmpeg 并从 m4v 创建 .ts 文件,但我不知道如何在 iPhone 中实现相同的功能。 </p>

<p>我的做法是在 iPhone 端创建 .ts 文件,然后发送到服务器。</p>

<p>我不确定这种方法是否正确,如果正确,我如何创建 .ts 文件,否则正确的方法是什么?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>如果您想从 iPhone 创建 .ts 文件,您需要 <a href="https://github.com/OpenWatch/FFmpegWrapper" rel="noreferrer noopener nofollow">FFmpegWrapper</a>图书馆,然后这样做,</p>

<pre><code>NSString *outputPath = ;

    FFmpegWrapper *wrapper = [ 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

   }];
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 在 iOS 中使用 ffmpeg 进行 hls 直播,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/29248469/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/29248469/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 在 iOS 中使用 ffmpeg 进行 hls 直播