SRS + ffmpeg 推即时视频流

srs: Simple-Rtmp-Server

同类服务器还有,nginx,Red5等等。

项目地址在:https://github.com/ossrs/srs (具体查看官方文档)

获取:

git clone https://github.com/ossrs/srs.git

configure make

cd srs/trunk

./configure && make

开启服务器

./objs/srs -c conf/srs.conf

ffmpeg推流:

D:\360安全浏览器下载\ffmpeg-20170921-183fd30-win64-static\bin>ffmpeg.exe  -f dshow -i video="EasyCamera" -q 4 -s 640*480 -aspect 4:3 -r 10 -vcodec flv  -ar 22050 -ab 64k -ac 1 -acodec libmp3lame -threads 4 -f flv rtmp://192.168.1.102/RTMP/RtmpVideo
ffmpeg version N-87353-g183fd30 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7.2.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib
  libavutil      55. 76.100 / 55. 76.100
  libavcodec     57.106.101 / 57.106.101
  libavformat    57. 82.101 / 57. 82.101
  libavdevice    57.  8.101 / 57.  8.101
  libavfilter     6.105.100 /  6.105.100
  libswscale      4.  7.103 /  4.  7.103
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
Input #0, dshow, from 'video=EasyCamera':
  Duration: N/A, start: 83409.633000, bitrate: N/A
    Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/unknown/unknown), 1280x720, 30 fps, 30 tbr, 10000k tbn, 10000k tbc
Codec AVOption b (set bitrate (in bits/s)) specified for output file #0 (rtmp://192.168.1.102/RTMP/RtmpVideo) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> flv1 (flv))
Press [q] to stop, [?] for help
[swscaler @ 000000000816ef40] deprecated pixel format used, make sure you did set range correctly
Output #0, flv, to 'rtmp://192.168.1.102/RTMP/RtmpVideo':
  Metadata:
    encoder         : Lavf57.82.101
    Stream #0:0: Video: flv1 (flv) ([2][0][0][0] / 0x0002), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 10 fps, 1k tbn, 10 tbc
    Metadata:
      encoder         : Lavc57.106.101 flv
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
[dshow @ 0000000002561ca0] real-time buffer [EasyCamera] [video input] too full or near too full (72% of size: 3041280 [rtbufsize parameter])! frame dropped!
[dshow @ 0000000002561ca0] real-time buffer [EasyCamera] [video input] too full or near too full (91% of size: 3041280 [rtbufsize parameter])! frame dropped!
frame= 1620 fps=9.8 q=4.0 size=   17094kB time=00:02:44.90 bitrate= 849.2kbits/s dup=0 drop=814 speed=   1x

客户端用 vlc查看 

rtmp://192.168.1.102/RTMP/RtmpVideo
另外,Qt也有vlc的库,有空再分享。

作者原创~



你可能感兴趣的:(流媒体)