[FFmpeg-user] "Non-monotonous DTS in output stream" error, previous and current values are equal
Crazy Red Elephant
crazyredelephant at protonmail.com
Wed Feb 12 00:22:13 EET 2020
I have a number of .ts segments (AES-128 encrypted), .m3u8 chunklist for them and a key to decrypt them.
My goal is to losslessly remux these .ts segments into one .mp4 file with no playback issues.
I'm using the following command:
"ffmpeg -allowed_extensions ALL -i chunklist.m3u8 -c copy output.mp4"
but getting a bunch of "Non-monotonous DTS" errors. It results in the output file experiencing a dropped frame every 2-3 seconds during playback according to VLC player's media statistics window.
I apologize in advance because the DTS issue was discussed here many times, however, the solutions described in other topics don't seem to be working for me and also, in my case the previous and current values in these errors are equal which is unusual.
Here is the console output (all .ts parts are in the playlist, I've included only the output for the first three):
> [hls,applehttp @ 0000022945ff9fc0] Opening 'key' for reading
>
> [hls,applehttp @ 0000022945ff9fc0] Opening
> 'crypto:part0.ts' for reading
>
> Input #0, hls,applehttp, from 'chunklist.m3u8': Duration: 02:34:55.36,
> start: 0.000000, bitrate: 0 kb/s Program 0
> Metadata:
> variant_bitrate : 0
> Stream #0:0: Data: timed_id3 (ID3 / 0x20334449)
> Metadata:
> variant_bitrate : 0
> Stream #0:1: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709/unknown/unknown), 1920x1080 [SAR 1:1 DAR 16:9],
> 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
>
> Metadata:
> variant_bitrate : 0
> Stream #0:2: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp
> Metadata:
> variant_bitrate : 0
>
> Output #0, mp4, to 'output.mp4':
>
> Metadata:
> encoder : Lavf58.20.100
> Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709/unknown/unknown), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29.97
> fps, 29.97 tbr, 90k tbn, 90k tbc
>
> Metadata:
> variant_bitrate : 0
> Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp
> Metadata:
> variant_bitrate : 0
>
> Stream mapping: Stream #0:1 -> #0:0 (copy) Stream #0:2 -> #0:1
> (copy) Press [q] to stop, [?] for help
>
> [mp4 @ 00000229460c8500] Non-monotonous DTS in output stream 0:0;
> previous: 177177, current: 177177; changing to 177178. This may result
> in incorrect timestamps in the output file.
>
> [hls,applehttp @ 0000022945ff9fc0] Opening
> 'crypto:part1.ts' for reading
>
> [mp4 @ 00000229460c8500] Non-monotonous DTS in output stream 0:0;
> previous: 357357, current: 357357; changing to 357358. This may result
> in incorrect timestamps in the output file.
>
> [mp4 @ 00000229460c8500] Non-monotonous DTS in output stream 0:0;
> previous: 537538, current: 537538; changing to 537539. This may result
> in incorrect timestamps in the output file.
>
> [hls,applehttp @ 0000022945ff9fc0] Opening
> 'crypto:part2.ts' for reading
>
> [mp4 @ 00000229460c8500] Non-monotonous DTS in output stream 0:0;
> previous: 717718, current: 717718; changing to 717719. This may result
> in incorrect timestamps in the output file.
>
> [mp4 @ 00000229460c8500] Non-monotonous DTS in output stream 0:0;
> previous: 897898, current: 897898; changing to 897899. This may result
> in incorrect timestamps in the output file.
And here is the output I'm getting if I decrypt the .ts files separately (with openssl) and leave only first three of them in the chunklist:
> [mpegts @ 00000209853e5040] Non-monotonous DTS in output stream 0:0;
> previous: 177177, current: 177177; changing to 177178. This may result
> in incorrect timestamps in the output file.
>
> [NULL @ 00000209848ad900] missing picture in access unit with size 8
> [mpegts @ 00000209853e5040] Timestamps are unset in a packet for
> stream 0. This is deprecated and will stop working in the future. Fix
> your code to set the timestamps properly
>
> frame= 121 fps=0.0 q=-1.0 Lsize= 3492kB time=00:00:04.00
> bitrate=7145.1kbits/s speed=99.1x video:3254kB audio:127kB
> subtitle:0kB other streams:0kB global headers:0kB muxing overhead:
> 3.298792%
>
> [mpegts @ 000001e6c395ba00] Non-monotonous DTS in output stream 0:0;
> previous: 176003, current: 176003; changing to 176004. This may result
> in incorrect timestamps in the output file.
>
> [mpegts @ 000001e6c395ba00] Non-monotonous DTS in output stream 0:0;
> previous: 356183, current: 356183; changing to 356184. This may result
> in incorrect timestamps in the output file.
>
> [mpegts @ 000001e6c395ba00] Timestamps are unset in a packet for
> stream 0. This is deprecated and will stop working in the future. Fix
> your code to set the timestamps properly
>
> frame= 121 fps=0.0 q=-1.0 Lsize= 2872kB time=00:00:03.97
> bitrate=5926.1kbits/s speed= 613x video:2647kB audio:126kB
> subtitle:0kB other streams:0kB global headers:0kB muxing overhead:
> 3.568192%
>
> [mpegts @ 000002881466a880] Non-monotonous DTS in output stream 0:0;
> previous: 176918, current: 176918; changing to 176919. This may result
> in incorrect timestamps in the output file.
>
> [mpegts @ 000002881466a880] Non-monotonous DTS in output stream 0:0;
> previous: 357098, current: 357098; changing to 357099. This may result
> in incorrect timestamps in the output file.
>
> [mpegts @ 000002881466a880] Timestamps are unset in a packet for
> stream 0. This is deprecated and will stop working in the future. Fix
> your code to set the timestamps properly
>
> frame= 121 fps=0.0 q=-1.0 Lsize= 3204kB time=00:00:03.99
> bitrate=6571.7kbits/s speed= 545x video:2971kB audio:127kB
> subtitle:0kB other streams:0kB global headers:0kB muxing overhead:
> 3.428558%
It's basically the same but now the "missing picture in access unit with size 8" error appears as well for some reason. Maybe it has something to do with the rest of the .ts segments missing, not sure...
I noticed the next thing - if I concatenate the .ts files and then remux the big .ts file into .mp4 there are no dropping frames, except in the beginning where I get 2 dropped frames for some reason. FFmpeg doesn't show any DTS errors in this case, however it shows some new ones - "start time for stream 0 is not set in estimate_timings_from_pts" and "pts has no value".
The duration of the result .mp4 file is 1 second longer than the .ts one according to the file's properties which is weird. VLC player also detects the frame rate as 30.05 while it should be 29.97 so... I don't think it's a perfect solution.
So I have the following questions:
1. Why these DTS errors appear? What exactly is wrong with my .ts files and how to check if my future .ts files have the same problem or not before remuxing with ffmpeg?
2. How to remux these .ts files properly so no "Non-monotonous DTS in output stream" or any other errors appear in ffmpeg and the result .mp4 plays with no issues and as close to the source as possible?
3. Why the "missing picture in access unit with size 8" error appears when I leave only first three .ts files in the chunklist? This error doesn't appear when all .ts files are there.
4. A general question - is there any difference between (a) decrypting all .ts parts separately, then concatenating them into one big .ts file and remuxing it into .mp4 and (b) concatenating all encrypted .ts parts first, then decrypting the big .ts result file and then remuxing it into .mp4?
[Here](http://www.mediafire.com/file/twsn7mdew9aa8lx/test.zip/file) are the files I'm working with in a zip archive. I've included only the first three of the .ts segments there, that should be enough for a test.
Any help will be greatly appreciated. Thanks!
~ Red Elephant
More information about the ffmpeg-user
mailing list