Opened 6 years ago

Last modified 2 years ago

#6810 open defect

Wrong DTS guess when PTS is reordered for the input without DTS (wrong 'Non-monotonous DTS' fixup)

Reported by: perexg Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: h264 dts
Cc: dustin.kerstein@gmail.com Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

A conversion (copy) from matroska to matroska causes sometimes wrong PTS output. The input is H264 with re-ordered video frames (from live broadcast).

The error is directly related to "Non-monotonous DTS in output stream" fixup. The DTS is wrongly guessed - select_from_pts_buffer() in libavformat/utils.c returns wrong DTS.

Input PTS example (with wrong DTS):

demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:22459 pkt_pts_time:22.459 pkt_dts:22279 pkt_dts_time:22.279
demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:22359 pkt_pts_time:22.359 pkt_dts:22359 pkt_dts_time:22.359
demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:22379 pkt_pts_time:22.379 pkt_dts:22379 pkt_dts_time:22.379
demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:22319 pkt_pts_time:22.319 pkt_dts:22319 pkt_dts_time:22.319
demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:22339 pkt_pts_time:22.339 pkt_dts:22339 pkt_dts_time:22.339
demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:22399 pkt_pts_time:22.399 pkt_dts:22399 pkt_dts_time:22.399
demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:22419 pkt_pts_time:22.419 pkt_dts:22419 pkt_dts_time:22.419

For example, the line with pts == dts == 22359 is wrong, dts should be 22319 here (+40).

As a consequence, the monotonous DTS check will correct PTS for the last DTS, so the value 22319 will be changed to 22379, because of the invalid DTS source.

If you look to trac, I believe that several other bugs are similar to this one.

Attachments (3)

a.mkv (2.2 MB ) - added by perexg 6 years ago.
Example mkv - wrong output PTS value 2980 (three frames with identical PTS)
a.2.mkv (2.2 MB ) - added by perexg 6 years ago.
Example mkv - wrong output PTS value 2980 (three frames with identical PTS)
original.ts (1.8 MB ) - added by perexg 6 years ago.
Original MPEG-TS which shows the problem (cutted using dd)

Change History (18)

in reply to:  description comment:1 by Carl Eugen Hoyos, 6 years ago

Keywords: mkv dts added; matroska timestamp removed
Priority: criticalnormal

Replying to perexg:

If you look to trac, I believe that several other bugs are similar to this one.

You mean this is a duplicate of another ticket?

Please provide the command line you tested together with the complete, uncut console output and an input sample that allows to reproduce.

by perexg, 6 years ago

Attachment: a.mkv added

Example mkv - wrong output PTS value 2980 (three frames with identical PTS)

by perexg, 6 years ago

Attachment: a.2.mkv added

Example mkv - wrong output PTS value 2980 (three frames with identical PTS)

comment:2 by perexg, 6 years ago

You mean this is a duplicate of another ticket?

It may be similar to #3572, #3621 and probably others - it's difficult to find all.

Please provide the command line you tested together with the complete, uncut console output and an input sample that allows to reproduce.

Command line: ffmpeg -y -loglevel trace -debug_ts -fdebug ts -i a.mkv -c:v copy -c:a copy /tmp/a.mkv

demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:2980 pkt_pts_time:2.98 pkt_dts:2980
muxer <- type:video pkt_pts:2980 pkt_pts_time:2.98 pkt_dts:2980 pkt_dts_time:2.98
demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:2920 pkt_pts_time:2.92 pkt_dts:2920
muxer <- type:video pkt_pts:2980 pkt_pts_time:2.98 pkt_dts:2980 pkt_dts_time:2.98
demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:2940 pkt_pts_time:2.94 pkt_dts:2940
muxer <- type:video pkt_pts:2980 pkt_pts_time:2.98 pkt_dts:2980 pkt_dts_time:2.98

comment:3 by perexg, 6 years ago

Further analysis: It appears that delay (avctx->has_b_frames) has an insufficient value (2) to do full DTS recovery. If I force this value to 8 in the code, DTS is OK.

comment:4 by perexg, 6 years ago

Value 4 (has_b_frames) is sufficient. It looks like H264 decoder issue.

The H264 SPS has not set bitstream_restriction_flag . The sps->num_reorder_frames is correctly set in ff_h264_decode_seq_parameter_set() - comment: derive it based on the level . The problem is that h264_select_output_frame() checks for strict settings so code 'h->avctx->has_b_frames = FFMAX(h->avctx->has_b_frames, sps->num_reorder_frames);' is not executed by default. Adding "-strict 1" option fixes the issue completely:

ffmpeg -strict 1 -i a.mkv -c:v copy -c:a copy /tmp/a.mkv

So the "bug" is in the H264 decoder.

The primary source of the strict check is in the commit:

commit fb19e1443bc45e192545d3485ddb9c76e7d77855
Author: Michael Niedermayer <michaelni@gmx.at>
Date:   Sat Jul 19 16:16:00 2008 +0000

    Take the brain amputated spec literally if the user asks for it (-strict 1).
    That is, add 16 frames delay, cache trashing and av desync.
    fixes at least the following reference bitstreams:
    CABA3_Sony_C.jsv
    CACQP3_Sony_D.jsv
    CAMANL1_TOSHIBA_B.264
    CANL3_Sony_C.jsv
    CVBS3_Sony_C.jsv
    CVMANL1_TOSHIBA_B.264
    
    Originally committed as revision 14308 to svn://svn.ffmpeg.org/ffmpeg/trunk

