Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#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@google.com, myungchul.kim@lge.com, suhwang.kim@lge.com, woojun.jung@lge.com, donggul.kim@lge.com, hojae.lee@lge.com, kubong.min@lge.com, wonsik@google.com 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.

  1. 1st problematic file case
  1. 2nd problematic file case

How to reproduce:
% ffprobe 473_TP_MPEG2[Main@High@1419Kbps@1080p@29.970fps]_AC3[384Kbps@48kHz@16bit@2ch].tp

Attachments (6)

0001-PATCH-Wrong-duration-in-TS-container-Ticket-1836.patch (5.4 KB ) - added by Heesuk Jung 11 years ago.
Resolving Patch
0001-Wrong-duration-in-TS-container-Ticket-1836.patch (5.4 KB ) - added by Heesuk Jung 11 years ago.
Resolving Patch
0001-Wrong-duration-in-TS-container-Ticket-1836.2.patch (5.5 KB ) - added by Heesuk Jung 11 years ago.
Resolving Patch
0001-Wrong-duration-in-TS-container-Ticket-1836.3.patch (5.5 KB ) - added by Heesuk Jung 11 years ago.
Resolving Patch
0001-Wrong-duration-in-TS-container-Ticket-1836.4.patch (2.6 KB ) - added by Heesuk Jung 11 years ago.
Resolving Patch
0001-Wrong-duration-in-TS-container-Ticket-1836.5.patch (2.5 KB ) - added by Heesuk Jung 11 years ago.
Resolving Patch

Download all attachments as: .zip

Change History (20)

comment:1 by Carl Eugen Hoyos, 11 years ago

Keywords: mpegts added; wrong duration in TS container removed

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.)

comment:2 by Heesuk Jung, 11 years ago

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$ 
Last edited 11 years ago by Carl Eugen Hoyos (previous) (diff)

comment:3 by Heesuk Jung, 11 years ago

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$
Last edited 11 years ago by Carl Eugen Hoyos (previous) (diff)

comment:4 by Heesuk Jung, 11 years ago

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$
Last edited 11 years ago by Heesuk Jung (previous) (diff)

comment:5 by Carl Eugen Hoyos, 11 years ago

Reproduced by developer: set
Status: newopen

comment:6 by Carl Eugen Hoyos, 11 years ago

The duration of \[2\]\ trp_MPEG2_MP2.trp was fixed by Michael.

by Heesuk Jung, 11 years ago

Resolving Patch

by Heesuk Jung, 11 years ago

Resolving Patch

comment:7 by Steven Liu, 11 years ago

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

by Heesuk Jung, 11 years ago

Resolving Patch

comment:8 by Heesuk Jung, 11 years ago

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 !

by Heesuk Jung, 11 years ago

Resolving Patch

comment:9 by Heesuk Jung, 11 years ago

Hi Liu,

Please check update latest patch.

Thanks !

comment:10 by ramitb, 11 years ago

Is this problem fixed?

comment:11 by Heesuk Jung, 11 years ago

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.

by Heesuk Jung, 11 years ago

Resolving Patch

comment:12 by Heesuk Jung, 11 years ago

Fixed 2nd problematic file.

Thanks

by Heesuk Jung, 11 years ago

Resolving Patch

comment:13 by Michael Niedermayer, 11 years ago

Resolution: fixed
Status: openclosed

Both files seem to get a good duration with latest ffmpeg.
Dont know which commit fixed the second file though

comment:14 by Carl Eugen Hoyos, 11 years ago

First file fixed in 5442c6c, second file fixed in faa0068, see ticket #2018

Note: See TracTickets for help on using tickets.