Opened 8 years ago
Last modified 3 years ago
#5474 new defect
pgssub with backward moving timestamps
Reported by: | Carl Eugen Hoyos | Owned by: | |
---|---|---|---|
Priority: | important | Component: | ffmpeg |
Version: | git-master | Keywords: | pgssub regression |
Cc: | Michael Niedermayer, reimar | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
The subtitles in the sample from ticket #4637 cannot be remuxed to mkv since 38e13f55
$ ffmpeg -i darkgraysubs.m2ts -scodec copy out.mkv ffmpeg version N-79598-gdbe1dd5 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.7 (SUSE Linux) configuration: --enable-gpl libavutil 55. 22.101 / 55. 22.101 libavcodec 57. 38.100 / 57. 38.100 libavformat 57. 34.103 / 57. 34.103 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 44.100 / 6. 44.100 libswscale 4. 1.100 / 4. 1.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 Input #0, mpegts, from 'darkgraysubs.m2ts': Duration: 01:57:18.53, start: 600.000000, bitrate: 0 kb/s Program 1 Stream #0:0[0x1011]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1280x720, 23.98 fps, 23.98 tbr, 90k tbn Stream #0:1[0x1100](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 96 kb/s Stream #0:2[0x1200](eng): Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1280x720 [matroska @ 0x39fd440] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead. Last message repeated 2 times Output #0, matroska, to 'out.mkv': Metadata: encoder : Lavf57.34.103 Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1280x720, q=2-31, 200 kb/s, 23.98 fps, 1k tbn Metadata: encoder : Lavc57.38.100 mpeg4 Side data: cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1 Stream #0:1(eng): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, fltp, 192 kb/s Metadata: encoder : Lavc57.38.100 ac3 Stream #0:2(eng): Subtitle: hdmv_pgs_subtitle ([255][255][255][255] / 0xFFFFFFFF), 1280x720 Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> mpeg4 (native)) Stream #0:1 -> #0:1 (ac3 (native) -> ac3 (native)) Stream #0:2 -> #0:2 (copy) Press [q] to stop, [?] for help [matroska @ 0x39fd440] Application provided invalid, non monotonically increasing dts to muxer in stream 2: 2002 >= 1973 av_interleaved_write_frame(): Invalid argument frame= 40 fps=0.0 q=2.0 Lsize= 106kB time=00:00:02.04 bitrate= 426.7kbits/s speed=29.3x video:56kB audio:48kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.484462% Conversion failed!
Change History (5)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Cc: | added |
---|
comment:3 by , 8 years ago
If I play darkgraysubs.m2ts with current FFplay, the subtitles appear after two seconds for approximately seven seconds. If I run above command line with FFmpeg 2.0, I can play the output mkv file with current FFplay, and again the subtitles appear after two seconds for around seven seconds, same with vlc and MPlayer.
comment:4 by , 8 years ago
Cc: | added |
---|---|
Summary: | pgssub remuxing regression → pgssub with backward moving timestamps |
The timestamps go backward, the error about dts is as such correct
Packet dts:180180 pts:180180
pts 2002000
Packet dts:180151 pts:180151
pts 2001678
Packet dts:177559 pts:177559
pts 1972878
Packet dts:177617 pts:177617
pts 1973522
Packet dts:177617 pts:177617
pts 2002000
diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index 133d08b..9c52e46 100644 --- a/libavcodec/pgssubdec.c +++ b/libavcodec/pgssubdec.c @@ -637,7 +637,7 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, return -1; buf_end = buf + buf_size; - +av_log(0,0, "Packet dts:%Ld pts:%Ld\n", avpkt->dts, avpkt->pts); /* Step through buffer to identify segments */ while (buf < buf_end) { segment_type = bytestream_get_byte(&buf); @@ -685,7 +685,7 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, buf += segment_length; } - +av_log(0,0, "pts %Ld\n", ((AVSubtitle*)(data))->pts); return buf_size; }
Maybe the maintainer (in CC) can take a look or comment
comment:5 by , 3 years ago
Why not just revert 38e13f55a5a34d3ad3eea25a0a7bb23a223a3583? If it regressed something in the place it should actually permit more stuff then it is just wrong. Also, I wonder: how many hacks are there in our code about dts/pts? Like this one: https://github.com/FFmpeg/FFmpeg/blob/ab4f299e237708e81af473c88ec5acf0dd13d8eb/fftools/ffmpeg.c#L1236
This is now here, BTW. https://github.com/FFmpeg/FFmpeg/blob/ab4f299e237708e81af473c88ec5acf0dd13d8eb/fftools/ffmpeg.c#L4572
Also it works now!
[matroska @ 000001f9ecdded00] Non-monotonous DTS in output stream 0:2; previous: 2002, current: 1973; changing to 2002. This may result in incorrect timestamps in the output file. [matroska @ 000001f9ecdded00] Non-monotonous DTS in output stream 0:2; previous: 2002, current: 1974; changing to 2002. This may result in incorrect timestamps in the output file. [matroska @ 000001f9ecdded00] Non-monotonous DTS in output stream 0:2; previous: 2002, current: 1974; changing to 2002. This may result in incorrect timestamps in the output file. [matroska @ 000001f9ecdded00] Non-monotonous DTS in output stream 0:2; previous: 7036530, current: 7036501; changing to 7036530. This may result in incorrect timestamps in the output file. [matroska @ 000001f9ecdded00] Non-monotonous DTS in output stream 0:2; previous: 7036530, current: 7036501; changing to 7036530. This may result in incorrect timestamps in the output file. [matroska @ 000001f9ecdded00] Non-monotonous DTS in output stream 0:2; previous: 7036530, current: 7036501; changing to 7036530. This may result in incorrect timestamps in the output file. [matroska @ 000001f9ecdded00] Starting new cluster due to timestamp
Also see 88956f73f29c9f066718b4c83bb628872990b879.
Are you sure that the shifted timestamps from prior the regression where correct ?
iam not sure this is a regression and not out of order subtitles