I'm trying to split & combine multiple portions of the same video file.

Since there are multiple portions that I want to combine, I want to use filtercomplex to do this.

Also, since some of the portions are quite small in duration, I want to use precise timestamps (setpts=PTS-STARTPTS)

The "script.txt" file contains the code below.


The command that I am using to run ffmpeg with this script file is as below

ffmpeg -i "input.mp4" -c:v libx265 -filter_complex_script "script.txt" -map [outv] -map [outa] "output.mp4"

But after running this command, the output video file is only ~5 seconds long (the very first portion of the input video).

As we can see from the first line of the "script.txt", the start timestamp is ~0.8 and the end timestamp is ~5.8 giving a duration of ~5s for the first piece of the output video.

So, ffmpeg is not joining any other parts of the input video after the first part. I am unable to understand why so.

I am facing this problem since the past couple of months after I updated ffmpeg. The same syntax of script file and command line used to work fine before that. Did any changes in the update alter the syntax that ffmpeg expects for this task?

Any help is much appreciated.

  • Hey, I tried to edit your answer on a tablet to improve code formatting. I don't know why but it messed up the whole line. I can't see history and now I am not sure what your output was. Was it "output.txt? Probably not.
    – Celdor
    Feb 11 at 12:58
  • Everything seems to work on my end. Just copied the command line assuming output is output.mp4 and have a 22 sec. long video. The question is how did you install FFMpeg. Are you using any non-standard version? This could be important because I used to have a similar issue. There are two version for Windows gyan.dev and BtbN. My script for splitting a video only worked using the second version BtbN. BTW your script works on BtbN.
    – Celdor
    Feb 11 at 13:07
  • The output was output.mp4. This is the result of running ffmpeg -version on my current installed ffmpeg. ffmpeg version N-113032-g76cd71bf0c-20231219 Copyright (c) 2000-2023 the FFmpeg developers built with gcc 13.2.0 (crosstool-NG I tried the above script file & command line with this version of ffmpeg & got the output video that's only ~5s long. Then I tried the same script & command line on the ffmpeg build from the BtbN link you suggested & got ~22s long output video. So now the problem has been identified & I can solve it now. Thanks
    – icyGuy
    Feb 11 at 19:30

1 Answer 1


Thanks to Celdor for identifying the problem.

The build of ffmpeg I had installed on my system was the culprit. Here's the output of running ffmpeg -version in the command line

ffmpeg version N-113032-g76cd71bf0c-20231219 Copyright (c) 2000-2023 the FFmpeg developers built with gcc 13.2.0 (crosstool-NG

The problem was solved after I installed the build of ffmpeg from BtbN

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.