如何将m3u8流媒体视频转换为mp4

时间:2017-10-31 09:23:10

标签: ios swift3 video-streaming

有没有办法将流媒体m3u8文件转换为mp4。 并将mp4文件保存到Swift 3.0中的Gallery。

我尝试过以下代码,

func setupAssetDownload(url:URL) {
        //
        let configuration = URLSessionConfiguration.background(withIdentifier: "streamVideo")
        let downloadSession = AVAssetDownloadURLSession(configuration: configuration,
                                                        assetDownloadDelegate: self,
                                                        delegateQueue: OperationQueue.main)
        let asset = AVURLAsset(url: url)
        let downloadTask = downloadSession.makeAssetDownloadTask(asset: asset,
                                                                 assetTitle: "",
                                                                 assetArtworkData: nil,
                                                                 options: nil)
            downloadTask?.resume()
    }

突然打电话给完成下载。

func urlSession(_ session: URLSession, assetDownloadTask: AVAssetDownloadTask, didFinishDownloadingTo location: URL) {
}

然后,我可以获得整个流媒体会话,并在按下停止操作时保存到图库。

0 个答案:

没有答案
相关问题