Hi all
I'm trying to join some .ts video files coverted from .3gp using the following ffpeg commands
ffmpeg -y -i me1.3gp -c copy -bsf:v h264_mp4toannexb -f mpegts me1.ts
ffmpeg -y -i me2.3gp -c copy -bsf:v h264_mp4toannexb -f mpegts me2.ts
ffmpeg -y -i "concat:C:\Users\wayneos\Downloads\ffmpeg\ffmpeg\b in\me1.ts|C:\Users\wayneos\Downloads\ffmpeg\ffmpeg \bin\me2.ts|C:\Users\wayneos\Downloads\ffmpeg\ffmp eg\bin\me1.ts" -c copy RenderedComposition.mp4
I'm getting the "Non-monotonous DTS in output stream" error when concatenating, and the there is a slight pause before the third clip starts playing. Could anyone help me please?
Please see attached file for ffmpeg output.
Thanks in advance!
+ Reply to Thread
Results 1 to 22 of 22
-
-
Try the concat demuxer instead. You can use the original files instead of taking them to mpegts first. Codec copy (-c copy) is also available in this scenario.
-
Thanks JVRaines for the help.
So I've tried using the demuxer now using the following command:
ffmpeg -f concat -safe 0 -i demux.txt -c copy RenderedCompositionDemux.mp4
The demux.txt file contains the same source videos (they're just copied straight from an Android device's camera directory - no trimming etc)
I still get the Non-monotonous DTS error (see attached output).
Am I missing something? I would have thought this is is exactly the sort of thing ffmpeg is used for all of the time!
Cheers -
You could try adding a -copytb 1 option after the input file.
-
Hey JV
Unfortunately adding -copytb 1 didn't make any difference, thanks for the suggestion though.
Thanks
Wayne -
Hi Pandy
It's a yellow warning, but seems to affect the playback of the combined file and introduces glitches.
Cheers
Wayne -
-
Hey Pandy,
Ok just tried this, and unfortunately the same thing. I tried playing the combined movie in Windows Media Player and VLC and the movie has the same glitch in each - when the third clip starts to play, there's a slight pause.
Cheers for trying anyway.
Wayne -
Just a thought — try copying the first video file to a new name so you are spec'ing three different files as input.
-
Ok so I ran ffprobe on both files (see attached output) and compared for differences in Beyond Compare. Apart from the filenames and and creation times they are the same. I cannot see why this shouldn't work! They haven't been trimmed, they are just movies from the same camera on an Android device. Even re-encoding them doesn't seem to solve the issue. I am totally stuck and would have thought joining some movie files of the same format would have been straightforward.
Thanks for your suggestions though.
Cheers
Wayne -
Regarding pandy's suggestion, did you put -fflags +genpts before the input file?
-
Code:
@set name=%~1 @ffprobe -hide_banner -v 32 -stats -y -i "%name%" -select_streams v:0 -print_format compact -show_entries frame > "%~n1.txt" @echo entry_type,media_type,stream_index,key_frame,pkt_pts,pkt_pts_time,pkt_dts,pkt_dts_time,best_effort_timestamp,best_effort_timestamp_time,pkt_duration,pkt_duration_time,pkt_pos,pkt_size,width,height,pix_fmt,sample_aspect_ratio,pict_type,coded_picture_number,display_picture_number,interlaced_frame,top_field_first,repeat_pict,color_range,color_space,color_primaries,color_transfer,chroma_location > "%~n1.csv" @ffprobe -hide_banner -v 32 -stats -y -i "%name%" -select_streams v:0 -print_format csv -show_entries frame >> "%~n1.csv"
It is better to place same flag before and after input (not well documented ffmpeg behaviour on this area). -
Hi both,
I've now updated the command to the following, but I still get the error unfortunately. Thanks for the code Pandy I'll run it and see how I go. Thanks for your patience!
ffmpeg -f concat -safe 0 -fflags +genpts -i demux.txt -c copy -fflags +genpts RenderedCompositionDemux.mp4
Cheers
Wayne -
-
Another option to try is -vsync vfr before the output file.
-
Check with ffprobe (detailed) reports around joining point, i thing there is irregularity between two different GOP's (probably both open and missing references).
So this is way IMHO you are facing problem, not sure if this can be solved easily - probably you need to close ending and opening GOP. -
Hey guys
OK so I've found if I copy them to an Mp4 container with ffmpeg first, then use the demuxer it works! No warnings and no playback glitches. Great stuff. Thanks for all your help, I now need to try this with trimmed clips and see how I get on.
Thanks again for your help!
Wayne
Similar Threads
-
ffmpeg: Concatenating MP4 files adding chapters for each one
By Keyser in forum Video ConversionReplies: 6Last Post: 12th May 2022, 17:19 -
ffmpeg throwing “Non-monotonous DTS in output stream”
By cwinthrop in forum Video ConversionReplies: 15Last Post: 27th Jun 2019, 11:25 -
FFMpeg "non-monotonous DTS in output stream" error
By CursedLemon in forum Video ConversionReplies: 4Last Post: 26th Aug 2018, 09:56 -
How to fix DTS non monotonous error in ffmpeg
By Chemist116 in forum RestorationReplies: 2Last Post: 23rd Aug 2017, 12:24 -
ffmpeg trim + concat = Non-monotonous DTS errors
By TorBru in forum Video ConversionReplies: 9Last Post: 27th Dec 2015, 05:33