VideoHelp Forum




+ Reply to Thread
Results 1 to 8 of 8
  1. Chicken McNewblet
    Join Date
    Sep 2009
    Location
    United States
    Search Comp PM
    What is this, the seventh thread I've made on this subject?

    Making progress working with .ts files! I finally figured out how to concatenate them without running them through TS Doctor using the following command:

    Code:
    ffmpeg -fflags +igndts -i "concat:file1.ts|file2.ts|file3.ts" -c:v copy output.ts
    This produces a working output.ts file (despite a string of errors), it even does me the honor of stripping out all the empty streams from the original files to give the following ffprobe:

    Code:
    Duration: 00:02:29.15, start: 1.533467, bitrate: 10806 kb/s
      Program 1
        Metadata:
          service_name    : Service01
          service_provider: FFmpeg
      Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, smpte170m/smpte170m/bt709, top first), 720x480 [SAR 10:11 DAR 15:11], 29.97 fps, 59.94 tbr, 90k tbn
      Stream #0:1[0x101](eng): Audio: mp2 (mp3float) ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 384 kb/s
    Very good. However, if I try to output to an .mp4 container, this happens:

    Code:
     Duration: 00:01:36.26, start: 0.000000, bitrate: 11391 kb/s
      Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709, top first), 720x480 [SAR 10:11 DAR 15:11], 11247 kb/s, 59.91 fps, 59.94 tbr, 90k tbn (default)
        Metadata:
          handler_name    : VideoHandler
          vendor_id       : [0][0][0][0]
      Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
        Metadata:
          handler_name    : SoundHandler
          vendor_id       : [0][0][0][0]
    That 1:36 video duration happens to be exact duration of "file1.ts".

    Okay, so I'll just concat to a .ts file and then swap containers to an .mp4 after - nope, it STILL chops the video at the duration of the first file, even when all the videos are already in the same file. Which is...creepy?

    Alright, I'll try .mkv then. This produces a 26-minute long, unsearchable video. No words.

    Is there a way to easily accomplish what I'm trying to do here? Do I need to rebuild timestamps or something?
    Quote Quote  
  2. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    Have you tried appending the .ts files in mkvtooolnix to create an mkv?

    Or convert the 3 .ts files to individual mkv's then append them together?
    Quote Quote  
  3. Chicken McNewblet
    Join Date
    Sep 2009
    Location
    United States
    Search Comp PM
    Originally Posted by davexnet View Post
    Have you tried appending the .ts files in mkvtooolnix to create an mkv?

    Or convert the 3 .ts files to individual mkv's then append them together?
    Okay, so this is interesting. I had given up using Mkvtoolnix and tsmuxer because for whatever reason they were producing output files that were not properly interlaced, or so I thought when I was playing the files back in VLC Player. However, I just exported out of Mkvtoolnix again and played the resulting file back in both VLC and the default Windows video player. The latter actually works without issue while VLC isn't working properly even when forcing Yadif 2x.

    I may have been getting gaslit by VLC this entire time, but it makes me wonder what else might not play the files correctly.
    Quote Quote  
  4. Try
    Code:
    ffmpeg -fflags +igndts +genpts -i "concat:file1.ts|file2.ts|file3.ts" -c:v copy output.ts
    Quote Quote  
  5. Chicken McNewblet
    Join Date
    Sep 2009
    Location
    United States
    Search Comp PM
    Originally Posted by ProWo View Post
    Try
    Code:
    ffmpeg -fflags +igndts +genpts -i "concat:file1.ts|file2.ts|file3.ts" -c:v copy output.ts
    No dice it would seem:

    Code:
    Stream mapping:
      Stream #0:0 -> #0:0 (copy)
      Stream #0:2 -> #0:1 (aac (native) -> aac (native))
    Press [q] to stop, [?] for help
    Output #0, mp4, to 'huh.mp4':
      Metadata:
        encoder         : Lavf61.9.106
      Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709, top first), 720x480 [SAR 10:11 DAR 15:11], q=2-31, 29.97 fps, 59.94 tbr, 90k tbn
      Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
        Metadata:
          encoder         : Lavc61.33.100 aac
    [aist#0:2/aac @ 000001e1fea7edc0] timestamp discontinuity (stream id=103): 94909874689, new offset= -94909874689
    [vist#0:0/h264 @ 000001e1ff164200] timestamp discontinuity (stream id=100): -94909824633, new offset= -50056
    [vist#0:0/h264 @ 000001e1ff164200] timestamp discontinuity (stream id=100): 94909890555, new offset= -94909940611
    [mp4 @ 000001e1fe653b40] pts/dts pair unsupported
    [aost#0:1/aac @ 000001e1fe65ae40] Error submitting a packet to the muxer: Not yet implemented in FFmpeg, patches welcome
        Last message repeated 1 times
    [out#0/mp4 @ 000001e1fc6d57c0] Error muxing a packet
    [out#0/mp4 @ 000001e1fc6d57c0] Task finished with error code: -1163346256 (Not yet implemented in FFmpeg, patches welcome)
    [aac @ 000001e1fefbd1c0] Queue input is backward in time
    [out#0/mp4 @ 000001e1fc6d57c0] Terminating thread with return code -1163346256 (Not yet implemented in FFmpeg, patches welcome)
    [aac @ 000001e1fefbd1c0] Queue input is backward in time
    [mp4 @ 000001e1fe653b40] pts/dts pair unsupported
    [out#0/mp4 @ 000001e1fc6d57c0] Error writing trailer: Not yet implemented in FFmpeg, patches welcome
    [out#0/mp4 @ 000001e1fc6d57c0] video:132829KiB audio:1506KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
    frame= 5795 fps=4449 q=-1.0 Lsize=  133860KiB time=00:01:36.23 bitrate=11394.9kbits/s speed=73.9x
    [aac @ 000001e1fefbd1c0] Qavg: 855.241
    Conversion failed!
    I'm guessing FFMPEG just is not equipped to deal with .ts files like this.

    EDIT: Demuxing with tsMuxeR and then remuxing with FFMPEG seems to have done the trick, I guess that'll be my workflow for this going forward.
    Last edited by CursedLemon; 8th Feb 2025 at 18:26.
    Quote Quote  
  6. Chicken McNewblet
    Join Date
    Sep 2009
    Location
    United States
    Search Comp PM
    Question, -fflags +genpts doesn't seem to do anything when enacted in FFMPEG, however if I open a remuxed .mp4 file in Avidemux, I get the following prompt:

    Image
    [Attachment 85384 - Click to enlarge]


    And it...works? Doesn't take long at all either.

    Is there a way to get FFMPEG to do this?
    Quote Quote  
  7. @CursedLemon
    Try Losslesscut .. switching containers is also supported.
    Quote Quote  
  8. Chicken McNewblet
    Join Date
    Sep 2009
    Location
    United States
    Search Comp PM
    I ended up just using Avidemux to do the entire process including appending multiple videos, which worked perfectly as long as I configured the .mp4 container to force DAR, and also is the perfect tool for trimming video without reencoding.
    Quote Quote  



Similar Threads

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