FFMPEG command error to merge mp4 video in android

I am using the following FFMPEG command to merge mp4 video in android. But after merging the video, there is a 90 degree rotation .

I've been stuck since two days. If any idea was highly appreciated.

Thank you Advance!

complexCommand = new String[] {
                "ffmpeg",
                "-y",
                "-i",
                recordpath + "Vid1.mp4",
                "-i",
                recordpath + "Vid2.mp4",
                "-strict",
                "experimental",
                "-filter_complex",
                "[0:v]scale=w=640:h=480[v1]; [1:v]scale=w=640:h=480[v2]; [v1][0:a][v2][1:a] concat=n=2:v=1:a=1 [v] [a]",
                "-map", "[v]", "-map", "[a]", "-b", "2097k", "-vcodec",
                "mpeg4","-ab","64k","-ac","2","-ar","22050", recordpath + "Outputnew.mp4"};

      

+3


source to share


1 answer


Below is the working command to combine two videos and keep aspect ratio as



complexCommand = new String[]{"-y", "-i", file1.toString(), "-i", file2.toString(), "-strict", "experimental", "-filter_complex",
                "[0:v]scale=iw*min(1920/iw\\,1080/ih):ih*min(1920/iw\\,1080/ih), pad=1920:1080:(1920-iw*min(1920/iw\\,1080/ih))/2:(1080-ih*min(1920/iw\\,1080/ih))/2,setsar=1:1[v0];[1:v] scale=iw*min(1920/iw\\,1080/ih):ih*min(1920/iw\\,1080/ih), pad=1920:1080:(1920-iw*min(1920/iw\\,1080/ih))/2:(1080-ih*min(1920/iw\\,1080/ih))/2,setsar=1:1[v1];[v0][0:a][v1][1:a] concat=n=2:v=1:a=1",
                "-ab", "48000", "-ac", "2", "-ar", "22050", "-s", "1920x1080", "-vcodec", "libx264", "-crf", "27", "-q", "4", "-preset", "ultrafast", rootPath + "/output.mp4"};

      

+1


source







All Articles