[FFmpeg-trac] #3553(undetermined:new): Fix Non-monotonous DTS for flv live stream output

FFmpeg trac at avcodec.org
Sat Apr 12 19:54:47 CEST 2014


#3553: Fix Non-monotonous DTS for flv live stream output
----------------------------------+----------------------------------------
             Reporter:  FishB8    |                    Owner:
                 Type:  defect    |                   Status:  new
             Priority:  normal    |                Component:  undetermined
              Version:  2.2       |               Resolution:
             Keywords:  dts rtmp  |               Blocked By:
             Blocking:            |  Reproduced by developer:  0
Analyzed by developer:  0         |
----------------------------------+----------------------------------------

Comment (by FishB8):

 Note: to avoid confusion, from here on I'll use "network input/output" in
 reference to rtmp IO, while "stream" refers to video/audio/data element
 streams within the format.

 I built latest git, no difference

 The problem is reproducible with both file and network output. Basically
 the audio continues, but the video is stopped waiting for a frame with the
 correct DTS value.

 Same thing happens when the source is a file with DTS discontinuity rather
 than a network input.

 Once caveat is that if using stream copy for the codecs rather than re-
 encoding, the video output seems to continue once the DTS discontinuity
 occurs, but at a fraction of the proper frame rate. (Audio continues
 normally)

 Here's the commandline / console output:


 {{{
 $ ffmpeg -fflags +genpts -i rtmp://127.0.0.1/switcher/output -c:a
 libfdk_aac -vbr 3 -ac 2 -ar 48000 -c:v libx264 -g 31 -crf 22 -profile:v
 high -preset:v medium -trellis 2 -f flv -rtmp_live live
 rtmp://127.0.0.1/publish/program
 ffmpeg version N-62374-ge89f3d0 Copyright (c) 2000-2014 the FFmpeg
 developers
   built on Apr 12 2014 11:08:18 with gcc 4.8.2 (Gentoo 4.8.2 p1.3r1,
 pie-0.5.8r1)
   configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64
 --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc
 --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags='-O2
 -march=native -mfpmath=sse -ftree-vectorize -fomit-frame-pointer -pipe
 -fprefetch-loop-arrays -floop-block -floop-strip-mine -floop-interchange'
 --extra-cflags='-O2 -march=native -mfpmath=sse -ftree-vectorize -fomit-
 frame-pointer -pipe -fprefetch-loop-arrays -floop-block -floop-strip-mine
 -floop-interchange' --extra-cxxflags='-O2 -march=native -mfpmath=sse
 -ftree-vectorize -fomit-frame-pointer -pipe -fprefetch-loop-arrays -floop-
 block -floop-strip-mine -floop-interchange -fvisibility-inlines-hidden
 -DNDEBUG' --disable-static --enable-gpl --enable-postproc --enable-
 avfilter --enable-avresample --disable-stripping --enable-nonfree
 --enable-version3 --enable-nonfree --disable-indev=v4l2 --disable-
 outdev=v4l2 --disable-indev=oss --disable-outdev=oss --enable-version3
 --enable-nonfree --enable-bzlib --disable-runtime-cpudetect --disable-
 debug --disable-doc --enable-gnutls --enable-hardcoded-tables --enable-
 iconv --enable-network --enable-openssl --enable-ffplay --enable-vaapi
 --enable-vdpau --enable-xlib --enable-zlib --enable-libvo-aacenc --enable-
 libvo-amrwbenc --enable-libmp3lame --enable-libaacplus --enable-libfaac
 --enable-libtheora --enable-libtwolame --disable-libwavpack --enable-
 libwebp --enable-libx264 --disable-libx265 --enable-libxvid --enable-
 libcdio --enable-libiec61883 --enable-libdc1394 --disable-libcaca
 --disable-openal --enable-opengl --disable-libv4l2 --enable-libpulse
 --enable-x11grab --disable-libflite --enable-frei0r --enable-fontconfig
 --enable-ladspa --disable-libass --enable-libfreetype --disable-libsoxr
 --enable-pthreads --enable-libopencore-amrwb --enable-libopencore-amrnb
 --enable-libfdk-aac --enable-libopenjpeg --enable-libbluray --disable-
 libcelt --disable-libgme --enable-libgsm --enable-libmodplug --enable-
 libopus --disable-libquvi --disable-librtmp --disable-libssh --enable-
 libschroedinger --enable-libspeex --enable-libvorbis --enable-libvpx
 --disable-libzvbi --disable-armv5te --disable-armv6 --disable-armv6t2
 --disable-neon --disable-vfp --disable-mips32r2 --disable-mipsdspr1
 --disable-mipsdspr2 --disable-mipsfpu --disable-altivec --disable-avx
 --disable-avx2 --disable-fma3 --disable-fma4 --disable-sse42 --cpu=host
   libavutil      52. 75.100 / 52. 75.100
   libavcodec     55. 58.103 / 55. 58.103
   libavformat    55. 37.100 / 55. 37.100
   libavdevice    55. 13.100 / 55. 13.100
   libavfilter     4.  4.100 /  4.  4.100
   libavresample   1.  2.  0 /  1.  2.  0
   libswscale      2.  6.100 /  2.  6.100
   libswresample   0. 18.100 /  0. 18.100
   libpostproc    52.  3.100 / 52.  3.100
 [flv @ 0xd06450] Stream discovered after head already parsed
 Input #0, flv, from 'rtmp://127.0.0.1/switcher/output':
   Metadata:
     Server          : NGINX RTMP (github.com/arut/nginx-rtmp-module)
     displayWidth    : 1280
     displayHeight   : 720
     fps             : 29
     profile         :
     level           :
   Duration: 00:00:00.00, start: 837.824000, bitrate: N/A
     Stream #0:0: Video: h264 (High), yuv420p, 1280x720 [SAR 1:1 DAR 16:9],
 30.33 fps, 29.97 tbr, 1k tbn, 59.94 tbc
     Stream #0:1: Audio: aac, 48000 Hz, stereo, fltp
     Stream #0:2: Data: none
 [libx264 @ 0xe99550] using SAR=1/1
 [libx264 @ 0xe99550] using cpu capabilities: MMX2 SSE2Fast LZCNT
 [libx264 @ 0xe99550] profile High, level 3.1
 [libx264 @ 0xe99550] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft
 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3
 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
 mixed_ref=1 me_range=16 chroma_me=1 trellis=2 8x8dct=1 cqm=0
 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=9
 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0
 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=31 keyint_min=3
 scenecut=40 intra_refresh=0 rc_lookahead=31 rc=crf mbtree=1 crf=22.0
 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
 [libfdk_aac @ 0xe95130] Note, the VBR setting is unsupported and only
 works with some parameter combinations
 Output #0, flv, to 'rtmp://127.0.0.1/publish/program':
   Metadata:
     Server          : NGINX RTMP (github.com/arut/nginx-rtmp-module)
     displayWidth    : 1280
     displayHeight   : 720
     fps             : 29
     profile         :
     level           :
     encoder         : Lavf55.37.100
     Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p,
 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 1k tbn, 29.97 tbc
     Stream #0:1: Audio: aac (libfdk_aac) ([10][0][0][0] / 0x000A), 48000
 Hz, stereo, s16
 Stream mapping:
   Stream #0:0 -> #0:0 (h264 -> libx264)
   Stream #0:1 -> #0:1 (aac -> libfdk_aac)
 Press [q] to stop, [?] for help
 [h264 @ 0xd0f570] AVC: nal size 23330847kB time=00:00:03.92 bitrate=
 484.4kbits/s
 [h264 @ 0xd0f570] missing picture in access unit with size 35
 [flv @ 0xd06450] DTS 0 < 841784 out of order
 [libfdk_aac @ 0xe95130] Queue input is backward in time
 [flv @ 0x141dd70] Non-monotonous DTS in output stream 0:1; previous: 3947,
 current: -837781; changing to 3947. This may result in incorrect
 timestamps in the output file.

 (Repeats flv DTS warning for each frame)
 }}}


 I can provide example files (both source and output) and an nginx-rtmp
 config file to re-create this issue if needed.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/3553#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list