[FFmpeg-user] RTMP speed vlue never reaches 1 (100%), streamign fail in short time

Lordrak lordrak007 at seznam.cz
Tue Jun 28 17:06:38 EEST 2022


Hello,

I am trying streaming rtpm using ffmpeg but i have few problems. FPS has 
never reach 25fps, only 21 for example. So stream stopping and in short 
time (couple minutes) buffer overflow. Ffmpeg is unusable to stream 
using rtmp protocol.

In complete scenario i need use tee muxer and send stream to rtmp and 
mpegts udp destination. When i leave only mpegts udp, streaming works 
fine.

Here are three tests:



ffmpeg-2022.06.12.exe -f dshow -rtbufsize 1000000000
-pixel_format uyvy422 -s 1920x1080 -r 25 -fflags +genpts
-i video="Decklink Video Capture (2)":audio="Decklink Audio Capture (2)"
-vf yadif,fps=25 -map 0:v -map 0:a -codec:a aac -ac 2 -ar 48000
-b:a 128k -vcodec libx264 -preset veryfast -tune zerolatency -profile:v main
-g 12 -top 1 -sc_threshold 0 -bufsize 11000k -minrate 8000k -maxrate 8000k
-b:v 8000k -muxrate 11000k -pix_fmt yuv420p -s 1920x1080 -aspect 16:9
-flags +ildct+ilme+global_header -streamid 0:481 -streamid 1:482
-map_metadata -1 -metadata service_provider="TIK BOHUMIN" -metadata service_name="TIK BOHUMIN" -mpegts_pmt_start_pid 480
-f tee [f=mpegts:bsfs/v=h264_mp4toannexb:use_fifo=1:onfail=ignore:pkt_size=1316]udp://@239.0.0.51:5000|
[f=flv:onfail=ignore:flvflags=no_duration_filesize:bsfs/v=h264_mp4toannexb:use_fifo=1]rtmp://upstream.server.eu/live/tik2"
2> out1.txt



ffmpeg-2022.06.12.exe -f dshow -rtbufsize 1000000000 -pixel_format uyvy422
-s 1920x1080 -r 25 -fflags +genpts -i video="Decklink Video Capture (2)":audio="Decklink Audio Capture (2)"
-vf yadif,fps=25 -map 0:v -map 0:a -codec:a aac -ac 2 -ar 48000 -b:a 128k
-vcodec libx264 -preset veryfast -tune zerolatency -profile:v main -g 12 -top 1
-sc_threshold 0 -bufsize 11000k -minrate 8000k -maxrate 8000k -b:v 8000k
-muxrate 11000k -pix_fmt yuv420p -s 1920x1080 -aspect 16:9 -flags +ildct+ilme+global_header -streamid 0:481 -streamid 1:482 -map_metadata -1 -metadata service_provider="TIK BOHUMIN"
-metadata service_name="TIK BOHUMIN"
-mpegts_pmt_start_pid 480   -f tee "[f=mpegts:bsfs/v=h264_mp4toannexb:use_fifo=1:onfail=ignore:pkt_size=1316]udp://@239.0.0.51:5000"   2> out2.txt


ffmpeg-2022.06.12.exe -f dshow -rtbufsize 1000000000 -pixel_format uyvy422
-s 1920x1080 -r 25 -fflags +genpts
-i video="Decklink Video Capture (2)":audio="Decklink Audio Capture (2)"
-vf yadif,fps=25 -map 0:v -map 0:a -codec:a aac -ac 2 -ar 48000 -b:a 128k
-vcodec libx264 -preset veryfast -tune zerolatency -profile:v main -g 12 -top 1
-sc_threshold 0 -bufsize 11000k -minrate 8000k -maxrate 8000k -b:v 8000k
-muxrate 11000k -pix_fmt yuv420p -s 1920x1080 -aspect 16:9 -flags +ildct+ilme+global_header -streamid 0:481 -streamid 1:482
-map_metadata -1 -metadata service_provider="TIK BOHUMIN" -metadata service_name="TIK BOHUMIN"
-mpegts_pmt_start_pid 480   -f tee"[f=flv:onfail=ignore:flvflags=no_duration_filesize:bsfs/v=h264_mp4toannexb:use_fifo=1]rtmp://upstream.server.eu/live/tik2"
2> out3.txt


