"Non-monotonous DTS in output stream 0:0 This may result in incorrect timestamps in the output file." error

petaire picture petaire · Jul 23, 2019 · Viewed 7.4k times · Source

I'm trying to go from .mkv to .mp4 through ffmpeg. Normally I would use

ffmpeg -i $1 -codec copy -strict -2 $2

But on this particular file, I get this error, like, A LOT :

Non-monotonous DTS in output stream 0:0; previous: 49189232, current: 49189232; changing to 49189233. This may result in incorrect timestamps in the output file.

I guess it has something to do with the DTS :

[mp4 @ 0x7f8b14001200] Invalid DTS: 14832 PTS: 13552 in output stream 0:0, replacing by guess
[mp4 @ 0x7f8b14001200] Invalid DTS: 15472 PTS: 12272 in output stream 0:0, replacing by guess

I would not care if the result was ok, but the sound is out of sync, and the video is "stuttering". Feels like everything is out of sync.

I've tried a lot of things, including -async 1 -vsync 1 , but nothing seems to work.

Here's some mediainfo :

Complete name                            : /Users/petaire/Desktop/CNEWS-2019-07-23_16-00-00h.mkv
Format                                   : Matroska
Format version                           : Version 2
File size                                : 1.19 GiB
Movie name                               : Time-2019-07-23_16:00
Writing application                      : Tvheadend 4.3-1801~g7f952c2ed
Writing library                          : Tvheadend Matroska muxer
Original source form                     : TV
Comment                                  : Time recording
IsTruncated                              : Yes
DATE_BROADCASTED                         : 2019-07-23 16:00:00

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 fps
Standard                                 : Component
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : MBAFF
Scan type, store method                  : Interleaved fields
Scan order                               : Top Field First
Language                                 : English
Default                                  : Yes
Forced                                   : No
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

Audio
ID                                       : 2
Format                                   : E-AC-3
Format/Info                              : Enhanced AC-3
Commercial name                          : Dolby Digital Plus
Codec ID                                 : A_EAC3
Bit rate mode                            : Constant
Bit rate                                 : 128 Kbps
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 KHz
Frame rate                               : 31.250 fps (1536 SPF)
Compression mode                         : Lossy
Delay relative to video                  : -757ms
Language                                 : French
Service kind                             : Complete Main
Default                                  : Yes
Forced                                   : No

Text
ID                                       : 3
Format                                   : DVB Subtitle
Codec ID                                 : S_DVBSUB
Codec ID/Info                            : Picture based subtitle format used on DVBs
Language                                 : French
Default                                  : Yes
Forced                                   : No

Any idea ?

Answer