Ticket #1836 (closed defect: fixed)
Wrong duration in TS container
| Reported by: | Heesuk Jung | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | avformat |
| Version: | git-master | Keywords: | mpegts |
| Cc: | dwkang@…, myungchul.kim@…, suhwang.kim@…, woojun.jung@…, donggul.kim@…, hojae.lee@…, kubong.min@…, wonsik@… | Blocked By: | |
| Blocking: | Reproduced by developer: | yes | |
| Analyzed by developer: | no |
Description
Summary of the bug:
In some TS file case, libavformat get wrong duration
and so there are some problem when the file is played.
- 1st problematic file case
- link : https://docs.google.com/open?id=0B6r7ZfWFIypCN0Q2VmZiUHdsQW8
- incorrect duration based on libavformat : 24:08:38.61
- correct duration : 00:01:12.00
- 2nd problematic file case
- link : https://docs.google.com/open?id=0B6r7ZfWFIypCNFVuWHowMFBBN0E
- incorrect duration based on libavformat : 00:03:15.50
- correct duration : 00:00:21.30
How to reproduce:
% ffprobe 473_TP_MPEG2[Main@High@1419Kbps@1080p@29.970fps]_AC3[384Kbps@48kHz@16bit@2ch].tp
Attachments
Change History
comment:1 Changed 7 months ago by cehoyos
- Keywords mpegts added; wrong duration in TS container removed
comment:2 Changed 7 months ago by Heesuk Jung
hsjung@ubuntu:~/work/ffmpeg$ ffmpeg -i download/473_TP_MPEG2\[Main@High@1419Kbps@1080p@29.970fps\]_AC3\[384Kbps@48kHz@16bit@2ch\].tp -f null -
ffmpeg version git-2012-10-08-43c157f Copyright (c) 2000-2012 the FFmpeg developers
built on Oct 8 2012 06:19:26 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --enable-gpl --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree --enable-version3
libavutil 51. 73.102 / 51. 73.102
libavcodec 54. 65.100 / 54. 65.100
libavformat 54. 30.100 / 54. 30.100
libavdevice 54. 3.100 / 54. 3.100
libavfilter 3. 19.102 / 3. 19.102
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 16.100 / 0. 16.100
libpostproc 52. 1.100 / 52. 1.100
[mpeg2video @ 0x1db3e80] mpeg_decode_postinit() failure
Last message repeated 11 times
[mpegts @ 0x1db3260] PES packet size mismatch
Input #0, mpegts, from 'download/473_TP_MPEG2[Main@High@1419Kbps@1080p@29.970fps]_AC3[384Kbps@48kHz@16bit@2ch].tp':
Duration: 00:03:15.50, start: 78313.376611, bitrate: 1900 kb/s
Program 1
Stream #0:0[0x11]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 1920x1088 [SAR 136:135 DAR 16:9], 17400 kb/s, 35.42 fps, 29.97 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x14]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, s16, 384 kb/s
Output #0, null, to 'pipe:':
Metadata:
encoder : Lavf54.30.100
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1088 [SAR 136:135 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 29.97 tbc
Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video -> rawvideo)
Stream #0:1 -> #0:1 (ac3 -> pcm_s16le)
Press [q] to stop, [?] for help
[null @ 0x1dba1a0] Encoder did not produce proper pts, making some up.
frame CRC mismatch5 q=0.0 size= 0kB time=00:00:19.55 bitrate= 0.0kbits/s dup=24 drop=0
[mpegts @ 0x1db3260] PES packet size mismatch
[mpeg2video @ 0x1db3e80] ac-tex damaged at 41 25
[mpeg2video @ 0x1db3e80] Warning MVs not available
[mpeg2video @ 0x1db3e80] concealing 5120 DC, 5120 AC, 5120 MV errors in I frame
[ac3 @ 0x1db6d20] incomplete frame
frame= 625 fps=145 q=0.0 Lsize= 0kB time=00:00:20.85 bitrate= 0.0kbits/s dup=26 drop=0
video:59kB audio:3834kB subtitle:0 global headers:0kB muxing overhead -100.000000%
hsjung@ubuntu:~/work/ffmpeg$
comment:3 Changed 7 months ago by Heesuk Jung
hsjung@ubuntu:~/work/ffmpeg$ ffmpeg -i download/\[2\]\ trp_MPEG2_MP2.trp -f null -ffmpeg version git-2012-10-08-43c157f Copyright (c) 2000-2012 the FFmpeg developers
built on Oct 8 2012 06:19:26 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --enable-gpl --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree --enable-version3
libavutil 51. 73.102 / 51. 73.102
libavcodec 54. 65.100 / 54. 65.100
libavformat 54. 30.100 / 54. 30.100
libavdevice 54. 3.100 / 54. 3.100
libavfilter 3. 19.102 / 3. 19.102
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 16.100 / 0. 16.100
libpostproc 52. 1.100 / 52. 1.100
[mp2 @ 0x1ee0a40] Header missing
[mp2 @ 0x1ed2480] Header missing
[mpegts @ 0x1e6e260] PES packet size mismatch
Input #0, mpegts, from 'download/[2] trp_MPEG2_MP2.trp':
Duration: 24:08:38.61, start: 2891.876900, bitrate: 19 kb/s
Program 1569
Metadata:
service_name : ONE HD
service_provider: Ten Sydney
Stream #0:0[0x204]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 10000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x2a0](eng): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, s16, 256 kb/s (clean effects)
Stream #0:2[0x242](eng): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
Program 1573
Metadata:
service_name : TEN Digital
service_provider: Ten Sydney
Stream #0:3[0x200]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 10000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:4[0x28a](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16, 256 kb/s (clean effects)
Stream #0:5[0x240](eng): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
Program 1575
Metadata:
service_name : ONE HD
service_provider: Ten Sydney
Stream #0:0[0x204]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 10000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x2a0](eng): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, s16, 256 kb/s (clean effects)
Stream #0:2[0x242](eng): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
Program 1576
Metadata:
service_name : ONE Digital
service_provider: Ten Sydney
Stream #0:0[0x204]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 10000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:6[0x2a9](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16, 256 kb/s
Stream #0:2[0x242](eng): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
Output #0, null, to 'pipe:':
Metadata:
encoder : Lavf54.30.100
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 720x576 [SAR 64:45 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream #0:1(eng): Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s (clean effects)
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video -> rawvideo)
Stream #0:1 -> #0:1 (ac3 -> pcm_s16le)
Press [q] to stop, [?] for help
[ac3 @ 0x1e76360] frame sync error
Error while decoding stream #0:1: Operation not permitted
[null @ 0x238bbc0] Encoder did not produce proper pts, making some up.
PES packet size mismatch0 size= 0kB time=00:01:07.00 bitrate= 0.0kbits/s dup=7 drop=0
[mpeg2video @ 0x1e75a00] ac-tex damaged at 29 4
[mpeg2video @ 0x1e75a00] Warning MVs not available
[mpeg2video @ 0x1e75a00] concealing 1440 DC, 1440 AC, 1440 MV errors in B frame
[ac3 @ 0x1e76360] incomplete frame
frame= 1814 fps=481 q=0.0 Lsize= 0kB time=00:01:12.56 bitrate= 0.0kbits/s dup=7 drop=0
video:170kB audio:13554kB subtitle:0 global headers:0kB muxing overhead -100.000000%
hsjung@ubuntu:~/work/ffmpeg$
comment:4 Changed 7 months ago by Heesuk Jung
After applying patch, there are log for 473_XXX file.
hsjung@ubuntu:~/work/ffmpeg$ ./ffmpeg -i download/473_TP_MPEG2\[Main@High@1419Kbps@1080p@29.970fps\]_AC3\[384Kbps@48kHz@16bit@2ch\].tp -f null -
ffmpeg version git-2012-10-21-99ea47f Copyright (c) 2000-2012 the FFmpeg developers
built on Oct 21 2012 07:05:42 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --enable-gpl --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree --enable-version3
libavutil 51. 76.101 / 51. 76.101
libavcodec 54. 67.100 / 54. 67.100
libavformat 54. 33.100 / 54. 33.100
libavdevice 54. 3.100 / 54. 3.100
libavfilter 3. 19.103 / 3. 19.103
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 16.100 / 0. 16.100
libpostproc 52. 1.100 / 52. 1.100
[mpeg2video @ 0x2695e80] mpeg_decode_postinit() failure
Last message repeated 11 times
[mpegts @ 0x2695260] Estimating duration from bitrate, this may be inaccurate
Input #0, mpegts, from 'download/473_TP_MPEG2[Main@High@1419Kbps@1080p@29.970fps]_AC3[384Kbps@48kHz@16bit@2ch].tp':
Duration: 00:00:21.30, start: 78313.376611, bitrate: 17441 kb/s
Program 1
Stream #0:0[0x11]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 1920x1088 [SAR 136:135 DAR 16:9], 17400 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x14]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, s16, 384 kb/s
Output #0, null, to 'pipe:':
Metadata:
encoder : Lavf54.33.100
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1088 [SAR 136:135 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 29.97 tbc
Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video -> rawvideo)
Stream #0:1 -> #0:1 (ac3 -> pcm_s16le)
Press [q] to stop, [?] for help
[null @ 0x269c200] Encoder did not produce proper pts, making some up.
frame CRC mismatch0 q=0.0 size= 0kB time=00:00:20.08 bitrate= 0.0kbits/s dup=24 drop=0
[mpegts @ 0x2695260] PES packet size mismatch
[mpeg2video @ 0x2695e80] ac-tex damaged at 41 25
[mpeg2video @ 0x2695e80] Warning MVs not available
[mpeg2video @ 0x2695e80] concealing 5120 DC, 5120 AC, 5120 MV errors in I frame
[ac3 @ 0x2698d20] incomplete frame
frame= 625 fps=148 q=0.0 Lsize= 0kB time=00:00:20.85 bitrate= 0.0kbits/s dup=26 drop=0
video:59kB audio:3834kB subtitle:0 global headers:0kB muxing overhead -100.000000%
hsjung@ubuntu:~/work/ffmpeg$
comment:5 Changed 7 months ago by cehoyos
- Status changed from new to open
- Reproduced by developer set
comment:6 Changed 7 months ago by cehoyos
The duration of \[2\]\ trp_MPEG2_MP2.trp was fixed by Michael.
Changed 7 months ago by Heesuk Jung
-
attachment
0001-PATCH-Wrong-duration-in-TS-container-Ticket-1836.patch
added
Resolving Patch
Changed 7 months ago by Heesuk Jung
-
attachment
0001-Wrong-duration-in-TS-container-Ticket-1836.patch
added
Resolving Patch
comment:7 Changed 7 months ago by lingjiujianke
The patch can make new bug "Floating point exception "
break down at
Program terminated with signal 8, Arithmetic exception.
#0 0x0000000000594a6f in check_duration_using_bit_rate (ic=0xfffffffffffffb50, options=0x33efce0) at libavformat/utils.c:2029
2029 duration > (filesize*8/(bit_rate/1000)*limit_filesize_multiple*1000)) {
full command line is
ffmpeg -i input.mkv -force_key_frames 1,4,8,13,18,24,28,32,36,40,44,48,52,56,60,64,68 -strict experimental -acodec aac -vcodec libx264 -map 0:0 -map 0:1 -b:v 2000k -r 25 -b:a 88k -ar 44100 -preset ultrafast -vprofile main -vlevel 2.0 -f segment -segment_format mpegts -segment_list a.m3u8 -segment_times 1,4,8,13,18,24,28,32,36,40,44,48,52,56,60,64,68 -segment_time_delta 0.05 -bsf h264_mp4toannexb -v debug -s 1280x720 -async 1 output-%d.ts
Changed 7 months ago by Heesuk Jung
-
attachment
0001-Wrong-duration-in-TS-container-Ticket-1836.2.patch
added
Resolving Patch
comment:8 Changed 7 months ago by Heesuk Jung
Hi Liu,
Please check your problematic file with 0001-Wrong-duration-in-TS-container-Ticket-1836.2.patch. I did regression test for 472 files and tried to transcode from some MKV file according to your ffmpeg comand.
All test result is OK and it does not happen "Floating point exception ".
If you still have some problem, let me know problematic file link.
(I recommend that you did test with latest master. Because I submitted other related patch for this issue)
Thanks !
Changed 7 months ago by Heesuk Jung
-
attachment
0001-Wrong-duration-in-TS-container-Ticket-1836.3.patch
added
Resolving Patch
comment:10 Changed 6 months ago by ramitbhalla
Is this problem fixed?
comment:11 Changed 6 months ago by Heesuk Jung
This problem is partially fixed and 2nd problematic file is not fixed.
(I found solution resolving 2nd problematic file but the solution makes some side effect in other files.)
I am trying to consider other approach.
Thanks.
Changed 6 months ago by Heesuk Jung
-
attachment
0001-Wrong-duration-in-TS-container-Ticket-1836.4.patch
added
Resolving Patch
comment:12 Changed 6 months ago by Heesuk Jung
Fixed 2nd problematic file.
Thanks
Changed 6 months ago by Heesuk Jung
-
attachment
0001-Wrong-duration-in-TS-container-Ticket-1836.5.patch
added
Resolving Patch
comment:13 Changed 2 months ago by michael
- Status changed from open to closed
- Resolution set to fixed
Both files seem to get a good duration with latest ffmpeg.
Dont know which commit fixed the second file though
comment:14 Changed 2 months ago by cehoyos
First file fixed in 5442c6c, second file fixed in faa0068, see ticket #2018



To make this a valid ticket, please add the complete, uncut console output of "ffmpeg -i \[2\]\ trp_MPEG2_MP2.trp -f null -" and / or "ffmpeg -i 473_TP_MPEG2\[Main\@High\@1419Kbps\@1080p\@29.970fps\]_AC3\[384Kbps\@48kHz\@16bit\@2ch\].tp -f null -"
(The output will show both the calculated duration and the actual duration.)