0

I want to concatenate around 15 45 second clips together end on end. These clips can be of different resolution (most are 1080 or 720) but are all mp4 files.

i have tried both

concatenate_videoclips(clips,method='compose')
concatenate_videoclips(clips,method='chain')

from moviepy but neither of these are good for me since 'compose' relies on all the files being the same resolution which they are not and chain takes too long and sometimes causes errors.

i have also tried using ffmpeg with:

ffmpeg -i clip1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts

for each clip and then concatenating with:

ffmpeg -i "concat:intermediate1.ts|intermediate2.ts|...|intermediate15.ts" -c copy -bsf:a aac_adtstoasc output.mp4

but this method seemed to cause a audio problem i believe due to the lossless compression when changing file type. There are these strange audio pauses periodically throughout the video.

i have also tried ffmpeg

ffmpeg -f concat -safe 0 -i clipsfile.txt -c copy output.mp4

where the clipsfile.txt looks like

file clip1.mp4
file clip2.mp4
...
file clip15.mp4

when i run this it works but i have an audio error where someclips (often comes in pairs) where one clip is silent and then the next clip plays the audio from the previous clip but of the first clip is shorter the audio will go back to the second clips audio at the correct time so it seems to me like the audio is overlaps and causes it to be silent and then when the overlap stops it goes back to normal.

Any suggestions to fix any of these, extra information or recommendations of other things to do are much appreciated thanks.

jap101
  • 1
  • 2

1 Answers1

0

clip= concatenate_videoclips( new_path,method="compose") clips.write_videofile("C:/Users/unknown/Desktop/movie/temp.mp4",preset='ultrafast',thread=8,codec='libx264')

nithin
  • 26
  • 3