【问题标题】:how to merge two video using FFMPEG?如何使用 FFMPEG 合并两个视频?
【发布时间】:2019-03-01 00:32:17
【问题描述】:
String Tmp1 = Environment.getExternalStorageDirectory() + "/" + "scary.mp4";
inputCode = new String[]{FileUtils.getFFmpeg(getApplicationContext()),
                "-i", Tmp1, "-i", VideoPath, "-filter_complex",
                "[0:v][1:v]blend=all_mode='overlay':all_opacity=0.8[v_out]", "-map", "[v_out]", "-map", "0:a", "-strict", "-2", VideoPath};

inputCode 是执行字符串。

【问题讨论】:

  • 你提供的那段代码有什么问题?
  • 交叉检查你的输出应该保存的目录名称
  • 可能找不到ffmpeg目录
  • 并且您将 VideoPath 传递给不允许的输入和输出
  • 我认为由于没有生成输出文件,命令中存在一些问题。你能检查一下这个命令吗? @Vinesh Chauhan

标签: android ffmpeg


【解决方案1】:

使用此命令成功完全标记文件

inputCode = new String[]{FileUtils.getFFmpeg(getApplicationContext()),"-y","-i",InputPath1, "-i",InputPath2,"-strict","experimental", "-filter_complex", "[0:v]scale=480x640,setsar=1:1[v0];[1:v]scale=480x640,setsar=1:1[v1];[v0][0:a][v1][1:a] concat=n=2:v=1:a=1", "-ab","48000","-ac","2","-ar","22050","-s","480x640","-r","30","-vcodec","mpeg4","-b","2097k",OutPutPath};

谢谢你..

【讨论】:

    【解决方案2】:

    ffmpeg 命令应该是

       String Tmp1 = Environment.getExternalStorageDirectory() + "/" + "scary.mp4";
        inputCode = new String[]{FileUtils.getFFmpeg(getApplicationContext()),
                        "-i", Tmp1, "-i", VideoPath, "-filter_complex",
                        "[0:v][1:v]blend=all_mode='overlay':all_opacity=0.8[v_out]", "-map", "[v_out]", "-map", "0:a", "-strict", "-2", "/sdcard/OutPutVideo.mp4"};
    

    输入输出文件不一样

    【讨论】:

    • W/System.err: java.io.IOException: 运行 exec() 时出错。命令:[/data/user/0/photo.edit.scaryvideomaker/files/ffmpeg,-i,/storage/emulated/0/scary.mp4,-i,/storage/emulated/0/ThugsLifeVideoMaker/videofiles/TL1537877161938。 mp4, -filter_complex, [0:v][1:v]blend=all_mode='overlay':all_opacity=0.8[v_out], -map, [v_out], -map, 0:a, -strict, -2, /sdcard/OutPutVideo.mp4] 工作目录:null 环境:null
    • 你有没有初始化ffmpeg
    • inputCode = new String[]{FileUtils.getFFmpeg(getApplicationContext()),"-y","-i",InputPath1, "-i",InputPath2,"-strict","experimental ", "-filter_complex", "[0:v]scale=480x640,setsar=1:1[v0];[1:v]scale=480x640,setsar=1:1[v1];[v0][0: a][v1][1:a] concat=n=2:v=1:a=1", "-ab","48000","-ac","2","-ar","22050 ","-s","480x640","-r","30","-vcodec","mpeg4","-b","2097k",OutPutPath};
    猜你喜欢
    • 2018-04-23
    • 2021-10-15
    • 2018-12-27
    • 1970-01-01
    • 2018-12-22
    • 2017-08-09
    • 1970-01-01
    • 1970-01-01
    • 2015-05-06
    相关资源
    最近更新 更多