ffmpeg to concat list of videos without txt

57 Views Asked by At

iven been trying different ways to concat the list of videos called videoPaths but it doesnt work so i tried this way but it results in a zero byte file

  mergeVideos() async {
    String commandToExecute = '-y -i ${videoPaths[0]} -i 
    ${videoPaths[1]} -r 24000/1001 -filter_complex \'[0:v:0] 
    [0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[out]\' -map \'[out]\' 
    $outputPath';
    print(commandToExecute);
    FFmpegKit.execute(commandToExecute).then((session) async {
      print(await session.getOutput());
    });
  }

Ive also tried this but fails with return code 1

Future<void> concatenateVideos() async {
    try {
      String command = '-i ${videoPaths.join(' -i ')} -filter_complex concat=n=${videoPaths.length}:v=1:a=1 -y $outputPath';

      FFmpegSession session = await FFmpegKit.executeAsync(command);

      ReturnCode? returnCode = await session.getReturnCode();

      if (returnCode == ReturnCode.success) {
        print('Concatenation completed successfully!');
      } else {
        print('Error during concatenation. FFmpeg return code: $returnCode');
      }
    } catch (e) {
      print('Error: $e');
    }
  }
0

There are 0 best solutions below