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?

  • 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. – Gyan May 18 '18 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.