Here are output from latest test using only rtmp
ffmpeg version 2022-06-12-git-4d45f5acbd-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
   built with gcc 11.3.0 (Rev1, Built by MSYS2 project)
   configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
   libavutil      57. 26.100 / 57. 26.100
   libavcodec     59. 33.100 / 59. 33.100
   libavformat    59. 24.100 / 59. 24.100
   libavdevice    59.  6.100 / 59.  6.100
   libavfilter     8. 40.100 /  8. 40.100
   libswscale      6.  6.100 /  6.  6.100
   libswresample   4.  6.100 /  4.  6.100
   libpostproc    56.  5.100 / 56.  5.100
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, dshow, from 'video=Decklink Video Capture (2):audio=Decklink Audio Capture (2)':
   Duration: N/A, start: 0.129454, bitrate: 1536 kb/s
   Stream #0:0: Video: rawvideo (HDYC / 0x43594448), uyvy422, 1920x1080, 25 fps, 25 tbr, 10000k tbn
   Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
   Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
   Stream #0:1 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] forhelp
[libx264 @ 0000000000486200] interlace + weightp is not implemented
[libx264 @ 0000000000486200] using SAR=1/1
[libx264 @ 0000000000486200] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0000000000486200] profile Main, level 4.0, 4:2:0, 8-bit
[libx264 @ 0000000000486200] 264 - core 164 r3095 baee400 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12 lookahead_threads=12 sliced_threads=1 slices=12 nr=0 decimate=1 interlaced=tff bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=12 keyint_min=1 scenecut=0 intra_refresh=0 rc_lookahead=0 rc=cbr mbtree=0 bitrate=8000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=8000 vbv_bufsize=11000 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
Output #0, tee, to '[f=flv:onfail=ignore:flvflags=no_duration_filesize:bsfs/v=h264_mp4toannexb:use_fifo=1]rtmp://upstream.server.eu/live/tik2':
   Metadata:
     service_provider: TIK
     service_name    : TIK
     encoder         : Lavf59.24.100
   Stream #0:0: Video: h264, yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 8000 kb/s, 25 fps, 25 tbn
     Metadata:
       encoder         : Lavc59.33.100 libx264
     Side data:
       cpb: bitrate max/min/avg: 8000000/0/8000000 buffer size: 11000000 vbv_delay: N/A
   Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp, 128 kb/s
     Metadata:
       encoder         : Lavc59.33.100 aac
