3

Two video play same time with collageView using ffmpeg. I have code but it's not work properly please help me.

-ss " + getStartTime()  + durationTime_act_select +getVideoUrl() +
                       " -ss " + getStartTime() +
                       " -t " + this.durationTime_act_select +
                       " -i " + getVideoUrl() +
                       " -i " + "R.jpg" +
                       " -filter_complex nullsrc=size=720*720[base1];" +
                       "[0:v]setpts=PTS-STARTPTS,scale=345*700[upperleft];" +
                       "[1:v]setpts=PTS-STARTPTS,scale=345*700[upperright];" +
                       "[2:v]setpts=PTS-STARTPTS,scale=720*720[over];" +
                       "[base1][over]overlay=shortest=1:x=0:y=0[base];"+
                       "[base][upperleft]overlay=shortest=1:x=10:y=10[tmp1];" +
                       "[tmp1][upperright]overlay=shortest=1:x=366:y=10" +
                       " -c:a copy -strict experimental -ss 0 -t " + this.durationTime_act_select + " -preset ultrafast -an " +videoName_act_select

enter image description here

  • See [Superimposing two videos onto a static image?](https://stackoverflow.com/a/13405214/1109017) – llogan May 23 '19 at 22:24

1 Answers1

3

As your Requirement

array2 = (FileUtils.getFFmpeg(SelectedFrameVideos.this) +
                       " -y -ss " + ((Collage) Utils.collageData.get(0)).getStartTime() +
                       " -t " + String.valueOf(this.durationTime_act_select) +
                       " -i " + ((Collage) Utils.collageData.get(0)).getVideoUrl() +
                       " -ss " + ((Collage) Utils.collageData.get(1)).getStartTime()+
                       " -t " + String.valueOf(this.durationTime_act_select) +
                       " -i " + ((Collage) Utils.collageData.get(1)).getVideoUrl() +
                       " -i " + "/storage/emulated/0/R.jpg" +
                       " -filter_complex nullsrc=size=720*720[base];" +
                       "[base][2:v]overlay=1,format=yuv420p[base1];"
                       "[0:v]setpts=PTS-STARTPTS,scale=345*700[upperleft];" +
                       "[1:v]setpts=PTS-STARTPTS,scale=345*700[upperright];" +
                       "[base1][upperleft]overlay=shortest=1:x=10:y=10[tmp1];" +
                       "[tmp1][upperright]overlay=shortest=1:x=366:y=10" +
                       " -c:a copy -strict experimental -ss 0 -t " + String.valueOf(this.durationTime_act_select) + " -preset ultrafast -an " +
                       SelectedFrameVideos.this.videoName_act_select).split(" ");

Add Two Video Side by side And Also Add OverLay Image That Show On Videos Padding With You can change Background Image " -i " + "/storage/emulated/0/R.jpg" here set your bg image path

Show This below Video its create from This command

enter image description here

Sanjay Hadiya
  • 864
  • 9
  • 21
  • Thanks for Answer. I am getting this error. " Invalid file index 2 in filtergraph description nullsrc=size=720*720[base];[base][2:v]overlay=1," – Maulik Patel Jun 01 '19 at 10:08
  • 1
    please add your background image path properly and replace here "/storage/emulated/0/R.jpg" + – Sanjay Hadiya Jun 01 '19 at 10:13
  • I have addes it and tried it gives me this error now. "[NULL @ 0xed439e00] Unable to find a suitable output format for '/storage/emulated/0/" " ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers" – Maulik Patel Jun 01 '19 at 10:16
  • 1
    Replace file path from your device "/storage/emulated/0/".. show me your full command – ravinaSukhadiya Jun 01 '19 at 10:20