Ticket #1604 (new defect)
Rtmp streaming fps continually drops
| Reported by: | Pyriel0 | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | undetermined |
| Version: | git-master | Keywords: | rtmp |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description (last modified by ubitux) (diff)
Summary of the bug: Rtmp output to justin.tv fps continually drops, the 64 bit version slowly uses all system ram (8 GB). It goes up by 100 MB every second or two until the ram is full. The audio is fine even with the low frame rate. If I change "-f flv rtmp:xxxx" to "f:\test.mp4" to record to a hard drive, it works perfect. This problem only occurs when I'm trying to stream. It happens for both file input and direct show input. My cpu is an Intel 3770k at 4.4 GHz and cable upload is 3 Mb/s. Both are more than capable of handling 1280x720 at 30fps and 2400kb/s.
How to reproduce:
ffmpeg -re -rtbufsize 100000k -i "f:\xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
-pix_fmt yuv420p -s hd720 -vcodec libx264 -preset medium -b:v 2400k -maxrate 240
0k -bufsize 600k -acodec libmp3lame -ac 2 -b:a 128k -ar 44100 -f flv "rtmp://liv
e-dfw.justin.tv/app/xxxxxxxxxxxxxxxxxxxxx flashver=FME/2.5 (compatible; FMSc 1.0
)"
ffmpeg version N-43060-ga85b4a5 Copyright (c) 2000-2012 the FFmpeg developers
built on Jul 30 2012 13:14:08 with gcc 4.7.1 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-ru
ntime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass
--enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable
-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libope
njpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libth
eora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-
libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --e
nable-zlib
libavutil 51. 66.100 / 51. 66.100
libavcodec 54. 45.100 / 54. 45.100
libavformat 54. 22.100 / 54. 22.100
libavdevice 54. 2.100 / 54. 2.100
libavfilter 3. 5.101 / 3. 5.101
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'f:\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
encoder : HandBrake 0.9.5 2011010300
Duration: 01:39:15.71, start: 0.000000, bitrate: 4822 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x800
[SAR 1:1 DAR 12:5], 4179 kb/s, 23.98 fps, 23.98 tbr, 90k tbn, 180k tbc
Stream #0:1(und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), s16,
640 kb/s
[libx264 @ 0514f860] using SAR=27/20
[libx264 @ 0514f860] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE
4.2 AVX
[libx264 @ 0514f860] profile High, level 3.1
[libx264 @ 0514f860] 264 - core 125 r2200 999b753 - H.264/MPEG-4 AVC codec - Cop
yleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deb
lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 m
e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chro
ma_qp_offset=-2 threads=12 lookahead_threads=2 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=250 keyint_min=23 scene
cut=40 intra_refresh=0 rc_lookahead=40 rc=cbr mbtree=1 bitrate=2400 ratetol=1.0
qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=2400 vbv_bufsize=600 nal_hrd=no
ne ip_ratio=1.40 aq=1:1.00
Output #0, flv, to 'rtmp://live-dfw.justin.tv/app/xxxxxxxxxxxxxxxxxxxxx flashver
=FME/2.5 (compatible; FMSc 1.0)':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
encoder : Lavf54.22.100
Stream #0:0(und): Video: h264 ([7][0][0][0] / 0x0007), yuv420p, 1280x720 [SA
R 27:20 DAR 12:5], q=-1--1, 2400 kb/s, 1k tbn, 23.98 tbc
Stream #0:1(und): Audio: mp3 ([2][0][0][0] / 0x0002), 44100 Hz, stereo, s16,
128 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> libx264)
Stream #0:1 -> #0:1 (ac3 -> libmp3lame)
Press [q] to stop, [?] for help
DTS -3754, next:-83406 st:0 invalid dropping
frame= 4 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate= 0.0kbits/s
frame= 15 fps= 15 q=0.0 size= 0kB time=00:00:00.00 bitrate= 0.0kbits/s
frame= 27 fps= 17 q=0.0 size= 0kB time=00:00:00.00 bitrate= 0.0kbits/s
frame= 40 fps= 19 q=0.0 size= 0kB time=00:00:00.00 bitrate= 0.0kbits/s
frame= 51 fps= 20 q=0.0 size= 0kB time=00:00:00.00 bitrate= 0.0kbits/s
frame= 67 fps= 22 q=0.0 size= 8kB time=00:00:00.37 bitrate= 172.5kbits/s
frame= 76 fps= 21 q=0.0 size= 15kB time=00:00:00.75 bitrate= 161.4kbits/s
frame= 87 fps= 21 q=0.0 size= 23kB time=00:00:01.21 bitrate= 153.9kbits/s
frame= 103 fps= 22 q=0.0 size= 44kB time=00:00:01.87 bitrate= 192.1kbits/s
frame= 112 fps= 22 q=0.0 size= 50kB time=00:00:02.25 bitrate= 183.5kbits/s
frame= 123 fps= 22 q=0.0 size= 59kB time=00:00:02.71 bitrate= 177.6kbits/s
frame= 130 fps= 21 q=10.0 size= 135kB time=00:00:03.00 bitrate= 367.5kbits/
frame= 141 fps= 21 q=37.0 size= 223kB time=00:00:03.46 bitrate= 528.9kbits/
frame= 147 fps= 20 q=38.0 size= 313kB time=00:00:03.71 bitrate= 690.7kbits/
frame= 155 fps= 20 q=30.0 size= 408kB time=00:00:04.04 bitrate= 825.6kbits/
frame= 167 fps= 20 q=36.0 size= 492kB time=00:00:04.54 bitrate= 885.6kbits/
frame= 174 fps= 20 q=37.0 size= 602kB time=00:00:04.83 bitrate=1019.8kbits/
frame= 182 fps= 19 q=36.0 size= 692kB time=00:00:05.17 bitrate=1096.3kbits/
frame= 191 fps= 19 q=37.0 size= 783kB time=00:00:05.54 bitrate=1156.8kbits/
frame= 197 fps= 19 q=36.0 size= 888kB time=00:00:05.79 bitrate=1254.4kbits/
frame= 203 fps= 18 q=35.0 size= 983kB time=00:00:06.04 bitrate=1331.5kbits/
frame= 211 fps= 18 q=34.0 size= 1063kB time=00:00:06.38 bitrate=1364.8kbits/
frame= 222 fps= 18 q=33.0 size= 1170kB time=00:00:06.84 bitrate=1401.4kbits/
frame= 231 fps= 18 q=34.0 size= 1272kB time=00:00:07.21 bitrate=1444.4kbits/
frame= 237 fps= 18 q=33.0 size= 1356kB time=00:00:07.46 bitrate=1488.0kbits/
frame= 247 fps= 18 q=32.0 size= 1460kB time=00:00:07.88 bitrate=1517.4kbits/
frame= 255 fps= 18 q=34.0 size= 1554kB time=00:00:08.21 bitrate=1548.9kbits/
frame= 262 fps= 18 q=34.0 size= 1643kB time=00:00:08.50 bitrate=1582.3kbits/
frame= 269 fps= 18 q=33.0 size= 1735kB time=00:00:08.80 bitrate=1615.2kbits/
frame= 277 fps= 18 q=33.0 size= 1823kB time=00:00:09.13 bitrate=1635.1kbits/
frame= 284 fps= 17 q=33.0 size= 1922kB time=00:00:09.42 bitrate=1670.1kbits/
frame= 293 fps= 17 q=32.0 size= 2004kB time=00:00:09.80 bitrate=1674.9kbits/
frame= 302 fps= 17 q=32.0 size= 2107kB time=00:00:10.17 bitrate=1696.5kbits/
frame= 307 fps= 17 q=32.0 size= 2195kB time=00:00:10.38 bitrate=1731.4kbits/
frame= 319 fps= 17 q=31.0 size= 2304kB time=00:00:10.88 bitrate=1734.1kbits/
frame= 327 fps= 17 q=28.0 size= 2402kB time=00:00:11.22 bitrate=1754.0kbits/
frame= 335 fps= 17 q=28.0 size= 2498kB time=00:00:11.55 bitrate=1770.8kbits/
frame= 341 fps= 17 q=28.0 size= 2597kB time=00:00:11.80 bitrate=1802.5kbits/
frame= 351 fps= 17 q=26.0 size= 2677kB time=00:00:12.22 bitrate=1794.4kbits/
frame= 365 fps= 17 q=26.0 size= 2777kB time=00:00:12.80 bitrate=1776.6kbits/
frame= 375 fps= 17 q=27.0 size= 2880kB time=00:00:13.22 bitrate=1784.5kbits/
frame= 385 fps= 17 q=24.0 size= 2978kB time=00:00:13.63 bitrate=1788.7kbits/
frame= 395 fps= 17 q=28.0 size= 3117kB time=00:00:14.05 bitrate=1816.5kbits/
frame= 404 fps= 17 q=27.0 size= 3212kB time=00:00:14.43 bitrate=1823.1kbits/
frame= 410 fps= 17 q=28.0 size= 3304kB time=00:00:14.68 bitrate=1843.7kbits/
frame= 418 fps= 17 q=25.0 size= 3414kB time=00:00:15.01 bitrate=1862.5kbits/
frame= 426 fps= 17 q=25.0 size= 3490kB time=00:00:15.34 bitrate=1862.8kbits/
frame= 437 fps= 17 q=20.0 size= 3597kB time=00:00:15.80 bitrate=1864.1kbits/
frame= 442 fps= 17 q=15.0 size= 3680kB time=00:00:16.01 bitrate=1882.4kbits/
frame= 450 fps= 17 q=12.0 size= 3761kB time=00:00:16.35 bitrate=1884.4kbits/
frame= 458 fps= 17 q=13.0 size= 3857kB time=00:00:16.68 bitrate=1893.8kbits/
frame= 467 fps= 17 q=12.0 size= 3945kB time=00:00:17.05 bitrate=1894.6kbits/
frame= 479 fps= 17 q=8.0 size= 4029kB time=00:00:17.56 bitrate=1879.6kbits/s
frame= 490 fps= 17 q=23.0 size= 4129kB time=00:00:18.01 bitrate=1877.5kbits/
frame= 497 fps= 17 q=28.0 size= 4235kB time=00:00:18.30 bitrate=1895.0kbits/
frame= 503 fps= 17 q=28.0 size= 4336kB time=00:00:18.56 bitrate=1913.7kbits/
frame= 511 fps= 17 q=27.0 size= 4412kB time=00:00:18.89 bitrate=1912.9kbits/
frame= 518 fps= 17 q=27.0 size= 4495kB time=00:00:19.18 bitrate=1919.4kbits/
frame= 526 fps= 17 q=26.0 size= 4583kB time=00:00:19.52 bitrate=1923.5kbits/
frame= 534 fps= 17 q=29.0 size= 4676kB time=00:00:19.85 bitrate=1929.5kbits/
frame= 543 fps= 17 q=32.0 size= 4778kB time=00:00:20.22 bitrate=1934.8kbits/
frame= 549 fps= 17 q=31.0 size= 4868kB time=00:00:20.47 bitrate=1947.3kbits/
frame= 557 fps= 16 q=32.0 size= 4960kB time=00:00:20.81 bitrate=1952.2kbits/
frame= 565 fps= 16 q=31.0 size= 5055kB time=00:00:21.14 bitrate=1958.4kbits/
frame= 571 fps= 16 q=30.0 size= 5135kB time=00:00:21.39 bitrate=1966.0kbits/
frame= 578 fps= 16 q=28.0 size= 5236kB time=00:00:21.68 bitrate=1977.6kbits/
frame= 586 fps= 16 q=26.0 size= 5325kB time=00:00:22.02 bitrate=1981.1kbits/
frame= 594 fps= 16 q=25.0 size= 5426kB time=00:00:22.35 bitrate=1988.1kbits/
frame= 602 fps= 16 q=23.0 size= 5525kB time=00:00:22.69 bitrate=1994.7kbits/
frame= 609 fps= 16 q=23.0 size= 5617kB time=00:00:22.98 bitrate=2002.3kbits/
frame= 615 fps= 16 q=22.0 size= 5697kB time=00:00:23.23 bitrate=2008.8kbits/
frame= 623 fps= 16 q=22.0 size= 5784kB time=00:00:23.56 bitrate=2010.6kbits/
frame= 634 fps= 16 q=21.0 size= 5898kB time=00:00:24.02 bitrate=2011.1kbits/
frame= 643 fps= 16 q=23.0 size= 5981kB time=00:00:24.40 bitrate=2008.1kbits/
frame= 651 fps= 16 q=21.0 size= 6071kB time=00:00:24.73 bitrate=2010.9kbits/
frame= 657 fps= 16 q=20.0 size= 6170kB time=00:00:24.98 bitrate=2023.2kbits/
frame= 666 fps= 16 q=21.0 size= 6270kB time=00:00:25.35 bitrate=2025.6kbits/
frame= 675 fps= 16 q=20.0 size= 6350kB time=00:00:25.73 bitrate=2021.6kbits/
frame= 685 fps= 16 q=20.0 size= 6444kB time=00:00:26.15 bitrate=2018.7kbits/
frame= 693 fps= 16 q=15.0 size= 6532kB time=00:00:26.48 bitrate=2020.4kbits/
frame= 703 fps= 16 q=20.0 size= 6622kB time=00:00:26.90 bitrate=2016.7kbits/
frame= 712 fps= 16 q=21.0 size= 6715kB time=00:00:27.27 bitrate=2016.7kbits/
frame= 719 fps= 16 q=20.0 size= 6798kB time=00:00:27.57 bitrate=2020.1kbits/
frame= 727 fps= 16 q=16.0 size= 6890kB time=00:00:27.90 bitrate=2023.0kbits/
frame= 738 fps= 16 q=20.0 size= 6980kB time=00:00:28.36 bitrate=2016.0kbits/
frame= 746 fps= 16 q=18.0 size= 7089kB time=00:00:28.69 bitrate=2023.7kbits/
frame= 758 fps= 15 q=13.0 Lsize= 7879kB time=00:00:31.53 bitrate=2047.0kbits
/s
video:7350kB audio:496kB subtitle:0 global headers:0kB muxing overhead 0.436182%
[libx264 @ 0514f860] frame I:23 Avg QP:18.98 size: 22743
[libx264 @ 0514f860] frame P:498 Avg QP:24.53 size: 12099
[libx264 @ 0514f860] frame B:237 Avg QP:16.09 size: 4121
[libx264 @ 0514f860] consecutive B-frames: 48.8% 27.4% 3.2% 20.6%
[libx264 @ 0514f860] mb I I16..4: 41.8% 47.4% 10.8%
[libx264 @ 0514f860] mb P I16..4: 19.6% 10.0% 1.0% P16..4: 28.3% 7.3% 3.2%
0.0% 0.0% skip:30.6%
[libx264 @ 0514f860] mb B I16..4: 0.4% 0.2% 0.0% B16..8: 19.4% 4.2% 0.8%
direct: 3.9% skip:71.0% L0:46.6% L1:48.0% BI: 5.4%
[libx264 @ 0514f860] 8x8 transform intra:34.6% inter:82.7%
[libx264 @ 0514f860] coded y,uvDC,uvAC intra: 27.7% 47.6% 13.5% inter: 17.2% 23.
4% 1.2%
[libx264 @ 0514f860] i16 v,h,dc,p: 26% 71% 1% 1%
[libx264 @ 0514f860] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 47% 21% 3% 3% 3% 3%
3% 3%
[libx264 @ 0514f860] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 54% 10% 2% 3% 2% 4%
2% 3%
[libx264 @ 0514f860] i8c dc,h,v,p: 64% 19% 11% 5%
[libx264 @ 0514f860] Weighted P-Frames: Y:11.2% UV:7.6%
[libx264 @ 0514f860] ref P L0: 55.7% 12.9% 20.2% 10.3% 0.8%
[libx264 @ 0514f860] ref B L0: 76.7% 21.5% 1.8%
[libx264 @ 0514f860] ref B L1: 95.4% 4.6%
[libx264 @ 0514f860] kb/s:1896.70
ffmpeg version: Zeranoe 7-30-2012 version
built on ... Jul 30 2012 (taken from the top of what I pasted)
Change History
comment:2 Changed 11 months ago by Pyriel0
After some troubleshooting, we found that the outputs -f flv udp://127.0.0.1:12345 and -f flv - > NUL work. The problem occurs with rtmp output and when trying to pipe to another ffmpeg for streaming with rtmp. Suspected problem with librtmp
comment:3 in reply to: ↑ description Changed 11 months ago by cehoyos
Replying to Pyriel0:
If I change "-f flv rtmp:xxxx" to "f:\test.mp4" to record to a hard drive, it works perfect.
What about f:\test.flv ?
comment:5 Changed 11 months ago by burek
In the following examples, piping of 2 ffmpeg processes was used to distinguish which process exhibits the memory exhaustion bug.
Examples that exhibit 8GB memory exhaustion:
1: All-in-one cmd line:
ffmpeg -re -i "f:\xxx"\ -pix_fmt yuv420p -s hd720\ -vcodec libx264 -preset medium -b:v 2400k -maxrate 2400k -bufsize 600k\ -acodec libmp3lame -ac 2 -b:a 128k -ar 44100\ -f flv rtmp://live-dfw.justin.tv/app/xxx"
2: Split into 2 processes, first one encodes the stuff, the second one streams it. What is strange is that 1st process, that does the encoding, exhibits the bug with high ram memory usage, but it was expected that 2nd process would do so, because of rtmp. I can only guess that second process does not read data from pipe fast enough, which causes the first process to suffocate the available ram memory:
ffmpeg -re -i "f:\xxx" -pix_fmt yuv420p -s hd720\ -vcodec libx264 -preset medium -b:v 2400k -maxrate 2400k -bufsize 600k\ -acodec libmp3lame -ac 2 -b:a 128k -ar 44100\ -f flv - |\ ffmpeg -f flv -i - -c copy -f flv "rtmp://live-dfw.justin.tv/app/xxx"
Examples that DON'T exhibit 8GB memory exhaustion:
1: Output to DEV/NULL using flv file format:
ffmpeg -re -i "f:\xxx" -pix_fmt yuv420p -s hd720\ -vcodec libx264 -preset medium -b:v 2400k -maxrate 2400k -bufsize 600k\ -acodec libmp3lame -ac 2 -b:a 128k -ar 44100\ -y -f flv - > NUL
2: Output using udp instead of rtmp:
ffmpeg -re -i "f:\xxx" -pix_fmt yuv420p -s hd720\ -vcodec libx264 -preset medium -b:v 2400k -maxrate 2400k -bufsize 600k\ -acodec libmp3lame -ac 2 -b:a 128k -ar 44100 -f flv - |\ ffmpeg -f flv -i - -c copy -f flv udp://127.0.0.1:12345
comment:6 Changed 11 months ago by cehoyos
- Keywords framerate removed
- Version changed from unspecified to git-master
comment:7 Changed 10 months ago by Pyriel0
I have been messing around with this more and found the rtmp will work if the bitrate is 1500k or less. When I run ffmpeg with -report it shows
HandleServerBW: server BW = 2500000 HandleClientBW: client BW = 2500000 2
in the handshake with the justin.tv server. Is either ffmpeg or librtmp artificially capping the bandwidth? When I move the bitrate up to 2000k the fps starts dropping and all ram is slowly taken up.
comment:8 Changed 10 months ago by rogerdpack
@Pyriel0 does it lose latency over time? like it gets farther and farther behind?
Also what's your complete command line?
comment:9 Changed 10 months ago by Pyriel0
The command line I used for what is pasted is at the very top. Here are some examples.
I used this command line to record to the hard drive first and it works fine. Then I changed the output from f:\testing.mp4 to -f flv "rtmp://live-dfw.justin.tv/app/xxxxxx".
ffmpeg -re -y -rtbufsize 100000k -f dshow -i video="SCFH DSF":audio="Line 1 (Virtual Audio Cable)" -pix_fmt yuv420p -s hd720 -vcodec libx264 -preset medium -maxrate 2400k -bufsize 600k -acodec libmp3lame -ac 2 -b:a 128k f:\testing.mp4
I used the 32 bit 7-30-2012 zeranoe version. Forgot the 32 bit does not pick up virtual audio cable so the first 3 examples do not have audio. For the last video "2400k test 3 audio", I changed the audio to "virtual-audio-capturer" so there would be sound. 2400kb test 1 and 2 are the same, I only ran it again because I forgot how low the fps went on the first run.
http://www.twitch.tv/pyriel0/videos
2400k tests were done using the bitrates in the commnad line. 1500k used 1500k maxrate and 500k buffer. The 1500k streaming held 30 fps. 2400k dropped down to 12 fps. The audio remains stable in the final 2400kb test when the video is choppy. I doubt there is a latency problem since the audio does not get messed up.
System ram usage:
Game only: ~3.5 GB
Recording to hard drive: ~3.8 GB
Streaming 1500k: ~4 GB
Streaming 2400kb: ~5 GB
The highest cpu usage from windows task manager while recording to the hard drive at 2400k was 55%. This is approx 20% from the game and 35% from ffmpeg.
I can only use the 32 bit version for these tests because the 64 bit uses all available ram which causes everything to stutter.
Edit: I uploaded one last video using ffsplit to show the server can take more than 1500k bitrate. Ffsplit was set for 2000k and I watched the upload through my router's dd-wrt bandwidth monitor. It went well above 2000k a lot and spiked up over 3000k quite a bit too. The video does not have these fps issues even though the bitrate being output was much higher at parts than what I am attempting to do with ffmpeg.
comment:10 Changed 10 months ago by Defiancefew
I've got the same problem both with own3d.tv and justin.tv . One difference is
Using this code is impossible to me because it eats ~1.5 GB memory instantly and start to real time buffer very soon (since i dont have any free memory anymore and my system crash)
ffmpeg -re -rtbufsize 100000k -r 25 -f dshow -i video="screen-capture-recorder" -f dshow -i audio="DirectSound Capture Device" -f dshow -i audio="Microphone (Realtek High Defini" -filter_complex amix=inputs=2:duration=first:dropout_transition=3 -c:a libmp3lame -ac 2 -b:a 128k -ar 44100 -c:v libx264 -preset faster -pix_fmt yuv420p -x264opts vbv-bufsize=3600:vbv-maxrate=1800:crf=23 -s 1920x1080 -y -f flv "rtmp://live-lhr-backup.justin.tv/app/STREAMKEY"
Splitting ffmpeg into two processes fixed memory usage (400mb for process that encodes dshow input and audio into test.flv and 3mb for process that sends test.flv to rtmp) :
Input:
ffmpeg -re -rtbufsize 100000k -r 30 -f dshow -i video="screen-capture-recorder" -f dshow -i audio="DirectSound Capture Device" -f dshow -i audio="Microphone (Realtek High Defini" -filter_complex amix=inputs=2:duration=first:dropout_transition=3 -c:a libmp3lame -ac 2 -b:a 128k -ar 44100 -c:v libx264 -preset faster -pix_fmt yuv420p -x264opts vbv-bufsize=3600:vbv-maxrate=1800:crf=23 -s 1920x1080 -y -f flv "test.flv"
Output:
ffmpeg -re -i "test.flv" -c copy -f flv "rtmp://live-lhr-backup.justin.tv/app/STREAMKEY"
But my FPS still drops from 25 to 12 in a few minutes in Output command line (when input is constant 25 fps@1500 bitrate). CPU usage is around 40% from ffpmeg.
Adding video too (sorry for the convesation i dont have any good example):
comment:11 Changed 10 months ago by rogerdpack
@Pyriel0 I did see this line in rtmp.c:
r->m_nServerBW = 2500000;
FWIW.
Also as a note I'm going to put my latest theories/ideas on this one at http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=7&t=657 so there may be some other feedback there...
My next question is...does ffmpeg have any internal buffering mechanism *before* the output (generic or otherwise) anybody? Does it have a separate thread for the "output" container et al? (or does the encoder, libx264, basically block while it is writing to the output?)
comment:12 Changed 10 months ago by rogerdpack
@Pyriel0 does 32 bit not eat RAM? (I have some suggestions/questions on the zeranoe forum...) in general when you get drops in fps, do you have free (idle) cpu, and free bandwidth?
comment:13 Changed 10 months ago by rogerdpack
ok the rtbufsize has landed in the zeranoe builds, give it a shot (if there's no further feedback in a week or so I'd close this, since I'm unable to reproduce it elsewise...)
comment:14 Changed 10 months ago by Pyriel0
I posted on the zeranoe site. The new version makes the buffer drop a lot of frames while using rtmp and the video is choppy. It still records to the hard drive without any problem though.
I read the 32 bit programs cannot use more than 2GB. The problems still happen but it doesn't let the program take all my memory like the 64 bit version does. These encodings do not take all of the bandwidth or my cpu.
comment:15 Changed 9 months ago by rogerdpack
I believe "part" of the problem has been fixed with a966d94891cea4b571bd2 . The original problem (the problem given in the title) is quite possibly still there. @Pyriel0 so...do you still see fps drops over time (and also have idle cpu and idle bandwidth?)
comment:16 Changed 9 months ago by Pyriel0
All of the newer versions drop virtually all the frames when trying to stream to justin.tv with rtmp. It still works fine if I only record to the hard drive. I have idle cpu power and idle bandwidth. I have tried 2-3 updates in the last month and I just tried the latest (9-19 64 bit) a few minutes ago.
comment:17 Changed 4 months ago by rogerdpack
comment:18 Changed 7 weeks ago by mkovac
Hello,
Any news regarding this ? I have the same issue, FPS dropping continuously when using libx264 ==> FLV ==> RTMP, it will just dropp slower or faster depending on the bitrate.
What I don't get is that how RTMP is still supported in ffmpeg with such an issue, or why isn't there any note warning on this ?
Here's my version (on Windows) :
C:\Users\ext-mko\Desktop\ffmpeg-20130314-git-9efcfbe-win32-static\bin>ffmpeg -version
ffmpeg version N-50911-g9efcfbe
built on Mar 13 2013 21:26:48 with gcc 4.7.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --
enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-lib
vo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 19.100 / 52. 19.100
libavcodec 55. 0.100 / 55. 0.100
libavformat 55. 0.100 / 55. 0.100
libavdevice 54. 4.100 / 54. 4.100
libavfilter 3. 45.103 / 3. 45.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
Thank you.
comment:19 Changed 7 weeks ago by Pyriel0
I tried a more recent ffmpeg build from the zeranoe site and it still did not work.
All I found about it was the packet size is larger than what windows likes. This causes the framerate to drop because ffmpeg would keep trying to hold/buffer the packets. There is a free streaming program called FFsplit. On that forum one of the makers said he split the packets but that is beyond me. The name was taqattack I think. This is to the best of my memory. It has been a long time since I looked at anything about this problem.
When I had these troubles, I kept getting run in circles about my internet speed and cpu power (which are both more than sufficient) and the only thing done was dumping the buffer when it filled. The packet size problem was ignored. I just gave up and now I use Open Broadcaster Software if I need to stream or record the desktop.
Anyways that is all I have on it. I hope you have better luck than me if you decide to try and get this problem fixed.


