0

I'm trying to stream webcam data over the internet on a lubuntu machine. To achieve this, I've installed ffmpeg and ffserver. However, I can't seem to get this to work. I would like to use the webm format to integrate it as an HTML5 video. I found several examples of this on the internet, so that is where I based my settings on. This is the ffserver config I have at the moment:

HTTPPort 8090                      # Port to bind the server to
HTTPBindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 10000             # Maximum bandwidth per client
                               # set this high enough to exceed stream bitrate
CustomLog -
#NoDaemon                       # Remove this if you want FFserver to daemonize after start

<Feed feed1.ffm>               # This is the input feed where FFmpeg will send
   File ./feed1.ffm            # video stream.
   FileMaxSize 5M              # Maximum file size for buffering video
   ACL allow 127.0.0.1         # Allowed IPs
</Feed>

<Stream camera1.webm>              # Output stream URL definition
   Feed feed1.ffm              # Feed from which to receive video
   Format webm

   # Audio settings
   #AudioCodec vorbis
   #AudioBitRate 64             # Audio bitrate
   NoAudio

   # Video settings
   VideoCodec libvpx
   VideoSize 640x480           # Video resolution
   VideoFrameRate 2           # Video FPS
   AVOptionVideo flags +global_header  # Parameters passed to encoder
                                       # (same as ffmpeg command-line parameters)
   #AVOptionVideo cpu-used 0
   AVOptionVideo qmin 1
   AVOptionVideo qmax 42
   #AVOptionVideo quality good
   AVOptionAudio flags +global_header
   #PreRoll 1
   #StartSendOnKey
   VideoBitRate 400            # Video bitrate
</Stream>

<Stream status.html>            # Server status URL
   Format status
   # Only allow local people to get the status
   ACL allow localhost
   ACL allow 192.168.0.0 192.168.255.255
</Stream>

<Redirect index.html>    # Just an URL redirect for index
   # Redirect index.html to the appropriate site
   URL http://www.ffmpeg.org/
</Redirect>

I put the FPS at 2 seconds, pretty much the maximum the computer I'm using can achieve is 4 for some reason. I then start ffmpeg with the following command:

ffmpeg -f video4linux2 -s 640x480 -r 2 -i /dev/video0 -c:v libvpx http://localhost:8090/feed1.ffm. 

The input is a standard UVC webcam that wprks properly (tested with cheese), ffmpeg seems to work (setting a file as ouput works properly) and the link to ffserver seems to work, the two programs regocnize each other. If an application requests the ffserver stream, it does receive data. wget for example results in a file of the size you would expect with the given bitrate. However, opening the stream in a webpage does not work. I tried it in two ways: simply browsing to the webm link. firefox indicates it's receiving some data, but nothing is displayed. ffserver also indicates that a normal amount of data is transferred. The second option I tried was webpage with video tags for the video stream:

<video with="640" height="480" autoplay>
  <source src="http://localhost:8090/camera1.webm" type="video/webm">
</video>

but this works neither. Who has any idea where I went wrong?

4

1 回答 1

0

<embed>为此,您可以尝试使用该标签。像这样的东西:

<embed type="video/webm" src="http://localhost:8090/camera1.webm" width="640" height="480">

如果这不起作用,你可以尝试127.0.0.1而不是localhost

于 2015-11-02T16:08:35.507 回答