Video streaming with ffmpeg

Ffmpeg is a complete, cross-platform solution to record, convert and stream audio and video.

Installation steps

# sh -c 'echo "deb http://www.deb-multimedia.org jessie main" >> /etc/apt/sources.list'
# apt-get update
# apt-get install deb-multimedia-keyring
# apt-get install ffmpeg
# apt-get install v4l-utils

Configure ffserver

Content of ffserver.conf

HTTPPort 8080                      # 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 -

<Feed feed.ffm>
     File ./feed.ffm
     FileMaxSize 1g
     ACL allow 127.0.0.1
</Feed>

<Stream feed.webm>
     Format webm
     Feed feed.ffm
     VideoCodec libvpx
     VideoSize 320x240
     VideoFrameRate 15
     VideoBitRate 512
     VideoBufferSize 512
     NoAudio
     AVOptionVideo flags +global_header
     StartSendOnKey
</Stream>

<Stream status.html>            # Server status URL
   Format status
   # Only allow local people to get the status
   ACL allow 192.168.1.0 192.168.1.255
</Stream>

#<Redirect index.html>    # Just an URL redirect for index
#   # Redirect index.html to the appropriate site
#  URL /
#</Redirect>

$ ffserver -f ffserver.com

ffmpeg

$ ffmpeg -f v4l2 -i /dev/video0 http://localhost:8080/feed.ffm

Remote access from aweb browser

http://ip_address:8080/status.html

or

http://ip_address:8080/feed.webm

or

<video width="320" height="240" autoplay>
  <source src="http://192.168.1.3:8080/feed.webm" type="video/webm">
Your browser does not support the video tag.
</video>

Links