0

I created two different videos which are created by combining multiple images into videos. Below is the command for that.

"-f","concat","-safe", "0","-i",path,"-vsync","vfr","-pix_fmt","yuv420p",Environment.getExternalStorageDirectory().path+"/output1.mp4"

Here path is the input path of a text file in which I have given path of all the images that needs to be merged.

Now I am trying merge these two videos into a single video. For this I am using the following command.

-i, /storage/emulated/0/output.mp4, -i, /storage/emulated/0/output1.mp4, -filter_complex, [1:v][0:v]scale2ref[ua][b];[ua]setsar=1;[0:v][1:v]concat=n=2:v=1:a=0[v], -map, [v], -preset, ultrafast, /storage/emulated/0/output3.mp4

But it doesn't work and doesn't give any error in logs. But this is the last statement that gets printed in the progress method and seems like some error to me

Stream #1:0(und): Video: h264 (avc1 / 0x31637661), yuv420p, 1000x800 [SAR 1:1 DAR 5:4], 838 kb/s, 0.83 fps, 1 tbr, 12800 tbn, 50 tbc (default)

This is the details of the both videos.

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/output.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.12.100
  Duration: 00:00:20.04, start: 0.000000, bitrate: 279 kb/s
    Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p, 1280x854 [SAR 1:1 DAR 640:427], 279 kb/s, 0.25 fps, 0.20 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/output1.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.12.100
  Duration: 00:00:06.04, start: 0.000000, bitrate: 839 kb/s
    Stream #1:0(und): Video: h264 (avc1 / 0x31637661), yuv420p, 1000x800 [SAR 1:1 DAR 5:4], 838 kb/s, 0.83 fps, 1 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
Input #2, lavfi, from 'anullsrc':
  Duration: N/A, start: 0.000000, bitrate: 705 kb/s
    Stream #2:0: Audio: pcm_u8, 44100 Hz, stereo, u8, 705 kb/s

What I am doing wrong here ?

UPDATE These are the logs after using the command shared in answer.

Successfully opened the file.
D/ffmpeg: progress [Parsed_scale2ref_0 @ 0xf16390c0] w:iw h:ih flags:'bilinear' interl:0
D/ffmpeg: progress [Parsed_setsar_1 @ 0xf1639120] Setting 'sar' to value '1'
D/ffmpeg: progress [Parsed_concat_2 @ 0xf1639180] Setting 'n' to value '2'
D/ffmpeg: progress [Parsed_concat_2 @ 0xf1639180] Setting 'v' to value '1'
D/ffmpeg: progress [Parsed_concat_2 @ 0xf1639180] Setting 'a' to value '0'
D/ffmpeg: progress Parsing a group of options: output url /storage/emulated/0/output3.mp4.
D/ffmpeg: progress Applying option map (set input stream mapping) with argument [v].
D/ffmpeg: progress Successfully parsed a group of options.
D/ffmpeg: progress Opening an output file: /storage/emulated/0/output3.mp4.

1 Answers1

0

Use

-i, /storage/emulated/0/output.mp4, -i, /storage/emulated/0/output1.mp4, 
-filter_complex, [1:v][0:v]scale2ref[ua][b];[ua]setsar=1[ua];[b][ua]concat=n=2:v=1:a=0[v],
-map, [v], -preset, ultrafast, /storage/emulated/0/output3.mp4
Gyan
  • 38,955