Body: <p>I have recorded over-the-air digital TV broadcasts from my own antenna.  Due to reception blips, the MPEG-TS file can have corrupted packets, and thus corrupted timestamps, in the middle of a recording.  These timestamp problems cause A/V de-synchronization during transcoding, even with -async and -vsync flags.  -fflags +discardcorrupt gets rid of some of the corrupted timestamps, but not all of them.</p>
  
  <p>I've poured a LOT of effort into trying to fix these recordings such that A/V de-synchronization doesn't happen.  I've developed several methods that work to varying degrees of satisfaction, but I'm still looking to develop a better way.</p>
  
  <p>This is what I want to do: I want to use ffmpeg -fflags +discardcorrupt and -codec copy to copy streams that completely preserves timestamps, even non-monotonous timestamps, so that I can later develop methods to further correct the timestamps.  Essentially, I want to take advantage of +discardcorrupt, but preserve the remaining bad timestamps so I can go back later and deal with it.</p>
  
  <p>So here's my question:
  <strong>Is there a container format, possibly coupled with ffmpeg options, I can use where I can copy A/V streams such that non-monotonous timestamps are completely preserved, where ffmpeg doesn't try to fix/guess PTS/DTS values?</strong></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-05-18T18:01:28.827Z
Comments.Text: This is not directly possible. All muxers require monotonic TS. At best, a few allow non-decreasing TS. However, there may be a way to achieve this in a roundabout way. Let me check.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-08T19:49:06.090Z
Comments.Text: Have you tried the +nofillin value for -fflags? That *may* fix your issue.
Comments.UserDisplayName: Dennis Mungai
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-10-25T19:24:03.497Z
Comments.Text: Try this: https://stackoverflow.com/a/49556376/4675388
Comments.UserDisplayName: Dennis Mungai
Tags: <ffmpeg><file-formats><sync><timecode>
Title: Is there a container format in ffmpeg that supports non-monotonous timestamps?
UserDisplayName: acker9
ThreadText: # Is there a container format in ffmpeg that supports non-monotonous timestamps?
  
  (Asked by: username_0 on 2018-05-18)
  
  I have recorded over-the-air digital TV broadcasts from my own antenna. Due to reception blips, the MPEG-TS file can have corrupted packets, and thus corrupted timestamps, in the middle of a recording. These timestamp problems cause A/V de-synchronization during transcoding, even with -async and -vsync flags. -fflags +discardcorrupt gets rid of some of the corrupted timestamps, but not all of them.
  
  I've poured a LOT of effort into trying to fix these recordings such that A/V de-synchronization doesn't happen. I've developed several methods that work to varying degrees of satisfaction, but I'm still looking to develop a better way.
  
  This is what I want to do: I want to use ffmpeg -fflags +discardcorrupt and -codec copy to copy streams that completely preserves timestamps, even non-monotonous timestamps, so that I can later develop methods to further correct the timestamps. Essentially, I want to take advantage of +discardcorrupt, but preserve the remaining bad timestamps so I can go back later and deal with it.
  
  So here's my question:
  **Is there a container format, possibly coupled with ffmpeg options, I can use where I can copy A/V streams such that non-monotonous timestamps are completely preserved, where ffmpeg doesn't try to fix/guess PTS/DTS values?**
  
  **Tags:** ffmpeg, file-formats, sync, timecode
  
  > **Comments:**
  > **username_1**: This is not directly possible. All muxers require monotonic TS. At best, a few allow non-decreasing TS. However, there may be a way to achieve this in a roundabout way. Let me check.  
  > **username_2**: Have you tried the +nofillin value for -fflags? That *may* fix your issue.  
  > **username_2**: Try this: https://stackoverflow.com/a/49556376/4675388  
  
  ---
  
  ## 0 answers
  
  