0

hi I have written a Python program to concatenate multiple video files using ffmpeg concat demuxer. initially, I used media files from WhatsApp in my mobile which were sent to my laptop via email. but all the WhatsApp media files failed to concatenate and program gave an error "non monotonous dts... " but when i replaced the whatsappp media files with the video files in my laptop which were diectly downloaded from a site the program worked and it concatenated the videos. i am wondering what might be the reason whatsapp media files not working here ? is it some kind of special encryption by whatsapp of its media files which is making them unreadable from ffmpeg ?

here is 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)

0

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.