无法通过ffmpeg来播放网络摄像头

时间:2017-11-29 13:24:53

标签: ffmpeg raspberry-pi ffserver

我安装了一个带有ffmpeg的rapsberry,并安装了一个microsoft hd3000 cam 我运行以下命令: ffserver -f /etc/ffserver.conf& ffmpeg -framerate 21 -re -f video4linux2 -i / dev / video0 -f alsa -i sysdefault:CARD = HD3000 http://localhost:8090/feed1.ffm

我得到以下内容:

/etc/ffserver.conf:164: Setting default value for video bit rate tolerance = 16000. Use NoDefaults to disable it.
/etc/ffserver.conf:164: Setting default value for video rate control equation = tex^qComp. Use NoDefaults to disable it.
/etc/ffserver.conf:164: Setting default value for video max rate = 6229744. Use NoDefaults to disable it.
/etc/ffserver.conf:219: Setting default value for audio sample rate = 22050. Use NoDefaults to disable it.
/etc/ffserver.conf:219: Setting default value for audio channel count = 1. Use NoDefaults to disable it.
/etc/ffserver.conf:219: Setting default value for video bit rate tolerance = 64000. Use NoDefaults to disable it.
/etc/ffserver.conf:219: Setting default value for video rate control equation = tex^qComp. Use NoDefaults to disable it.
/etc/ffserver.conf:219: Setting default value for video max rate = 6369328. Use NoDefaults to disable it.
bind(port 8090): Address already in use
Wed Nov 29 13:17:49 2017 Could not start server
[video4linux2,v4l2 @ 0x1a35630] The driver changed the time per frame from 1/21 to 1/10
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 12116.079136, bitrate: 147456 kb/s
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1280x720, 147456 kb/s, 10 fps, 10 tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, alsa, from 'sysdefault:CARD=HD3000':
  Duration: N/A, start: 1511961469.424072, bitrate: 1536 kb/s
    Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
[tcp @ 0x1a44160] Connection to tcp://localhost:8090 failed (Connection refused), trying next address
Wed Nov 29 13:17:49 2017 127.0.0.1 - - [GET] "/feed1.ffm HTTP/1.1" 200 4175
[tcp @ 0x1a63ca0] Connection to tcp://localhost:8090 failed (Connection refused), trying next address
[mpeg1video @ 0x1a6ecb0] bitrate tolerance 21333 too small for bitrate 64000, overriding
[mpeg1video @ 0x1a6ecb0] MPEG-1/2 does not support 3/1 fps
Stream mapping:
  Stream #1:0 -> #0:0 (pcm_s16le (native) -> mp2 (native))
  Stream #0:0 -> #0:1 (rawvideo (native) -> mpeg1video (native))
  Stream #1:0 -> #0:2 (pcm_s16le (native) -> wmav2 (native))
  Stream #0:0 -> #0:3 (rawvideo (native) -> msmpeg4v3 (msmpeg4))
Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height
Wed Nov 29 13:17:49 2017 127.0.0.1 - - [POST] "/feed1.ffm HTTP/1.1" 200 0
[2]+  Exit 1                  ffserver -f /etc/ffserver.conf

我使用默认的/etc/ffserver.conf。 我似乎无法弄清问题是什么。

1 个答案:

答案 0 :(得分:0)

  

MPEG-1/2 does not support 3/1 fps

这是导致失败的错误。虽然您将帧速率设置为21,但网络摄像头正在更改它。

ffmpeg方面,您有两种选择:

  • 使用可支持任意帧速率的mpeg1video / mpeg2video以外的其他编码器,或

  • 如果您想继续使用mpeg1video,请参阅-r和/或-vsync选项以正确处理输出帧速率。

请注意,ffserver计划很快从FFmpeg中删除。您可能想要找到替代方案。