frame=    1 fps=0.0 q=26.0 size=N/A time=00:00:00.07 bitrate=N/A speed=0.875x
frame=   13 fps=0.0 q=23.0 size=N/A time=00:00:00.56 bitrate=N/A speed=0.963x
frame=   26 fps= 24 q=26.0 size=N/A time=00:00:01.07 bitrate=N/A speed=0.984x
frame=   39 fps= 24 q=25.0 size=N/A time=00:00:01.56 bitrate=N/A speed=0.978x
frame=   51 fps= 24 q=24.0 size=N/A time=00:00:02.07 bitrate=N/A speed=0.988x
frame=   61 fps= 23 q=21.0 size=N/A time=00:00:02.48 bitrate=N/A speed=0.952x
frame=   71 fps= 22 q=24.0 size=N/A time=00:00:02.86 bitrate=N/A speed=0.909x
frame=   83 fps= 22 q=24.0 size=N/A time=00:00:03.35 bitrate=N/A speed=0.89x
frame=   95 fps= 22 q=25.0 size=N/A time=00:00:03.82 bitrate=N/A speed=0.867x
frame=  106 fps= 21 q=25.0 size=N/A time=00:00:04.27 bitrate=N/A speed=0.854x
frame=  114 fps= 21 q=25.0 size=N/A time=00:00:04.59 bitrate=N/A speed=0.835x
frame=  122 fps= 20 q=27.0 size=N/A time=00:00:04.91 bitrate=N/A speed=0.813x
frame=  131 fps= 20 q=25.0 size=N/A time=00:00:05.27 bitrate=N/A speed=0.796x
frame=  142 fps= 20 q=26.0 size=N/A time=00:00:05.72 bitrate=N/A speed= 0.8x
frame=  151 fps= 20 q=26.0 size=N/A time=00:00:06.06 bitrate=N/A speed=0.791x
frame=  161 fps= 20 q=26.0 size=N/A time=00:00:06.47 bitrate=N/A speed=0.788x
frame=  171 fps= 20 q=26.0 size=N/A time=00:00:06.87 bitrate=N/A speed=0.788x
frame=  182 fps= 20 q=27.0 size=N/A time=00:00:07.32 bitrate=N/A speed=0.793x
frame=  193 fps= 20 q=23.0 size=N/A time=00:00:07.75 bitrate=N/A speed=0.796x
frame=  203 fps= 20 q=25.0 size=N/A time=00:00:08.15 bitrate=N/A speed=0.792x
frame=  215 fps= 20 q=24.0 size=N/A time=00:00:08.62 bitrate=N/A speed=0.793x
frame=  227 fps= 20 q=24.0 size=N/A time=00:00:09.11 bitrate=N/A speed= 0.8x
frame=  239 fps= 20 q=24.0 size=N/A time=00:00:09.58 bitrate=N/A speed=0.802x
frame=  251 fps= 20 q=25.0 size=N/A time=00:00:10.07 bitrate=N/A speed=0.804x
frame=  263 fps= 20 q=27.0 size=N/A time=00:00:10.54 bitrate=N/A speed=0.806x
frame=  274 fps= 20 q=26.0 size=N/A time=00:00:10.99 bitrate=N/A speed=0.809x
frame=  283 fps= 20 q=27.0 size=N/A time=00:00:11.35 bitrate=N/A speed=0.806x
frame=  292 fps= 20 q=27.0 size=N/A time=00:00:11.72 bitrate=N/A speed=0.803x
frame=  302 fps= 20 q=29.0 size=N/A time=00:00:12.12 bitrate=N/A speed=0.803x
frame=  312 fps= 20 q=26.0 size=N/A time=00:00:12.51 bitrate=N/A speed=0.802x
frame=  323 fps= 20 q=25.0 size=N/A time=00:00:12.95 bitrate=N/A speed= 0.8x
frame=  335 fps= 20 q=26.0 size=N/A time=00:00:13.42 bitrate=N/A speed= 0.8x
frame=  347 fps= 20 q=26.0 size=N/A time=00:00:13.91 bitrate=N/A speed=0.803x


[q] command received. Exiting.

frame=  359 fps= 19 q=25.0 Lsize=N/A time=00:00:14.41 bitrate=N/A speed=0.768x
video:14608kB audio:226kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 @ 0000000000486200] frame I:30    Avg QP:20.40  size:129733
[libx264 @ 0000000000486200] frame P:329   Avg QP:23.24  size: 33634
[libx264 @ 0000000000486200] mb I  I16..4: 36.4%  0.0% 63.6%
[libx264 @ 0000000000486200] mb P  I16..4: 13.5%  0.0%  3.2%  P16..4: 40.2% 16.1%  6.0%  0.0%  0.0%    skip:21.0%
[libx264 @ 0000000000486200] field mbs: intra: 0.0% inter:0.0% skip:0.0%
[libx264 @ 0000000000486200] coded y,uvDC,uvAC intra: 48.0% 52.6% 10.0% inter: 19.3% 14.9% 0.1%
[libx264 @ 0000000000486200] i16 v,h,dc,p: 28% 30% 27% 15%
[libx264 @ 0000000000486200] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 20% 19%  8%  7%  6%  7%  6%  7%
[libx264 @ 0000000000486200] i8c dc,h,v,p: 58% 21% 15%  5%
[libx264 @ 0000000000486200] kb/s:8332.88
[aac @ 0000000000487e00] Qavg: 372.511

Have you idea why this occurs?
Thank you
Lordrak


More information about the ffmpeg-user mailing list