0

hi I am trying to write a Python program that is trying to first edit different videos separately under the heading "intro" "story" and "byte" with the help of FFmpeg and Python subprocess module and then concatenate them in the function named "bind". At first, I encountered this "Non-monotonic DTS in output stream" then i reencoded the input files before concatenating them but i am still getting this error code

def bind():

bunch = ["final_intro.mp4","final_story.mp4","finalbite.mp4"]
new_bunch =[]
for video in bunch:
    name = f"re_{video}"
    re_command =[
        "ffmpeg", "-y",
        "-i", video,
        "-c:v", "libx264",
        "-c:a", "aac",
        "-strict", "experimental",
        "-b:a", "192k",
        name
    ]
    subprocess.run(re_command)
    new_bunch.append(name)
    

with open("concat_list_final.txt", "w") as f:
    for video in new_bunch:
        f.write(f"file '{video}'\n")
  
command_final = [ 
    "ffmpeg", "-y",
    "-f", "concat",
    "-safe", "0",
    "-i", "concat_list_final.txt",
    "-c", "copy",
    "done.mp4"
]
subprocess.run(command_final)
for video in new_bunch:
    os.remove(video)
os.remove("concat_list_final.txt")


return "done.mp4"

for reference this is the error messages :-

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x14cf16040] Auto-inserting h264_mp4toannexb bitstream filter [mp4 @ 0x12ce06880] Non-monotonic DTS in output stream 0:0; previous: 152933, current: 127760; changing to 152934. This may result in incorrect timestamps in the output file. [mp4 @ 0x12ce06880] Non-monotonic DTS in output stream 0:0; previous: 152934, current: 128272; changing to 152935. This may result in incorrect timestamps in the output file..........

1
  • maybe, different time base (tbn), if so, try to change temporary outputs ext to mkv or add -video_track_timescale 24000 or what, before name. Or use concat filter Commented Jun 18 at 4:34

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.