I have a question. Do you think I could do the following with FFMpeg:

  • split a long video in MP4 format into three parts
  • alter only the first and the third part, reencode them into MP4
  • finally, merge everything into a single video

and all this without unnecessary processing the middle part?

I have tested two approaches but in both cases there are issues with audio and video at points of merging. Additional info: I work in Windows 10. I currently export part 1 and 3 into AVI, then encode both files to MP4 before they are merged.

Method 1 - no encoding

I simply created a text file:

# inputs.txt
file `input1.mp4`
file `input2.mp4`
file `input3.mp4`

and run ffmpeg -f concat -i inputs.txt -c copy output.mp4. Unfortunately, the video freezes for a fraction of second with distorted audio at merging points, then continue.

Method 2 - using filter complex

> ffmpeg -i input1.mp4 -i input2.mp4 -input3.mp4 ^
More? -filter_complex "[0:v][0:a][1:v][1:a][2:v][2:a] concat=n=3:v=1:a=1 [outv][outa]" ^
More? -map [outv] -map [outa] output.mp4

The video gets encoded but there are still problems at merge points, possibly less noticeable comparing to the method 1.

I wonder if there is anything else I could do to improve the output video, ideally without any issues.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.