我正在运行以下命令,该命令在我在Intel Corei5上运行Elementary OS的系统上完美运行:
ffmpeg -f v4l2 -i /dev/video0 -c:v libx265 -x265-params crf=14:vbv-maxrate=128:vbv-bufsize=32:keyint=10:qcomp=0.5:rd=5:ctu=64:min-cu-size=8:cu-lossless=false:fast-intra=false:strong-intra-smoothing=false -tune zerolatency -s 640x480 -preset ultrafast -r 5 -pix_fmt yuv420p -an -strict experimental -f mpegts udp://239.0.0.1:5002
但如果我将输出大小更改为800x600,或者将帧速率从5增加到10.几秒钟后视频就会卡住。
我已经监控了这两个命令的CPU使用率,它几乎完全相同,在300到400%之间(因为4个核心)。
可以缓解此问题的任何可能答案。
ffmpeg version 2.7.2-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.3 (Debian 4.9.3-1)
configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --cc=gcc-4.9
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 41.100 / 56. 41.100
libavformat 56. 36.100 / 56. 36.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 16.101 / 5. 16.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
Routing option strict to both codec and muxer layer
[video4linux2,v4l2 @ 0x4775460] fd:4 capabilities:84000001
Input #0, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 1223.904801, bitrate: 36864 kb/s
Stream #0:0: Video: rawvideo, 1 reference frame (YUY2 / 0x32595559), yuyv422, 320x240, 36864 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
[graph 0 input from stream 0:0 @ 0x476aae0] w:320 h:240 pixfmt:yuyv422 tb:1/1000000 fr:30/1 sar:0/1 sws_param:flags=2
[scaler for output stream 0:0 @ 0x476a920] w:800 h:600 flags:'0x4' interl:0
[scaler for output stream 0:0 @ 0x476a920] w:320 h:240 fmt:yuyv422 sar:0/1 -> w:800 h:600 fmt:yuv420p sar:0/1 flags:0x4
x265 [info]: HEVC encoder version 1.7+357-b2ba7df1fc69
x265 [info]: build info [Linux][GCC 4.9.3][64 bit] 8bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
x265 [info]: Main profile, Level-3 (Main tier)
x265 [info]: Thread pool created using 4 threads
x265 [info]: frame threads / pool features : 2 / wpp(10 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge : dia / 57 / 0 / 2
x265 [info]: Keyframe min / max / scenecut : 1 / 10 / 0
x265 [info]: Lookahead / bframes / badapt : 0 / 0 / 0
x265 [info]: b-pyramid / weightp / weightb : 0 / 0 / 0
x265 [info]: References / ref-limit cu / depth : 1 / 0 / 0
x265 [info]: Rate Control / qCompress : CRF-14.0 / 0.50
x265 [info]: VBV/HRD buffer / max-rate / init : 32 / 64 / 0.900
x265 [info]: tools: rd=5 psy-rd=0.30 early-skip tmvp deblock
[mpegts @ 0x4776b00] muxrate VBR, pcr every 1 pkts, sdt every 200, pat/pmt every 40 pkts
Output #0, mpegts, to 'udp://239.0.0.1:5002':
Metadata:
encoder : Lavf56.36.100
Stream #0:0: Video: hevc (libx265), 1 reference frame, yuv420p, 800x600, q=2-31, 10 fps, 90k tbn, 10 tbc
Metadata:
encoder : Lavc56.41.100 libx265
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> hevc (libx265))
Press [q] to stop, [?] for help
*** dropping frame 2 from stream 0 at ts 0
*** dropping frame 3 from stream 0 at ts 1
Last message repeated 2 times
*** dropping frame 4 from stream 0 at ts 2
Last message repeated 1 times
*** dropping frame 5 from stream 0 at ts 3
Last message repeated 1 times
*** dropping frame 5 from stream 0 at ts 4
*** dropping frame 6 from stream 0 at ts 4time=00:00:00.40 bitrate= 131.6kbits/s dup=0 drop=9
Last message repeated 1 times
*** dropping frame 7 from stream 0 at ts 5
Last message repeated 1 times
*** dropping frame 8 from stream 0 at ts 6
Last message repeated 2 times
*** dropping frame 12 from stream 0 at ts 11me=00:00:00.90 bitrate= 112.0kbits/s dup=0 drop=16
*** dropping frame 13 from stream 0 at ts 11
Last message repeated 1 times
*** dropping frame 14 from stream 0 at ts 12
Last message repeated 1 times
*** dropping frame 15 from stream 0 at ts 13
Last message repeated 2 times
*** dropping frame 16 from stream 0 at ts 14me=00:00:01.40 bitrate= 103.1kbits/s dup=0 drop=24
Last message repeated 1 times
*** dropping frame 17 from stream 0 at ts 15
Last message repeated 1 times
*** dropping frame 17 from stream 0 at ts 16
*** dropping frame 18 from stream 0 at ts 16
Last message repeated 1 times
*** dropping frame 19 from stream 0 at ts 17
Last message repeated 1 times
*** dropping frame 20 from stream 0 at ts 18
Last message repeated 1 times
*** dropping frame 20 from stream 0 at ts 19
*** dropping frame 21 from stream 0 at ts 19me=00:00:01.90 bitrate= 95.0kbits/s dup=0 drop=36
Last message repeated 1 times
*** dropping frame 22 from stream 0 at ts 20
Last message repeated 1 times
*** dropping frame 23 from stream 0 at ts 21
Last message repeated 2 times
*** dropping frame 24 from stream 0 at ts 22
Last message repeated 1 times
*** dropping frame 25 from stream 0 at ts 23
Last message repeated 1 times
*** dropping frame 25 from stream 0 at ts 24
*** dropping frame 26 from stream 0 at ts 24
Last message repeated 1 times
*** dropping frame 27 from stream 0 at ts 25
Last message repeated 1 times
*** dropping frame 28 from stream 0 at ts 26me=00:00:02.60 bitrate= 92.0kbits/s dup=0 drop=52
Last message repeated 2 times
*** dropping frame 29 from stream 0 at ts 27
Last message repeated 1 times
*** dropping frame 30 from stream 0 at ts 28
Last message repeated 1 times
*** dropping frame 30 from stream 0 at ts 29
*** dropping frame 31 from stream 0 at ts 29
Last message repeated 1 times
*** 1 dup!
*** dropping frame 35 from stream 0 at ts 33me=00:00:03.30 bitrate= 96.2kbits/s dup=1 drop=62
Last message repeated 1 times
*** dropping frame 36 from stream 0 at ts 34
Last message repeated 1 times
*** dropping frame 37 from stream 0 at ts 35
Last message repeated 1 times
*** dropping frame 37 from stream 0 at ts 36
*** dropping frame 38 from stream 0 at ts 36
Last message repeated 1 times
*** dropping frame 39 from stream 0 at ts 37
Last message repeated 1 times
*** dropping frame 40 from stream 0 at ts 38
Last message repeated 1 times
*** dropping frame 40 from stream 0 at ts 39
*** dropping frame 41 from stream 0 at ts 39
Last message repeated 1 times
*** dropping frame 42 from stream 0 at ts 40me=00:00:04.00 bitrate= 89.1kbits/s dup=1 drop=78
Last message repeated 1 times
*** dropping frame 43 from stream 0 at ts 41
Last message repeated 2 times
*** dropping frame 44 from stream 0 at ts 42
Last message repeated 1 times
*** dropping frame 45 from stream 0 at ts 43
Last message repeated 1 times
*** dropping frame 45 from stream 0 at ts 44
*** dropping frame 46 from stream 0 at ts 44me=00:00:04.40 bitrate= 93.3kbits/s dup=1 drop=88
Last message repeated 1 times
*** dropping frame 47 from stream 0 at ts 45
Last message repeated 1 times
*** dropping frame 48 from stream 0 at ts 46
Last message repeated 2 times
*** dropping frame 49 from stream 0 at ts 47
Last message repeated 1 times
*** dropping frame 50 from stream 0 at ts 48me=00:00:04.80 bitrate= 91.8kbits/s dup=1 drop=97
Last message repeated 1 times
*** dropping frame 50 from stream 0 at ts 49
*** dropping frame 51 from stream 0 at ts 49
Last message repeated 1 times
*** dropping frame 55 from stream 0 at ts 53me=00:00:05.30 bitrate= 91.7kbits/s dup=1 drop=102
*** dropping frame 56 from stream 0 at ts 54
Last message repeated 1 times
*** dropping frame 57 from stream 0 at ts 55
Last message repeated 1 times
*** dropping frame 57 from stream 0 at ts 56
*** dropping frame 58 from stream 0 at ts 56me=00:00:05.60 bitrate= 91.9kbits/s dup=1 drop=108
Last message repeated 1 times
*** dropping frame 59 from stream 0 at ts 57
Last message repeated 1 times
*** 18 dup!
*** 2 dup!
*** 555 dup!fps= 10 q=0.0 size= 86kB time=00:00:08.00 bitrate= 88.4kbits/s dup=21 drop=112
x265 [warning]: poc:131, VBV underflow (-6152 bits)
x265 [warning]: poc:151, VBV underflow (-17080 bits)
x265 [warning]: poc:211, VBV underflow (-10272 bits)
x265 [warning]: poc:301, VBV underflow (-9024 bits)
x265 [warning]: poc:391, VBV underflow (-11368 bits)
x265 [warning]: poc:501, VBV underflow (-6152 bits)
x265 [warning]: poc:559, VBV underflow (-320 bits)
x265 [warning]: poc:581, VBV underflow (-16552 bits)
*** dropping frame 639 from stream 0 at ts 344=00:01:03.70 bitrate= 81.3kbits/s dup=576 drop=112
Last message repeated 2 times
*** dropping frame 639 from stream 0 at ts 345
Last message repeated 3 times
*** dropping frame 639 from stream 0 at ts 346
Last message repeated 1 times
*** 70055 dup!