如何在Android中使用FFMPEG库将Youtube视频与MP4合并()

于今腐草无萤火,终古垂杨有暮鸦。这篇文章主要讲述如何在Android中使用FFMPEG库将Youtube视频与MP4合并?相关的知识,希望能为你提供帮助。
这是我的代码

private void executeAudioVideo() { File moviesDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES); String filePrefix = "audio_video"; String fileExtn = ".mp4"; youtubeURL = "https://www.youtube.com/embed/oEKyXKL25FU"; videoPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/video.mp4"; File dest = new File(moviesDir, filePrefix + fileExtn); int fileNo = 0; while (dest.exists()) { fileNo++; dest = new File(moviesDir, filePrefix + fileNo + fileExtn); } filePath = dest.getAbsolutePath(); String[] command = new String[]{"-y", "-i", videoPath, "-i", youtubeURL, "-filter_complex", "[0:a][1:a]amerge=inputs=2[a]", "-map", "0:v", "-map", "[a]", "-c:v", "copy", "-c:a", "libvorbis", "-ac", "2", "-shortest", filePath}; Toast.makeText(this, filePath, Toast.LENGTH_SHORT).show(); execFFmpegBinary(command); }

答案您可以使用此库实现此目的:FFmpeg-Android
【如何在Android中使用FFMPEG库将Youtube视频与MP4合并()】这里有一个实现这个库:KotlinFFMpeg

    推荐阅读