我正在尝试使用以下命令将一个流转码为不同的格式,并将其发送到 RTMP 服务器进行实时流式传输。
这是我正在使用的命令:
ffmpeg -f mxg -i http://admin:[email protected]:80/control/faststream.jpg?stream=MxPEG -strict -2 -c:v libx264 -c:a aac -ar 44100 -ac 1 -f flv -s 1024x768 rtmp://localhost:1340/big/test
显然,它解码了一些帧并最终出现错误:
ffmpeg version 2.2.2 Copyright (c) 2000-2014 the FFmpeg developers
built on May 7 2014 13:08:45 with gcc 4.8.2 (GCC) 20140206 (prerelease)
configuration: --prefix=/usr --disable-debug --disable-static --enable-avresample --enable-dxva2 --enable-fontconfig --enable-gnutls --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-pic --enable-postproc --enable-runtime-cpudetect --enable-shared --enable-swresample --enable-vdpau --enable-version3 --enable-x11grab
libavutil 52. 66.100 / 52. 66.100
libavcodec 55. 52.102 / 55. 52.102
libavformat 55. 33.100 / 55. 33.100
libavdevice 55. 10.100 / 55. 10.100
libavfilter 4. 2.100 / 4. 2.100
libavresample 1. 2. 0 / 1. 2. 0
libswscale 2. 5.102 / 2. 5.102
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, mxg, from 'http://admin:[email protected]:80/control/faststream.jpg?stream=MxPEG':
Duration: N/A, start: 1399552944.946674, bitrate: 64 kb/s
Stream #0:0: Video: mxpeg, yuvj420p(pc), 1024x768, 10 tbr, 1000k tbn, 1000k tbc
Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
No pixel format specified, yuvj420p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x150a4a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x150a4a0] profile High, level 3.1
[libx264 @ 0x150a4a0] 264 - core 142 r2397 aff928d - 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=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 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=250 keyint_min=10 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, flv, to 'rtmp://localhost:1340/big/test':
Metadata:
encoder : Lavf55.33.100
Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuvj420p, 1024x768, q=-1--1, 1k tbn, 10 tbc
Stream #0:1: Audio: aac ([10][0][0][0] / 0x000A), 44100 Hz, mono, fltp, 128 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mxpeg -> libx264)
Stream #0:1 -> #0:1 (pcm_alaw -> aac)
Press [q] to stop, [?] for help
frame= 23 fps=0.0 q=0.0 size= 0kB time=00:00:06.45 bitrate= 0.5kbits/s
frame= 25 fps= 22 q=0.0 size= 0kB time=00:00:07.06 bitrate= 0.5kbits/s
frame= 27 fps= 16 q=0.0 size= 0kB time=00:00:07.66 bitrate= 0.4kbits/s
frame= 29 fps= 12 q=0.0 size= 0kB time=00:00:08.26 bitrate= 0.4kbits/s
frame= 31 fps= 11 q=0.0 size= 0kB time=00:00:08.84 bitrate= 0.4kbits/s
frame= 33 fps=9.3 q=0.0 size= 0kB time=00:00:09.45 bitrate= 0.3kbits/s
frame= 35 fps=8.4 q=0.0 size= 0kB time=00:00:10.05 bitrate= 0.3kbits/s
frame= 37 fps=7.8 q=0.0 size= 0kB time=00:00:10.65 bitrate= 0.3kbits/s
frame= 39 fps=7.3 q=0.0 size= 5kB time=00:00:11.26 bitrate= 3.6kbits/s
frame= 41 fps=6.9 q=0.0 size= 15kB time=00:00:11.86 bitrate= 10.2kbits/s
[flv @ 0x1509ec0] Packets are not in the proper order with respect to DTS
av_interleaved_write_frame(): Invalid argument
[flv @ 0x1509ec0] Failed to update header with correct duration.
[flv @ 0x1509ec0] Failed to update header with correct filesize.
frame= 42 fps=3.9 q=21.0 Lsize= 179kB time=00:00:11.91 bitrate= 123.2kbits/s
video:38kB audio:171kB subtitle:0 data:0 global headers:0kB muxing overhead -14.421207%
[libx264 @ 0x150a4a0] frame I:1 Avg QP:11.92 size: 38627
[libx264 @ 0x150a4a0] frame P:11 Avg QP:14.66 size: 14503
[libx264 @ 0x150a4a0] frame B:30 Avg QP:18.54 size: 2310
[libx264 @ 0x150a4a0] consecutive B-frames: 2.4% 4.8% 7.1% 85.7%
[libx264 @ 0x150a4a0] mb I I16..4: 31.9% 60.7% 7.4%
[libx264 @ 0x150a4a0] mb P I16..4: 4.7% 28.3% 0.8% P16..4: 17.7% 12.9% 15.5% 0.0% 0.0% skip:20.1%
[libx264 @ 0x150a4a0] mb B I16..4: 0.2% 1.8% 0.0% B16..8: 32.8% 4.0% 2.1% direct: 1.4% skip:57.6% L0:50.7% L1:47.0% BI: 2.2%
[libx264 @ 0x150a4a0] 8x8 transform intra:80.0% inter:87.1%
[libx264 @ 0x150a4a0] coded y,uvDC,uvAC intra: 59.5% 0.6% 0.5% inter: 7.3% 0.1% 0.0%
[libx264 @ 0x150a4a0] i16 v,h,dc,p: 20% 16% 8% 56%
[libx264 @ 0x150a4a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 28% 30% 2% 4% 1% 9% 1% 1%
[libx264 @ 0x150a4a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 41% 34% 11% 2% 4% 1% 5% 1% 1%
[libx264 @ 0x150a4a0] i8c dc,h,v,p: 97% 1% 2% 0%
[libx264 @ 0x150a4a0] Weighted P-Frames: Y:36.4% UV:0.0%
[libx264 @ 0x150a4a0] ref P L0: 55.3% 4.4% 22.7% 14.0% 3.6%
[libx264 @ 0x150a4a0] ref B L0: 82.4% 14.7% 2.8%
[libx264 @ 0x150a4a0] ref B L1: 88.9% 11.1%
[libx264 @ 0x150a4a0] kb/s:171.17
Conversion failed!
以下是关键的几行:
Press [q] to stop, [?] for help
frame= 23 fps=0.0 q=0.0 size= 0kB time=00:00:06.45 bitrate= 0.5kbits/s
frame= 25 fps= 22 q=0.0 size= 0kB time=00:00:07.06 bitrate= 0.5kbits/s
frame= 27 fps= 16 q=0.0 size= 0kB time=00:00:07.66 bitrate= 0.4kbits/s
frame= 29 fps= 12 q=0.0 size= 0kB time=00:00:08.26 bitrate= 0.4kbits/s
frame= 31 fps= 11 q=0.0 size= 0kB time=00:00:08.84 bitrate= 0.4kbits/s
frame= 33 fps=9.3 q=0.0 size= 0kB time=00:00:09.45 bitrate= 0.3kbits/s
frame= 35 fps=8.4 q=0.0 size= 0kB time=00:00:10.05 bitrate= 0.3kbits/s
frame= 37 fps=7.8 q=0.0 size= 0kB time=00:00:10.65 bitrate= 0.3kbits/s
frame= 39 fps=7.3 q=0.0 size= 5kB time=00:00:11.26 bitrate= 3.6kbits/s
frame= 41 fps=6.9 q=0.0 size= 15kB time=00:00:11.86 bitrate= 10.2kbits/s
[flv @ 0x1509ec0] Packets are not in the proper order with respect to DTS
av_interleaved_write_frame(): Invalid argument
[flv @ 0x1509ec0] Failed to update header with correct duration.
[flv @ 0x1509ec0] Failed to update header with correct filesize.
这里出了什么问题?我该如何克服?