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.
[0:v]trim=0.823625:5.88717,setpts=PTS-STARTPTS[v0]; [0:a]atrim=0.823625:5.88717,asetpts=PTS-STARTPTS[a0]; [0:v]trim=6.87858:10.2093,setpts=PTS-STARTPTS[v1]; [0:a]atrim=6.87858:10.2093,asetpts=PTS-STARTPTS[a1]; [0:v]trim=10.5683:11.5989,setpts=PTS-STARTPTS[v2]; [0:a]atrim=10.5683:11.5989,asetpts=PTS-STARTPTS[a2]; [0:v]trim=11.9066:13.2301,setpts=PTS-STARTPTS[v3]; [0:a]atrim=11.9066:13.2301,asetpts=PTS-STARTPTS[a3]; [0:v]trim=14.2123:14.903,setpts=PTS-STARTPTS[v4]; [0:a]atrim=14.2123:14.903,asetpts=PTS-STARTPTS[a4]; [0:v]trim=15.2467:16.5819,setpts=PTS-STARTPTS[v5]; [0:a]atrim=15.2467:16.5819,asetpts=PTS-STARTPTS[a5]; [0:v]trim=17.1012:20.1223,setpts=PTS-STARTPTS[v6]; [0:a]atrim=17.1012:20.1223,asetpts=PTS-STARTPTS[a6]; [0:v]trim=20.9504:22.5714,setpts=PTS-STARTPTS[v7]; [0:a]atrim=20.9504:22.5714,asetpts=PTS-STARTPTS[a7]; [0:v]trim=23.4482:24.8745,setpts=PTS-STARTPTS[v8]; [0:a]atrim=23.4482:24.8745,asetpts=PTS-STARTPTS[a8]; [0:v]trim=25.5697:26.8718,setpts=PTS-STARTPTS[v9]; [0:a]atrim=25.5697:26.8718,asetpts=PTS-STARTPTS[a9]; [0:v]trim=27.5758:27.9942,setpts=PTS-STARTPTS[v10]; [0:a]atrim=27.5758:27.9942,asetpts=PTS-STARTPTS[a10]; [0:v]trim=28.5431:30,setpts=PTS-STARTPTS[v11]; [0:a]atrim=28.5431:30,asetpts=PTS-STARTPTS[a11]; [v0][a0][v1][a1][v2][a2][v3][a3][v4][a4][v5][a5][v6][a6][v7][a7][v8][a8][v9][a9][v10][a10][v11][a11] concat=n=12:v=1:a=1[outv][outa] 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.
"output.txt? Probably not.output.mp4and 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.