1

I am trying to concatenate multiple video files with ffmpeg and python with the following code :-

def story(path):
videos = [f for f in os.listdir(path) if f.endswith(".mp4")]
print(videos)
command = [
    "ffmpeg","-y",
    "-f","concat",
    "-safe","0",
    "-i","concat_list.txt",
    "-c","copy",
    "final.mp4"

 ]
with open("concat_list.txt","w") as f:
    for video in videos:
        f.write("file " + os.path.join("assets/story",video) + "\n")
        print(os.path.join("assets/story", video))
subprocess.run(command)
os.remove("concat_list.txt")

return "final.mp4"

path = "assets/story" story(path)

it is concatenating videos but the resulting output video file only playing first video properly and rest of the videos are just freeze frame with only audio with following error message :=

on-monotonic DTS in output stream 0:0; previous: 5501744, current: 2442453; changing to 5501745. This may result in incorrect timestamps in the output file.

0

You must log in to answer this question.

Browse other questions tagged .