FFMPEG command issue for merging mp4 videos in android -
i using following ffmpeg command merging mp4 videos in android. video rotated 90 degree after merging.
i stuck 2 days .if idea highly appriciated.
thanks in 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"};
below working command merging 2 videos , maintaining aspect ratio of both
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"};
Comments
Post a Comment