VideoHelp Forum
+ Reply to Thread
Results 1 to 22 of 22
Thread
  1. 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!
    Image Attached Files
    Quote Quote  
  2. Member
    Join Date
    Aug 2010
    Location
    San Francisco, California
    Search PM
    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.
    Quote Quote  
  3. Error or perhaps warning? Yellow message is warning not error (red).
    Quote Quote  
  4. 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
    Image Attached Files
    Quote Quote  
  5. Member
    Join Date
    Aug 2010
    Location
    San Francisco, California
    Search PM
    You could try adding a -copytb 1 option after the input file.
    Quote Quote  
  6. Hey JV

    Unfortunately adding -copytb 1 didn't make any difference, thanks for the suggestion though.

    Thanks

    Wayne
    Quote Quote  
  7. Hi Pandy

    It's a yellow warning, but seems to affect the playback of the combined file and introduces glitches.

    Cheers

    Wayne
    Quote Quote  
  8. Member
    Join Date
    Aug 2010
    Location
    San Francisco, California
    Search PM
    I recommend running FFprobe on the input files and carefully examining their properties for differences.
    Quote Quote  
  9. Ok thanks for the advice, I'll give that a go

    Wayne
    Quote Quote  
  10. Originally Posted by Wayneos View Post
    Hi Pandy

    It's a yellow warning, but seems to affect the playback of the combined file and introduces glitches.
    Looks like crappy player - try to add something like "-fflags +genpts"
    Quote Quote  
  11. Originally Posted by pandy View Post
    Originally Posted by Wayneos View Post
    Hi Pandy

    It's a yellow warning, but seems to affect the playback of the combined file and introduces glitches.
    Looks like crappy player - try to add something like "-fflags +genpts"

    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
    Quote Quote  
  12. Member
    Join Date
    Aug 2010
    Location
    San Francisco, California
    Search PM
    Just a thought — try copying the first video file to a new name so you are spec'ing three different files as input.
    Quote Quote  
  13. 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
    Image Attached Files
    Quote Quote  
  14. Member
    Join Date
    Aug 2010
    Location
    San Francisco, California
    Search PM
    Regarding pandy's suggestion, did you put -fflags +genpts before the input file?
    Quote Quote  
  15. 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"
    search for non monotonic PTS/DTS grow - i think issue is related to combining stream with open GOP and lack of reference frame.

    Originally Posted by JVRaines View Post
    Regarding pandy's suggestion, did you put -fflags +genpts before the input file?
    It is better to place same flag before and after input (not well documented ffmpeg behaviour on this area).
    Quote Quote  
  16. 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
    Quote Quote  
  17. Originally Posted by JVRaines View Post
    Just a thought — try copying the first video file to a new name so you are spec'ing three different files as input.
    I tried this but still got the error. The glitch now seems to have moved to the end of the second clip now though, which is interesting. But I could be wrong, it may be the result of another change, and I still get the DTS error so I guess it may not be relevant.
    Quote Quote  
  18. Member
    Join Date
    Aug 2010
    Location
    San Francisco, California
    Search PM
    Another option to try is -vsync vfr before the output file.
    Quote Quote  
  19. Originally Posted by Wayneos View Post
    Originally Posted by JVRaines View Post
    Just a thought — try copying the first video file to a new name so you are spec'ing three different files as input.
    I tried this but still got the error. The glitch now seems to have moved to the end of the second clip now though, which is interesting. But I could be wrong, it may be the result of another change, and I still get the DTS error so I guess it may not be relevant.
    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.
    Quote Quote  
  20. Hi both

    I've not had chance to look into to this over the last couple of days but will look at the output from ffprobe tomorrow and see if I can spot anything (output files attached for reference).

    Thanks!

    Wayne
    Image Attached Files
    Quote Quote  
  21. 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
    Quote Quote  
  22. Member
    Join Date
    Aug 2010
    Location
    San Francisco, California
    Search PM
    Thank you for getting back to us with the solution!
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!