对于工作,我需要在运行Ubuntu服务器16的计算机与运行Ubuntu 18.04的客户端计算机之间建立视频+音频链接。 在服务器端,我们有一个网络摄像头(带麦克风)和一个扬声器。这样的想法是,客户端可以看到并听到网络摄像头前发生的事情,并且可以与服务器旁的任何人进行通话。
为此,我在服务器端运行ffserver + ffmpeg以流式传输视频和音频(工作正常,客户端可以看到和听到服务器周围发生的事情),并且客户端还在另一个端口上运行ffserver + ffmpeg ,以便服务器可以使用ffplay听到客户端说的话。 不幸的是,由于某些原因,服务器目前无法运行ffplay。我收到以下错误:
# ffplay -probesize 32 -sync ext http://localhost:8090/camera.rm
ffplay version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2003-2018 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enableopengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave
Input #0, rm, from 'http://localhost:8090/camera.rm': 0B f=0/0
Metadata:
title :
author :
copyright :
comment :
Duration: 01:00:00.00, start: 0.000000, bitrate: N/A
Stream #0:0: Audio: ac3 (dnet / 0x74656E64), 22050 Hz, mono, fltp, 32 kb/s
Stream #0:1: Video: rv10 (RV10 / 0x30315652), yuv420p, 640x480, 2048 kb/s, 24464 fps, 24464 tbr, 1k tbn, 1k tbc
SDL_OpenAudio (1 channels, 22050 Hz):
No more combinations to try, audio open failed
要注意:ffplay过去曾在此服务器上工作。所做的唯一修改是我在ffserver.conf中添加了一些提要和流,但是甚至没有使用它们。我尝试将添加的内容标记为评论并重复测试,但ffplay仍然无法正常工作。
我的ffserver.conf文件如下:
HTTPPort 8090
HTTPBindAddress 0.0.0.0
MaxHTTPConnections 200
MaxClients 100
MaxBandWidth 500000
CustomLog -
#NoDaemon
<Feed camera.ffm>
File /tmp/camera.ffm
FileMaxSize 200M
</Feed>
#<Feed test.ffm>
#File /tmp/test.ffm
#FileMaxSize 200k
#</Feed>
#<Feed audio.ffm>
#File /tmp/audio.ffm>
#FileMaxSize 200M
#</Feed>
<Stream camera.rm>
Feed camera.ffm
Format rm
AudioBitRate 32
VideoFrameRate 15
VideoIntraOnly
VideoBitRate 2048
VideoBufferSize 2048
VideoSize 640x480
VideoQMin 5
VideoQMax 51
Strict -1
</Stream>
#<Stream test.mpg>
#Feed test.ffm
#AudioBitRate 32
#AudioChannels 1
#AudioSampleRate 44100
#VideoBitRate 512
#VideoBufferSize 40
#VideoFrameRate 24
#VideoSize 640x640
#VideoGopSize 12
#VideoQMin 1
#VideoQMax 15
#</Stream>
#<Stream audio.ra>
#Feed audio.ffm
#Format rm
#AudioBitRate 128
#NoVideo
#</Stream>
我使用以下命令:
在服务器端:ffserver -f /etc/ffserver.conf
和:ffmpeg -f v4l2 -i / dev / video0 -f alsa -ac 2 -i hw:0 http://localhost:8090/camera.ffm
并接收音频:ffplay -probesize 32 -sync ext http://10.1.0.244:8080/audio.ra
在客户端:ffserver -f /etc/ffserver.conf
和:ffmpeg -f alsa -ac 2 -i hw:0 http://localhost:8080/audio.ffm
两个ffserver.conf文件(在服务器和客户端上)是相同的,只是端口不同(服务器上为8090,客户端上为8080)。
有人知道为什么ffplay无法在我的服务器上启动吗? 谢谢, 尼古拉斯。