ffmpeg+nginx 的直播(2,直播摄像头和麦克风)

阅读更多
假设我的服务器是centos7 192.168.139.117
分别设置

1.发送端
2.服务端
3.客户端




1.发送端:测试windows
声卡
控制面板-->硬件和声音-->声音-->管理音频设备-->录制-->中文的麦克风改成macfeng (英文就行)

ffmpeg -list_devices true -f dshow -i dummy
C:\Users\Administrator\Desktop\ffmpeg\bin>ffmpeg -list_devices true -f dshow -i
dummy
ffmpeg version N-80101-gd970f7b Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-nv
enc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enabl
e-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --en
able-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libil
bc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-
amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-
librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-li
bspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo
-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libweb
p --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-l
ibzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 24.100 / 55. 24.100
  libavcodec     57. 43.100 / 57. 43.100
  libavformat    57. 37.100 / 57. 37.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 46.100 /  6. 46.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
[dshow @ 0000000000462400] DirectShow video devices (some may be both video and
audio devices)
[dshow @ 0000000000462400]  "Built-in iSight"
[dshow @ 0000000000462400]     Alternative name "@device_pnp_\\?\usb#vid_05ac&pi
d_8507&mi_00#6&c1e2697&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global"
[dshow @ 0000000000462400] DirectShow audio devices
[dshow @ 0000000000462400]  "macfeng (Cirrus Logic CS4206A ("
[dshow @ 0000000000462400]     Alternative name "@device_cm_{33D9A762-90C8-11D0-
BD43-00A0C911CE86}\macfeng (Cirrus Logic CS4206A ("
dummy: Immediate exit requested


得到摄像头的名字和刚才的麦克风设备的名字
摄像头:"Built-in iSight"
麦克风:"macfeng (Cirrus Logic CS4206A ("


测试只要视频的
ffmpeg -r 25 -f dshow -s 640x480 -i video="Built-in iSight" -vcodec libx264 -b 600k   -ab 128k -f flv rtmp://192.168.139.117/hls/mystream

带音频的
ffmpeg -r 25 -f dshow -s 640x480 -i video="Built-in iSight":audio="macfeng (Cirrus Logic CS4206A (" -vcodec libx264 -b 60k  -ab 128k -f flv rtmp://192.168.139.117/hls/mystream


2.服务端
服务端参考 http://haoningabc.iteye.com/blog/2301124
注意配置mime.types 和nginx.conf

3.客户端
放在服务器上的客户端的代码
index.html
###########
Play | Record

Loading the player ...

######################


参考
http://blog.csdn.net/leixiaohua1020/article/details/12029543
https://trac.ffmpeg.org/wiki/DirectShow
https://trac.ffmpeg.org/wiki/Capture/Webcam

你可能感兴趣的:(nginx,ffmpeg)