音视频合成求最佳解决方案?

小程序 文章 2022-01-24 10:22 291 0 全屏看文

AI助手支持GPT4.0

音视频合成求最佳解决方案?Looking for the best solution for audio and video synthesis?

音视频合成求最佳解决方案?

获取的是https的音视频地址,视频和音频是分开的需要下载到本地,但是官方api需要一个本地路径(本地路径又需要每次选择本地的任意文件才能转成临时路径//tmp...),前端如何在不选择文件的情况下,点击下载到本地就已经是合成成功的本地文件?求最佳解决方案?

https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.extractDataSource.html

参考的代码:

 let mc = wx.createMediaContainer()wx.chooseVideo({ //这不是每次选择才能生成?	sourceType: ['album', 'camera'], //选择的文件类型	maxDuration: 60,	camera: 'back',	success: res => {		let videoPath = res.tempFilePath		let mt = mc.extractDataSource({			source:videoPath,			success: function(mt){				console.log(mt)				let videoKind = mt.tracks[1];				mc.addTrack(videoKind)				//3.导出视频				mc.export({					success: (result) => {						let tempArr1 = result.tempFilePath.split("//")						let tempArr2 = tempArr1[1].split("/")						let tempArr3 = tempArr2[tempArr2.length-1].split(".");						let tempString2=''						for(let i=0;i

The audio and video address obtained is HTTPS. The video and audio are separated and need to be downloaded locally, but the official API needs a local path (the local path needs to select any local file every time to be converted to a temporary path / / tmp...), How can the front-end Click to download the local file without selecting the file to be a successfully synthesized local file? Seeking the best solution? https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.extractDataSource.html Reference code: let MC = Wx createMediaContainer()wx. Choosevideo ({/ / this is not generated for each selection? Sourcetype: ['album ',' camera '], / / selected file type maxDuration: 60, camera: 'back', success: res => { let videoPath = res.tempFilePath let mt = mc. extractDataSource({ source:videoPath, success: function(mt){ console. log(mt) let videoKind = mt.tracks[1]; mc. addTrack(videoKind) // 3. Export video mc. export({ success: (result) => { let tempArr1 = result. tempFilePath. split("//") let tempArr2 = tempArr1[1]. split("/") let tempArr3 = tempArr2[tempArr2.length-1]. split("."); let tempString2='' for(let i=0;i

回答:

谋谋谋:

这个故事告诉我们有个优秀的后端多么的重要

陈宇明:

我觉得最佳方案应该是服务器来做合成的工作

Mr.Zhao:

wx.downlaodFile不就是下载吗

-EOF-

AI助手支持GPT4.0