Opened 9 years ago
Closed 8 years ago
#7092 closed defect (duplicate)
h264 parser emits every other video packet without pts for mbaff/paff inputs
| Reported by: | Aman | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | undetermined |
| Version: | git-master | Keywords: | |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
Expected:
Feeding h264 video into lavf would produce AVPackets with pts set.
Actual:
On some inputs (which are mbaff/paff), only every other AVPacket has pts set.
How to reproduce:
$ ffprobe -select_streams v -show_packets -print_format json http://tmm1.s3.amazonaws.com/uk-nopts.mpg
ffprobe version N-90375-ge5b4cd4c4a Copyright (c) 2007-2018 the FFmpeg developers
built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
configuration: --prefix=/tmp/ffmpeg-master --enable-libxml2 --enable-shared --disable-static --disable-stripping --disable-manpages
libavutil 56. 11.100 / 56. 11.100
libavcodec 58. 14.100 / 58. 14.100
libavformat 58. 10.100 / 58. 10.100
libavdevice 58. 2.100 / 58. 2.100
libavfilter 7. 13.100 / 7. 13.100
libswscale 5. 0.102 / 5. 0.102
libswresample 3. 0.101 / 3. 0.101
Input #0, mpegts, from 'http://tmm1.s3.amazonaws.com/uk-nopts.mpg':
Duration: 00:00:21.66, start: 2500.739878, bitrate: 5809 kb/s
Program 17664
Stream #0:0[0x12d]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x12e](eng): Audio: aac_latm (LC) ([17][0][0][0] / 0x0011), 48000 Hz, stereo, fltp
Stream #0:2[0x132](eng): Unknown: none ([17][0][0][0] / 0x0011) (visual impaired) (dependent)
Stream #0:3[0x131](eng): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
Unsupported codec with id 0 for input stream 2
{
"packets": [
{
"codec_type": "video",
"stream_index": 0,
"pts": 225158417,
"pts_time": "2501.760189",
"dts": 225147617,
"dts_time": "2501.640189",
"duration": 1800,
"duration_time": "0.020000",
"size": "30176",
"pos": "6016",
"flags": "__",
"side_data_list": [
{
"side_data_type": "MPEGTS Stream ID"
}
]
},
{
"codec_type": "video",
"stream_index": 0,
"duration": 1800,
"duration_time": "0.020000",
"size": "11828",
"flags": "__",
"side_data_list": [
{
"side_data_type": "MPEGTS Stream ID"
}
]
},
{
"codec_type": "video",
"stream_index": 0,
"pts": 225154817,
"pts_time": "2501.720189",
"dts": 225151217,
"dts_time": "2501.680189",
"duration": 1800,
"duration_time": "0.020000",
"size": "8334",
"pos": "50008",
"flags": "__"
},
{
"codec_type": "video",
"stream_index": 0,
"duration": 1800,
"duration_time": "0.020000",
"size": "7151",
"flags": "__",
"side_data_list": [
{
"side_data_type": "MPEGTS Stream ID"
}
]
},
{
"codec_type": "video",
"stream_index": 0,
"pts": 225162017,
"pts_time": "2501.800189",
"dts": 225154817,
"dts_time": "2501.720189",
"duration": 1800,
"duration_time": "0.020000",
"size": "10301",
"pos": "66364",
"flags": "__"
q },
{
"codec_type": "video",
"stream_index": 0,
"duration": 1800,
"duration_time": "0.020000",
"size": "7819",
"flags": "__",
"side_data_list": [
{
"side_data_type": "MPEGTS Stream ID"
}
]
},
{
"codec_type": "video",
"stream_index": 0,
"pts": 225194417,
"pts_time": "2502.160189",
"dts": 225158417,
"dts_time": "2501.760189",
"duration": 1800,
"duration_time": "0.020000",
"size": "93387",
"pos": "85540",
"flags": "__"
},
{
"codec_type": "video",
"stream_index": 0,
"duration": 1800,
"duration_time": "0.020000",
"size": "23562",
"flags": "__",
"side_data_list": [
{
"side_data_type": "MPEGTS Stream ID"
}
]
},
...
Change History (3)
follow-up: 3 comment:1 by , 9 years ago
comment:2 by , 8 years ago
I discovered that I can fix the ffprobe output by telling the mpegts demuxer not to parse H264 streams:
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 76d5bbb920..5fca4e822a 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -894,6 +894,9 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
st->codecpar->codec_id = AV_CODEC_ID_BIN_DATA;
st->request_probe = AVPROBE_SCORE_STREAM_RETRY / 5;
}
+ if (st->codecpar->codec_id == AV_CODEC_ID_H264) {
+ st->need_parsing = AVSTREAM_PARSE_HEADERS;
+ }
/* queue a context update if properties changed */
if (old_codec_type != st->codecpar->codec_type ||
However, then there are problems decoding the video for some reason.
comment:3 by , 8 years ago
| Resolution: | → duplicate |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.



This is essentially a duplicate of #6903.