[FFmpeg-trac] #7876(undetermined:new): Using copyts with mpegts output fails after 26, 5 hours

FFmpeg trac at avcodec.org
Tue Apr 30 20:58:15 EEST 2019


#7876: Using copyts with mpegts output fails after 26,5 hours
-------------------------------------+-------------------------------------
             Reporter:  malakudi     |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:  git-
  undetermined                       |  master
             Keywords:  copyts       |               Blocked By:
  mpegts                             |
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 When outputing to mpegts format, using -copyts option makes program fail
 after the oveflow of mpegts PCR happens at around 26 hours and 30 minutes.
 When not using -copyts, only a warning is reported.

 In order to reproduce the issue, you first have to create a 27 hour mpegts
 video. I create it like that:
 {{{
 ffmpeg-git -t 97200 -f lavfi -i color=color=red -f lavfi -i
 sine=frequency=1000 -filter_complex '[1:a][1:a]amerge=inputs=2[aout]' -map
 0:v -map '[aout]' -shortest -c:v libx264 -preset ultrafast -c:a libfdk_aac
 -ac 2 -vbr 2 -r 25 -f mpegts -y 27hours.ts
 }}}

 I named the produced file 27hours.ts and it takes around 760MB of disk
 space. It takes a while to create this file, depending on your CPU.

 Running now the following command creates tons of errors after 26h 30m.
 {{{
 ffmpeg-git -copyts -i 27hours.ts -c copy -f mpegts -y /dev/null
 ffmpeg version N-93715-gd0e4d0429e Copyright (c) 2000-2019 the FFmpeg
 developers
   built with gcc 8 (Debian 8.3.0-6)
   configuration: --disable-decoder=amrnb --disable-decoder=libopenjpeg
 --disable-libopencv --disable-podpages --disable-sndio --disa
 ble-debug --enable-libaom --enable-avfilter --enable-avresample --enable-
 gcrypt --enable-gnutls --enable-gpl --enable-libass --enabl
 e-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-
 libcodec2 --enable-libfdk-aac --enable-libfontconfig --enabl
 e-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm
 --enable-libilbc --enable-libkvazaar --enable-libmp3lame --enable-
 libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264
 --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable
 -libpulse --enable-librubberband --enable-libshine --enable-libsnappy
 --enable-libsoxr --enable-libspeex --enable-libtesseract --ena
 ble-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-
 libvorbis --enable-libvpx --enable-libx265 --enable-libxvid --ena
 ble-libzvbi --enable-libnpp --enable-cuda-nvcc --enable-nonfree --enable-
 opencl --enable-opengl --enable-postproc --enable-pthreads
 --enable-static --disable-shared --enable-version3 --enable-libwebp
 --incdir=/usr/include/x86_64-linux-gnu --libdir=/usr/lib/x86_64-
 linux-gnu --prefix=/usr --toolchain=hardened --enable-frei0r --enable-
 chromaprint --enable-libx264 --enable-libiec61883 --enable-lib
 dc1394 --enable-vaapi --enable-libmfx --disable-altivec --enable-libvmaf
 --shlibdir=/usr/lib/x86_64-linux-gnu
   libavutil      56. 26.100 / 56. 26.100
   libavcodec     58. 52.100 / 58. 52.100
   libavformat    58. 27.103 / 58. 27.103
   libavdevice    58.  7.100 / 58.  7.100
   libavfilter     7. 50.100 /  7. 50.100
   libavresample   4.  0.  0 /  4.  0.  0
   libswscale      5.  4.100 /  5.  4.100
   libswresample   3.  4.100 /  3.  4.100
   libpostproc    55.  4.100 / 55.  4.100
 Input #0, mpegts, from '27hours.ts':
   Duration: 00:29:16.33, start: 1.400000, bitrate: 3630 kb/s
   Program 1
     Metadata:
       service_name    : Service01
       service_provider: FFmpeg
     Stream #0:0[0x100]: Video: h264 (Constrained Baseline) ([27][0][0][0]
 / 0x001B), yuv420p(progressive), 320x240 [SAR 1:1 DAR 4:3]
 , 25 fps, 25 tbr, 90k tbn, 50 tbc
     Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100
 Hz, stereo, fltp, 25 kb/s
 Output #0, mpegts, to '/dev/null':
   Metadata:
     encoder         : Lavf58.27.103
     Stream #0:0: Video: h264 (Constrained Baseline) ([27][0][0][0] /
 0x001B), yuv420p(progressive), 320x240 [SAR 1:1 DAR 4:3], q=2-3
 1, 25 fps, 25 tbr, 90k tbn, 90k tbc
     Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz,
 stereo, fltp, 25 kb/s
 Stream mapping:
   Stream #0:0 -> #0:0 (copy)
   Stream #0:1 -> #0:1 (copy)
 Press [q] to stop, [?] for help
 frame=2374722 fps=131928 q=-1.0 size=  760576kB time=26:23:10.28 bitrate=
 65.6kbits/s speed=5.28e+03x
 [mpegts @ 0x55630f5ea700] DTS 788 < 8589931780 out of order
 [mpegts @ 0x55630f6887c0] Non-monotonous DTS in output stream 0:0;
 previous: 8589931780, current: 788; changing to 8589931781. This may
 result in incorrect timestamps in the output file.
 [mpegts @ 0x55630f6887c0] Non-monotonous DTS in output stream 0:0;
 previous: 8589931781, current: 4388; changing to 8589931782. This may
 result in incorrect timestamps in the output file.
 [mpegts @ 0x55630f6887c0] Non-monotonous DTS in output stream 0:0;
 previous: 8589931782, current: 7988; changing to 8589931783. This may
 result in incorrect timestamps in the output file.
 [mpegts @ 0x55630f6887c0] Non-monotonous DTS in output stream 0:0;
 previous: 8589931783, current: 11588; changing to 8589931784. This may
 result in incorrect timestamps in the output file.
 [mpegts @ 0x55630f6887c0] Non-monotonous DTS in output stream 0:0;
 previous: 8589931784, current: 15188; changing to 8589931785. This may
 result in incorrect timestamps in the output file.
 [mpegts @ 0x55630f6887c0] Non-monotonous DTS in output stream 0:0;
 previous: 8589931785, current: 18788; changing to 8589931786. This may
 result in incorrect timestamps in the output file.
 [mpegts @ 0x55630f6887c0] Non-monotonous DTS in output stream 0:0;
 previous: 8589931786, current: 22388; changing to 8589931787. This may
 result in incorrect timestamps in the output file.
 [mpegts @ 0x55630f6887c0] Non-monotonous DTS in output stream 0:0;
 previous: 8589931787, current: 25988; changing to 8589931788. This may
 result in incorrect timestamps in the output file.
 }}}
 and keeps going till the end.

 This problem is resolved if you use the attached diff file. It's not my
 own work, source is https://github.com/arut/ffmpeg-patches/blob/master
 /mpegts-33bit , I just modified it in order to apply in current git.

 Using -copyts is important in some live streaming cases and failing after
 26,5 hours of streaming is a problem.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/7876>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list