I believe that the original purpose of the check was obsoleted with the new code in ff_h264_decode_seq_parameter_set() - comment: derive it based on the level , so I would propose to remove the condition in h264_select_output_frame() like :

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 35dcabd611..3b50d12fa4 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1286,10 +1286,7 @@ static int h264_select_output_frame(H264Context *h)
     cur->mmco_reset = h->mmco_reset;
     h->mmco_reset = 0;
 
-    if (sps->bitstream_restriction_flag ||
-        h->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT) {
-        h->avctx->has_b_frames = FFMAX(h->avctx->has_b_frames, sps->num_reorder_frames);
-    }
+    h->avctx->has_b_frames = FFMAX(h->avctx->has_b_frames, sps->num_reorder_frames);
 
     for (i = 0; 1; i++) {
         if(i == MAX_DELAYED_PIC_COUNT || cur->poc < h->last_pocs[i]){

The mkv source is really the valid live H264 broadcast and the processing should not require additional (hard to determine / find) option for ffmpeg.

comment:5 by perexg, 6 years ago

A better patch is:

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 35dcabd611..04b10656e0 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1287,6 +1287,7 @@ static int h264_select_output_frame(H264Context *h)
     h->mmco_reset = 0;
 
     if (sps->bitstream_restriction_flag ||
+        sps->ref_frame_count ||
         h->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT) {
         h->avctx->has_b_frames = FFMAX(h->avctx->has_b_frames, sps->num_reorder_frames);
     }

I sent this code to the ffmpeg-devel mailing list.

comment:6 by Carl Eugen Hoyos, 6 years ago

Keywords: h264 added; mkv removed

How was the input sample created?

comment:7 by perexg, 6 years ago

Tvheadend (http://tvheadend.org), but it's bit-copy of the input stream from the live broadcasting (H.264 NALs), the cutted using mkvmerge. Note that only some channels show this behaviour.

in reply to:  7 comment:8 by perexg, 6 years ago

Replying to perexg:

Tvheadend (http://tvheadend.org), but it's bit-copy of the input stream from the live broadcasting (H.264 NALs), the cutted using mkvmerge. Note that only some channels show this behaviour.

then cutted using mkvmerge

comment:9 by Carl Eugen Hoyos, 6 years ago

Please provide (a short cut of) the original transport stream.

by perexg, 6 years ago

Attachment: original.ts added

Original MPEG-TS which shows the problem (cutted using dd)

comment:10 by perexg, 6 years ago

To reproduce DTS issue:

$ ffmpeg -y -i original.ts -c:v copy -c:a copy x.mkv
$ ffmpeg -y -i x.mkv -c:v copy -c:a copy y.mkv
[matroska @ 0x562a68e6eda0] Non-monotonous DTS in output stream 0:0; previous: 2667, current: 2627; changing to 2667. This may result in incorrect timestamps in the output file.

With strict set, there are only few errors at start (which can be tolerated):

$ ffmpeg -y -strict strict -i x.mkv -c:v copy -c:a copy y.mkv
[matroska @ 0x55e1e75f7060] Non-monotonous DTS in output stream 0:0; previous: 1707, current: 1687; changing to 1707. This may result in incorrect timestamps in the output file.

Last edited 6 years ago by perexg (previous) (diff)

comment:11 by perexg, 6 years ago

Priority: normalimportant

Nobody?

comment:12 by Carl Eugen Hoyos, 6 years ago

Priority: importantnormal

comment:13 by mkver, 6 years ago

  1. I believe I know what is the reason for this is ("this" does not include the wrong timestamps at the beginning which are a result of the initial GOP being open): There is a mismatch between how the number of reorder frames in H.264 is counted and the way utils.c handles the has_b_frames attribute. Annex E of the H.264 specifications has this to say:

max_num_reorder_frames indicates an upper bound for the number of frames buffers, in the decoded picture buffer (DPB), that are required for storing frames, complementary field pairs, and non-paired fields before output. It is a requirement of bitstream conformance that the maximum number of frames, complementary field pairs, or non-paired fields that precede any frame, complementary field pair, or non-paired field in the coded video sequence in decoding order and follow it in output order shall be less than or equal to max_num_reorder_frames.


The important thing to note is that a pair of complementary fields doesn't count as two, but only counts as one in the calculation of max_num_reorder_frames. It seems to me that the H.264 decoder takes this into account when it guesses the number of reorder frames that has_b_frames is then set to (and if max_num_reorder_frames is present in the bitstream, has_b_frames is simply set to this value so that here two each such pair is counted as one). But utils.c seems to treat has_b_frames as an upper bound for the number of packets that precede a packet in decoding order and follow it in output order. If there are packets that contain only a field of a complementary field pair, then the problems described here emerge.

  1. Here is mkvinfo's output for a.mkv (or actually, for a.mkv remuxed with mkvmerge to strip all the non-video-tracks away):
    Track 1: video, codec ID: V_MPEG4/ISO/AVC (h.264 profile: High @L4.0), mkvmerge/mkvextract track ID: 0, default duration: 40.000ms (25.000 frames/fields per second for a video track), pixel width: 1920, pixel height: 1080, display width: 1920, display height: 1080
    I frame, track 1, timestamp 00:00:00.120000000, size 94771, adler 0x954e13b1
    B frame, track 1, timestamp 00:00:00.040000000, size 9083, adler 0xf916b5c1
    B frame, track 1, timestamp 00:00:00.000000000, size 7072, adler 0xa002bf65
    B frame, track 1, timestamp 00:00:00.080000000, size 6439, adler 0xc9e0a118
    P frame, track 1, timestamp 00:00:00.280000000, size 29047, adler 0x131d7764
    B frame, track 1, timestamp 00:00:00.200000000, size 9987, adler 0xf3783c3a
    B frame, track 1, timestamp 00:00:00.160000000, size 7828, adler 0x8d9a5609
    B frame, track 1, timestamp 00:00:00.240000000, size 8459, adler 0x2bf575de
    P frame, track 1, timestamp 00:00:00.440000000, size 27419, adler 0xf918fcd0
    B frame, track 1, timestamp 00:00:00.360000000, size 11247, adler 0x573afa33
    B frame, track 1, timestamp 00:00:00.320000000, size 9284, adler 0xbf452b9c
    B frame, track 1, timestamp 00:00:00.400000000, size 9695, adler 0x7c36c1c1
    P frame, track 1, timestamp 00:00:00.600000000, size 30767, adler 0x6cc50a3a
    B frame, track 1, timestamp 00:00:00.520000000, size 14151, adler 0x2f159629
    B frame, track 1, timestamp 00:00:00.480000000, size 9236, adler 0xa8a5f167
    B frame, track 1, timestamp 00:00:00.560000000, size 7623, adler 0xc5b5c8fb
    P frame, track 1, timestamp 00:00:00.760000000, size 25559, adler 0xfb3ac24a
    B frame, track 1, timestamp 00:00:00.680000000, size 10687, adler 0xa125eb56
    B frame, track 1, timestamp 00:00:00.640000000, size 9768, adler 0xcf18e598
    B frame, track 1, timestamp 00:00:00.720000000, size 17095, adler 0x28cc8d93
    P frame, track 1, timestamp 00:00:00.920000000, size 46307, adler 0xeb5ed422
    B frame, track 1, timestamp 00:00:00.840000000, size 16823, adler 0x4aa1c09c
    B frame, track 1, timestamp 00:00:00.800000000, size 8228, adler 0x18b9f552
    B frame, track 1, timestamp 00:00:00.880000000, size 22647, adler 0x53c922ac
    P frame, track 1, timestamp 00:00:01.080000000, size 43963, adler 0x4b5bdfe3
    B frame, track 1, timestamp 00:00:01.000000000, size 22847, adler 0x7da1997e
    B frame, track 1, timestamp 00:00:00.960000000, size 21036, adler 0x1580f215
    B frame, track 1, timestamp 00:00:01.040000000, size 14787, adler 0x13eec208
    P frame, track 1, timestamp 00:00:01.240000000, size 34391, adler 0xd5a9fbe2
    B frame, track 1, timestamp 00:00:01.160000000, size 13167, adler 0x3629a50c
    B frame, track 1, timestamp 00:00:01.120000000, size 12172, adler 0xfa1dd25e
    B frame, track 1, timestamp 00:00:01.200000000, size 9415, adler 0x2d4733ee
    I frame, track 1, timestamp 00:00:01.400000000, size 104123, adler 0x8df8cc69
    B frame, track 1, timestamp 00:00:01.320000000, size 12075, adler 0x6cf391d8
    B frame, track 1, timestamp 00:00:01.280000000, size 10236, adler 0x72742ce7
    B frame, track 1, timestamp 00:00:01.360000000, size 8199, adler 0x5797ed53
    P frame, track 1, timestamp 00:00:01.560000000, size 34763, adler 0x0e5fac3c
    B frame, track 1, timestamp 00:00:01.480000000, size 9915, adler 0x0f36172f
    B frame, track 1, timestamp 00:00:01.440000000, size 7776, adler 0x50be0f87
    B frame, track 1, timestamp 00:00:01.520000000, size 7311, adler 0x08c76085
    P frame, track 1, timestamp 00:00:01.720000000, size 38759, adler 0x98534378
    B frame, track 1, timestamp 00:00:01.640000000, size 8111, adler 0x851cc072
    B frame, track 1, timestamp 00:00:01.600000000, size 7724, adler 0xd60eef9b
    B frame, track 1, timestamp 00:00:01.680000000, size 6163, adler 0xa45b1423
    P frame, track 1, timestamp 00:00:01.880000000, size 36891, adler 0x5909a701
    B frame, track 1, timestamp 00:00:01.800000000, size 7075, adler 0x7504c0b2
    B frame, track 1, timestamp 00:00:01.760000000, size 6592, adler 0x437bd9fa
    B frame, track 1, timestamp 00:00:01.840000000, size 5755, adler 0x703a229b
    P frame, track 1, timestamp 00:00:02.040000000, size 36415, adler 0xfe9cd7a8
    B frame, track 1, timestamp 00:00:01.960000000, size 7655, adler 0xf2b9fad3
    B frame, track 1, timestamp 00:00:01.920000000, size 6648, adler 0x8cff0665
    B frame, track 1, timestamp 00:00:02.000000000, size 5399, adler 0x990d80ca
    P frame, track 1, timestamp 00:00:02.200000000, size 32527, adler 0x10dc3c92
    B frame, track 1, timestamp 00:00:02.120000000, size 6527, adler 0x59bd90cf
    B frame, track 1, timestamp 00:00:02.080000000, size 6332, adler 0x736b5126
    B frame, track 1, timestamp 00:00:02.160000000, size 6311, adler 0xddd0475c
    P frame, track 1, timestamp 00:00:02.360000000, size 74007, adler 0x4eb3c498
    B frame, track 1, timestamp 00:00:02.280000000, size 17659, adler 0x3cc15bb3
    B frame, track 1, timestamp 00:00:02.240000000, size 9000, adler 0x6e0c837c
    B frame, track 1, timestamp 00:00:02.320000000, size 2435, adler 0xe3c9a9cf
    P frame, track 1, timestamp 00:00:02.520000000, size 39855, adler 0xd62dfca6
    B frame, track 1, timestamp 00:00:02.440000000, size 6015, adler 0x27837872
    B frame, track 1, timestamp 00:00:02.400000000, size 2212, adler 0x998f2686
    B frame, track 1, timestamp 00:00:02.480000000, size 8823, adler 0xb44a9ff3
    I frame, track 1, timestamp 00:00:02.680000000, size 10843, adler 0xbe6d5334
    P frame, track 1, timestamp 00:00:02.700000000, size 10711, adler 0xb9730dc4
    B frame, track 1, timestamp 00:00:02.600000000, size 13931, adler 0xb9919764
    B frame, track 1, timestamp 00:00:02.620000000, size 11915, adler 0x22d95c4c
    B frame, track 1, timestamp 00:00:02.560000000, size 6816, adler 0xefd6791d
    B frame, track 1, timestamp 00:00:02.580000000, size 10704, adler 0x8af1b5e8
    B frame, track 1, timestamp 00:00:02.640000000, size 10923, adler 0x8e5a066c
    B frame, track 1, timestamp 00:00:02.660000000, size 10763, adler 0xe9c3075c
    P frame, track 1, timestamp 00:00:02.840000000, size 10983, adler 0x40a60dbd
    P frame, track 1, timestamp 00:00:02.860000000, size 10671, adler 0xdfd00c7f
    B frame, track 1, timestamp 00:00:02.760000000, size 11007, adler 0x61980d40
    B frame, track 1, timestamp 00:00:02.780000000, size 10663, adler 0x5a730bfe
    B frame, track 1, timestamp 00:00:02.720000000, size 10988, adler 0x1c5c04f3
    B frame, track 1, timestamp 00:00:02.740000000, size 10716, adler 0xc0d90573
    B frame, track 1, timestamp 00:00:02.800000000, size 10975, adler 0x0aa0162a
    B frame, track 1, timestamp 00:00:02.820000000, size 10711, adler 0xad3e11f8
    P frame, track 1, timestamp 00:00:03.000000000, size 10923, adler 0x3f5b1344
    P frame, track 1, timestamp 00:00:03.020000000, size 10723, adler 0xd5021196
    B frame, track 1, timestamp 00:00:02.920000000, size 10855, adler 0x52b4125c
    B frame, track 1, timestamp 00:00:02.940000000, size 10819, adler 0xc1a31008
    B frame, track 1, timestamp 00:00:02.880000000, size 10728, adler 0x3a2f04fa
    B frame, track 1, timestamp 00:00:02.900000000, size 10808, adler 0xd4b904dc
    B frame, track 1, timestamp 00:00:02.960000000, size 10727, adler 0xac8f0f86
    B frame, track 1, timestamp 00:00:02.980000000, size 11335, adler 0xbba50c72
    P frame, track 1, timestamp 00:00:03.160000000, size 10719, adler 0x0767b334
    P frame, track 1, timestamp 00:00:03.180000000, size 10735, adler 0xfe122b31
    B frame, track 1, timestamp 00:00:03.080000000, size 10579, adler 0x61b04f0d
    B frame, track 1, timestamp 00:00:03.100000000, size 10679, adler 0x7ae147be
    B frame, track 1, timestamp 00:00:03.040000000, size 10540, adler 0x56b814eb
    B frame, track 1, timestamp 00:00:03.060000000, size 10624, adler 0xe8ec15f9
    B frame, track 1, timestamp 00:00:03.120000000, size 10635, adler 0xd1254408
    B frame, track 1, timestamp 00:00:03.140000000, size 10567, adler 0xa556400d
    P frame, track 1, timestamp 00:00:03.320000000, size 10519, adler 0xe8601b5d
    P frame, track 1, timestamp 00:00:03.340000000, size 10563, adler 0xc51690d2
    B frame, track 1, timestamp 00:00:03.240000000, size 10535, adler 0x871a8e8c
    B frame, track 1, timestamp 00:00:03.260000000, size 10543, adler 0xd3df8a56
    B frame, track 1, timestamp 00:00:03.200000000, size 10536, adler 0x61fa6646
    B frame, track 1, timestamp 00:00:03.220000000, size 10512, adler 0x2a306249
    B frame, track 1, timestamp 00:00:03.280000000, size 10507, adler 0x1c279a92
    B frame, track 1, timestamp 00:00:03.300000000, size 10535, adler 0x19f38dc7
    P frame, track 1, timestamp 00:00:03.480000000, size 10543, adler 0x0b3319cc
    P frame, track 1, timestamp 00:00:03.500000000, size 10491, adler 0xe18402dd
    B frame, track 1, timestamp 00:00:03.400000000, size 10499, adler 0x902fface
    B frame, track 1, timestamp 00:00:03.420000000, size 10519, adler 0x81f7df74
    B frame, track 1, timestamp 00:00:03.360000000, size 10564, adler 0xe1c8b277
    B frame, track 1, timestamp 00:00:03.380000000, size 10548, adler 0x9c69a855
    B frame, track 1, timestamp 00:00:03.440000000, size 10583, adler 0x196aeb42
    B frame, track 1, timestamp 00:00:03.460000000, size 10603, adler 0xa703de25
    P frame, track 1, timestamp 00:00:03.640000000, size 10599, adler 0x09d6fabf
    P frame, track 1, timestamp 00:00:03.660000000, size 10587, adler 0xa81d1252
    B frame, track 1, timestamp 00:00:03.560000000, size 10587, adler 0x548161cb
    B frame, track 1, timestamp 00:00:03.580000000, size 10567, adler 0x3f60596b
    B frame, track 1, timestamp 00:00:03.520000000, size 10548, adler 0x7b81e47f
    B frame, track 1, timestamp 00:00:03.540000000, size 10404, adler 0x2441f26b
    B frame, track 1, timestamp 00:00:03.600000000, size 10387, adler 0x7b743cb4
    B frame, track 1, timestamp 00:00:03.620000000, size 10367, adler 0x814542a7
    P frame, track 1, timestamp 00:00:03.800000000, size 10375, adler 0xc4f6d1fd
    P frame, track 1, timestamp 00:00:03.820000000, size 10383, adler 0xc5ff41cd
    B frame, track 1, timestamp 00:00:03.720000000, size 10395, adler 0xe220a4b2
    B frame, track 1, timestamp 00:00:03.740000000, size 10391, adler 0xea3e9b31
    B frame, track 1, timestamp 00:00:03.680000000, size 10384, adler 0xbc26248b
    B frame, track 1, timestamp 00:00:03.700000000, size 10376, adler 0xba2e19cc
    B frame, track 1, timestamp 00:00:03.760000000, size 10371, adler 0x2caa6b87
    B frame, track 1, timestamp 00:00:03.780000000, size 10371, adler 0x38fd8776
    

As you can see, the packets are initially 40ms long, but then switch to a length of 20ms (2560ms is the first packet according to pts with a length of 20ms; in decoding order, the first is the packet with a pts of 2680ms).
As we see here, apart from the initial problems, the problems only happen after the switch to packets with one field only. The packets whose pts gets adjusted are exactly the packets that have more than two packets that precede them in coding order and follow them in display order (I used -copyts to make the timestamps more easily comparable with the above; I also redirected stderr to stdout and redirected this to a file):

ffmpeg -copyts -i a.mkv -an -sn -c:v copy -f framehash -hash crc32 -
ffmpeg version N-91317-gb41b6b3234 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7.3.0 (GCC)
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 18.102 / 56. 18.102
  libavcodec     58. 20.102 / 58. 20.102
  libavformat    58. 17.100 / 58. 17.100
  libavdevice    58.  4.101 / 58.  4.101
  libavfilter     7. 25.100 /  7. 25.100
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
Input #0, matroska,webm, from 'a.mkv':
  Metadata:
    title           : T2 Trainspotting
    encoder         : libebml v1.3.5 + libmatroska v1.4.8
    creation_time   : 2017-11-07T07:24:00.000000Z
    DATE_BROADCASTED: 2017-11-05 20:00:00
    ORIGINAL_MEDIA_TYPE: TV
    TVCHANNEL       : HBO HD
    SUMMARY         : Na počátku byla příležitost... a pak přišla zrada. Uplynulo dvacet let. Mark Renton se vrací na jediné místo, které mu kdy bylo domovem. Čekají tu na něj: Spud, Sick Boy a Begbie. Na počátku byla příležitost... a pak přišla zrada. Upl
                    : Režie: Danny Boyle 
                    : Hrají: Ewan McGregor, Ewen Bremner, Jonny Lee Miller, Robert Carlyle, Shirley Hendersonová 
                    : (2017)
    SUMMARY-cze     : Na počátku byla příležitost... a pak přišla zrada. Uplynulo dvacet let. Mark Renton se vrací na jediné místo, které mu kdy bylo domovem. Čekají tu na něj: Spud, Sick Boy a Begbie. Na počátku byla příležitost... a pak přišla zrada. Upl
                    : Režie: Danny Boyle 
                    : Hrají: Ewan McGregor, Ewen Bremner, Jonny Lee Miller, Robert Carlyle, Shirley Hendersonová 
                    : (2017)
  Duration: 00:00:03.98, start: 0.120000, bitrate: 4543 kb/s
    Chapter #0:0: start 0.000000, end 4.104000
    Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
    Metadata:
      BPS             : 3900650
      BPS-eng         : 3900650
      DURATION        : 00:00:03.860000000
      DURATION-eng    : 00:00:03.860000000
      NUMBER_OF_FRAMES: 128
      NUMBER_OF_FRAMES-eng: 128
      NUMBER_OF_BYTES : 1882064
      NUMBER_OF_BYTES-eng: 1882064
      _STATISTICS_WRITING_APP: mkvmerge v16.0.0 ('Protest') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v16.0.0 ('Protest') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2017-11-07 07:24:00
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-11-07 07:24:00
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1(cze): Audio: ac3, 48000 Hz, stereo, fltp, 384 kb/s (default)
    Metadata:
      BPS             : 384000
      BPS-eng         : 384000
      DURATION        : 00:00:03.840000000
      DURATION-eng    : 00:00:03.840000000
      NUMBER_OF_FRAMES: 120
      NUMBER_OF_FRAMES-eng: 120
      NUMBER_OF_BYTES : 184320
      NUMBER_OF_BYTES-eng: 184320
      _STATISTICS_WRITING_APP: mkvmerge v16.0.0 ('Protest') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v16.0.0 ('Protest') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2017-11-07 07:24:00
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-11-07 07:24:00
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:2(qaa): Audio: ac3, 48000 Hz, stereo, fltp, 384 kb/s
    Metadata:
      BPS             : 384000
      BPS-eng         : 384000
      DURATION        : 00:00:03.840000000
      DURATION-eng    : 00:00:03.840000000
      NUMBER_OF_FRAMES: 120
      NUMBER_OF_FRAMES-eng: 120
      NUMBER_OF_BYTES : 184320
      NUMBER_OF_BYTES-eng: 184320
      _STATISTICS_WRITING_APP: mkvmerge v16.0.0 ('Protest') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v16.0.0 ('Protest') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2017-11-07 07:24:00
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-11-07 07:24:00
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:3(cze): Subtitle: dvb_subtitle (default)
    Metadata:
      BPS             : 0
      BPS-eng         : 0
      DURATION        : 00:00:00.000000000
      DURATION-eng    : 00:00:00.000000000
      NUMBER_OF_FRAMES: 0
      NUMBER_OF_FRAMES-eng: 0
      NUMBER_OF_BYTES : 0
      NUMBER_OF_BYTES-eng: 0
      _STATISTICS_WRITING_APP: mkvmerge v16.0.0 ('Protest') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v16.0.0 ('Protest') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2017-11-07 07:24:00
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-11-07 07:24:00
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:4(eng): Subtitle: dvb_subtitle
    Metadata:
      BPS             : 0
      BPS-eng         : 0
      DURATION        : 00:00:00.000000000
      DURATION-eng    : 00:00:00.000000000
      NUMBER_OF_FRAMES: 0
      NUMBER_OF_FRAMES-eng: 0
      NUMBER_OF_BYTES : 0
      NUMBER_OF_BYTES-eng: 0
      _STATISTICS_WRITING_APP: mkvmerge v16.0.0 ('Protest') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v16.0.0 ('Protest') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2017-11-07 07:24:00
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-11-07 07:24:00
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
#format: frame checksums
#version: 2
#hash: CRC32
#extradata 0,                              44, d00f21cc
#software: Lavf58.17.100
#tb 0: 1/1000
#media_type 0: video
#codec_id 0: h264
#dimensions 0: 1920x1080
#sar 0: 1/1
#stream#, dts,        pts, duration,     size, hash
Output #0, framehash, to 'pipe:':
  Metadata:
    title           : T2 Trainspotting
    SUMMARY         : Na počátku byla příležitost... a pak přišla zrada. Uplynulo dvacet let. Mark Renton se vrací na jediné místo, které mu kdy bylo domovem. Čekají tu na něj: Spud, Sick Boy a Begbie. Na počátku byla příležitost... a pak přišla zrada. Upl
                    : Režie: Danny Boyle 
                    : Hrají: Ewan McGregor, Ewen Bremner, Jonny Lee Miller, Robert Carlyle, Shirley Hendersonová 
                    : (2017)
    SUMMARY-cze     : Na počátku byla příležitost... a pak přišla zrada. Uplynulo dvacet let. Mark Renton se vrací na jediné místo, které mu kdy bylo domovem. Čekají tu na něj: Spud, Sick Boy a Begbie. Na počátku byla příležitost... a pak přišla zrada. Upl
                    : Režie: Danny Boyle 
                    : Hrají: Ewan McGregor, Ewen Bremner, Jonny Lee Miller, Robert Carlyle, Shirley Hendersonová 
                    : (2017)
    DATE_BROADCASTED: 2017-11-05 20:00:00
    ORIGINAL_MEDIA_TYPE: TV
    TVCHANNEL       : HBO HD
    encoder         : Lavf58.17.100
    Chapter #0:0: start 0.000000, end 4.104000
    Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      BPS             : 3900650
      BPS-eng         : 3900650
      DURATION        : 00:00:03.860000000
      DURATION-eng    : 00:00:03.860000000
      NUMBER_OF_FRAMES: 128
      NUMBER_OF_FRAMES-eng: 128
      NUMBER_OF_BYTES : 1882064
      NUMBER_OF_BYTES-eng: 1882064
      _STATISTICS_WRITING_APP: mkvmerge v16.0.0 ('Protest') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v16.0.0 ('Protest') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2017-11-07 07:24:00
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-11-07 07:24:00
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
0,         40,        120,       40,    94777, 321bcf54
[framehash @ 000000000238e4c0] Invalid DTS: 80 PTS: 40 in output stream 0:0, replacing by guess
0,         41,         41,       40,     9089, cec87821
[framehash @ 000000000238e4c0] Non-monotonous DTS in output stream 0:0; previous: 41, current: 0; changing to 41. This may result in incorrect timestamps in the output file.
0,         41,         41,       40,     7078, 0598d076
[framehash @ 000000000238e4c0] Non-monotonous DTS in output stream 0:0; previous: 41, current: 40; changing to 41. This may result in incorrect timestamps in the output file.
0,         41,         80,       40,     6445, 5bdaa059
0,         80,        280,       40,    29053, 84d80852
0,        120,        200,       40,     9993, 671ee2da
0,        160,        160,       40,     7834, f423be1a
0,        200,        240,       40,     8465, a5f19b9e
0,        240,        440,       40,    27425, abb9aba4
0,        280,        360,       40,    11253, 22a07a51
0,        320,        320,       40,     9290, ddadbf2f
0,        360,        400,       40,     9701, b76fbd1d
0,        400,        600,       40,    30773, b9064b3e
0,        440,        520,       40,    14157, 923adf1f
0,        480,        480,       40,     9242, 47728a03
0,        520,        560,       40,     7629, e56a53a5
0,        560,        760,       40,    25565, 8be710cd
0,        600,        680,       40,    10693, 016ddba1
0,        640,        640,       40,     9774, f4948dc5
0,        680,        720,       40,    17101, 09e72477
0,        720,        920,       40,    46313, 9159bbca
0,        760,        840,       40,    16829, 868bdf2a
0,        800,        800,       40,     8234, 3410a4f2
0,        840,        880,       40,    22653, bd4655d5
0,        880,       1080,       40,    43969, f7e08e7c
0,        920,       1000,       40,    22853, 9a780074
0,        960,        960,       40,    21042, a09d4895
0,       1000,       1040,       40,    14793, 5914f95f
0,       1040,       1240,       40,    34397, 23f13e0f
0,       1080,       1160,       40,    13173, e58f5c55
0,       1120,       1120,       40,    12178, a6ef0c71
0,       1160,       1200,       40,     9421, 9bdf7e16
0,       1200,       1400,       40,   104129, da9c4bfa
0,       1240,       1320,       40,    12081, 61e9c776
0,       1280,       1280,       40,    10242, bc5ea8ea
0,       1320,       1360,       40,     8205, f284e9c6
0,       1360,       1560,       40,    34769, edddd62c
0,       1400,       1480,       40,     9921, 959ab8af
0,       1440,       1440,       40,     7782, 58ba6584
0,       1480,       1520,       40,     7317, b47d8fa3
0,       1520,       1720,       40,    38765, aaf48c33
0,       1560,       1640,       40,     8117, 2aa8ef2e
0,       1600,       1600,       40,     7730, 33fe7dd3
0,       1640,       1680,       40,     6169, 7b0a6598
0,       1680,       1880,       40,    36897, 3f583477
0,       1720,       1800,       40,     7081, bdf048cf
0,       1760,       1760,       40,     6598, 132dc53a
0,       1800,       1840,       40,     5761, b3f84fc8
0,       1840,       2040,       40,    36421, c5f468b9
0,       1880,       1960,       40,     7661, b0a000b7
0,       1920,       1920,       40,     6654, 6baafa88
0,       1960,       2000,       40,     5405, 2709e1d3
0,       2000,       2200,       40,    32533, 4040952d
0,       2040,       2120,       40,     6533, 28fa6872
0,       2080,       2080,       40,     6338, 31c6d8a6
0,       2120,       2160,       40,     6317, d2a0d14c
0,       2160,       2360,       40,    74013, 511cc36a
0,       2200,       2280,       40,    17665, 3477c85a
0,       2240,       2240,       40,     9006, 13ee92ac
0,       2280,       2320,       40,     2441, 51adfd75
0,       2320,       2520,       40,    39861, 17e29df9
0,       2360,       2440,       40,     6021, 81095371
0,       2400,       2400,       40,     2218, 0646e1ea
0,       2440,       2480,       40,     8829, 72a89b34
0,       2480,       2680,       40,    10849, 9a527ace
0,       2520,       2700,       40,    10717, aba0f3cf
0,       2600,       2600,       40,    13937, f736cced
0,       2620,       2620,       40,    11921, cab021d0
[framehash @ 000000000238e4c0] Non-monotonous DTS in output stream 0:0; previous: 2620, current: 2560; changing to 2620. This may result in incorrect timestamps in the output file.
0,       2620,       2620,       40,     6822, 4968427a
[framehash @ 000000000238e4c0] Non-monotonous DTS in output stream 0:0; previous: 2620, current: 2580; changing to 2620. This may result in incorrect timestamps in the output file.
0,       2620,       2620,       40,    10710, f52cec21
0,       2640,       2640,       40,    10929, 82119af8
0,       2660,       2660,       40,    10769, 8afec68c
0,       2680,       2840,       40,    10989, 8ab5847f
0,       2700,       2860,       40,    10677, ec20eca3
0,       2760,       2760,       40,    11013, 6dd3ffdb
0,       2780,       2780,       40,    10669, edf9dda9
[framehash @ 000000000238e4c0] Non-monotonous DTS in output stream 0:0; previous: 2780, current: 2720; changing to 2780. This may result in incorrect timestamps in the output file.
0,       2780,       2780,       40,    10994, 6d9008aa
[framehash @ 000000000238e4c0] Non-monotonous DTS in output stream 0:0; previous: 2780, current: 2740; changing to 2780. This may result in incorrect timestamps in the output file.
0,       2780,       2780,       40,    10722, aa67a53c
0,       2800,       2800,       40,    10981, 08184de2
0,       2820,       2820,       40,    10717, 8214c628
0,       2840,       3000,       40,    10929, 7cb5e873
0,       2860,       3020,       40,    10729, 85ba0244
0,       2920,       2920,       40,    10861, 639ad6a3
0,       2940,       2940,       40,    10825, 5ee80ea0
[framehash @ 000000000238e4c0] Non-monotonous DTS in output stream 0:0; previous: 2940, current: 2880; changing to 2940. This may result in incorrect timestamps in the output file.
0,       2940,       2940,       40,    10734, 1b620f01
[framehash @ 000000000238e4c0] Non-monotonous DTS in output stream 0:0; previous: 2940, current: 2900; changing to 2940. This may result in incorrect timestamps in the output file.
0,       2940,       2940,       40,    10814, 83c73d4b
0,       2960,       2960,       40,    10733, 7f357872
0,       2980,       2980,       40,    11341, ba8bc2ae
0,       3000,       3160,       40,    10725, 9ba481ea
0,       3020,       3180,       40,    10741, 30f63f40
0,       3080,       3080,       40,    10585, 8dc58ee3
0,       3100,       3100,       40,    10685, e8338745
[framehash @ 000000000238e4c0] Non-monotonous DTS in output stream 0:0; previous: 3100, current: 3040; changing to 3100. This may result in incorrect timestamps in the output file.
0,       3100,       3100,       40,    10546, fb287906
[framehash @ 000000000238e4c0] Non-monotonous DTS in output stream 0:0; previous: 3100, current: 3060; changing to 3100. This may result in incorrect timestamps in the output file.
0,       3100,       3100,       40,    10630, 21d4da5c
0,       3120,       3120,       40,    10641, 6dfc258d
0,       3140,       3140,       40,    10573, ff8aa3be
0,       3160,       3320,       40,    10525, f1b7e69b
0,       3180,       3340,       40,    10569, 62c26d79
0,       3240,       3240,       40,    10541, 27097e89
0,       3260,       3260,       40,    10549, 32d353fb
[framehash @ 000000000238e4c0] Non-monotonous DTS in output stream 0:0; previous: 3260, current: 3200; changing to 3260. This may result in incorrect timestamps in the output file.
0,       3260,       3260,       40,    10542, 235c989c
[framehash @ 000000000238e4c0] Non-monotonous DTS in output stream 0:0; previous: 3260, current: 3220; changing to 3260. This may result in incorrect timestamps in the output file.
0,       3260,       3260,       40,    10518, e658a176
0,       3280,       3280,       40,    10513, 8083facb
0,       3300,       3300,       40,    10541, 3b8ef61e
0,       3320,       3480,       40,    10549, 8c4827c2
0,       3340,       3500,       40,    10497, 849902b6
0,       3400,       3400,       40,    10505, 5ff9a001
0,       3420,       3420,       40,    10525, a8e35e25
[framehash @ 000000000238e4c0] Non-monotonous DTS in output stream 0:0; previous: 3420, current: 3360; changing to 3420. This may result in incorrect timestamps in the output file.
0,       3420,       3420,       40,    10570, 5a847a96
[framehash @ 000000000238e4c0] Non-monotonous DTS in output stream 0:0; previous: 3420, current: 3380; changing to 3420. This may result in incorrect timestamps in the output file.
0,       3420,       3420,       40,    10554, cd9fa9ba
0,       3440,       3440,       40,    10589, cb489a1b
0,       3460,       3460,       40,    10609, 6cf62245
0,       3480,       3640,       40,    10605, cfcc5b20
0,       3500,       3660,       40,    10593, b16ab33f
0,       3560,       3560,       40,    10593, ba476313
0,       3580,       3580,       40,    10573, d3677461
[framehash @ 000000000238e4c0] Non-monotonous DTS in output stream 0:0; previous: 3580, current: 3520; changing to 3580. This may result in incorrect timestamps in the output file.
0,       3580,       3580,       40,    10554, 57099208
[framehash @ 000000000238e4c0] Non-monotonous DTS in output stream 0:0; previous: 3580, current: 3540; changing to 3580. This may result in incorrect timestamps in the output file.
0,       3580,       3580,       40,    10410, 68d969ba
0,       3600,       3600,       40,    10393, f37e3a67
0,       3620,       3620,       40,    10373, d28822ef
0,       3640,       3800,       40,    10381, 0cb35f44
0,       3660,       3820,       40,    10389, c5475cfd
0,       3720,       3720,       40,    10401, 29dc9499
0,       3740,       3740,       40,    10397, 446e66d1
[framehash @ 000000000238e4c0] Non-monotonous DTS in output stream 0:0; previous: 3740, current: 3680; changing to 3740. This may result in incorrect timestamps in the output file.
0,       3740,       3740,       40,    10390, 3b14944b
[framehash @ 000000000238e4c0] Non-monotonous DTS in output stream 0:0; previous: 3740, current: 3700; changing to 3740. This may result in incorrect timestamps in the output file.
0,       3740,       3740,       40,    10382, d0fb92bc
0,       3760,       3760,       40,    10377, 73601c7c
0,       3780,       3780,       40,    10377, 1bf10987
frame=  128 fps=0.0 q=-1.0 Lsize=       7kB time=00:00:03.78 bitrate=  15.7kbits/s speed= 315x    
video:1838kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Last edited 6 years ago by mkver (previous) (diff)

comment:14 by dustinkerstein, 5 years ago

Cc: dustin.kerstein@gmail.com added

comment:15 by Balling, 2 years ago

Status: newopen

Issue on nvidia forums about NVENC: https://forums.developer.nvidia.com/t/sei-nal-unit-resend-each-packet-on-h264/145653/2

vui->bitstreamRestrictionFlag = 1;
should be set for -bref middle

Last edited 2 years ago by Balling (previous) (diff)
Note: See TracTickets for help on using tickets.