8.3. 使用VLS进行流式传输

Note

您需要VLS的CVS版本。编译时,您必须执行./bootstrap./configure --enable-v4l --with-ffmpeg=PATH (其中PATH是您编译ffmpeg的目录的绝对路径,而不是相对路径!)。

目前,此输入没有命令行界面,因此您必须使用配置文件。

这是一个典型的配置文件vls.cfg要使用v4l设备运行VLS

# vls.cfg (VLS configuration file)
# Example of the VideoLAN HOWTO for the Video for Linux input

BEGIN "Inputs"

  webcam       = "v4l"

END

BEGIN "webcam"

  # V4L device
  Device        = "/dev/video"

  # Channel Source : Webcam is often "0"
  #                  TV Card, may be Tuner(0), Composite(1), Svideo(2)
  Channel       = "0"

  # Norm: PAL=0, NTSC=1, SECAM=2
  Norm          = "0"

  # Frequency of the channel in Mhz, multiplied by 16 (tuner cards only)
  Frequency     = "7668"

  # Size possibilities: can be either:
  # - empty string : default size
  # - width x height
  # - subQCIF(128x96), QSIF(160x120), QCIF(176x144), SIF(320x240),
  #   CIF(352x288), VGA (640x480)
  Size          = ""

  # DeInterlace: "0" = no ; "1" = yes
  DeInterlace   = "0"

  # Video compression format: "mpeg1" or "mpeg4"
  Compression   = "mpeg4"

  # Video bitrate (approx.) in kbps
  Bitrate       = "500"

  # Quality: "1.0" (good) to "31.0" (bad)
  Quality       = "1.0"

  # Sound device
  AudioDevice   = "/dev/dsp"

  # Audio compression format: "mp2", "mp3" or "ogg"
  AudioCompression = "mp2"

  # Audio bitrate in kpbs
  AudioBitrate  = "64"

  # Audio frequency ("16000", "22050", "24000", "32000", "44100" or "48000")
  AudioFreq     = "16000"

  # Audio channel: "1" = mono ; "2" = stereo
  AudioChannel  = "2"

END

BEGIN "Channels"

  channel1       = "network"

END

BEGIN "channel1"

  # Unicast or multicast IP address
  DstHost = "192.168.0.42"

  # Destination port
  DstPort = "1234"

  # If it's a multicast IP address, uncomment the line below
  #Type    = "multicast"

  # If it's a multicast IP address, set the "Time To Live" below
  #TTL     = "12"

END

BEGIN "LaunchOnStartUp"

  command1 = "start video channel1 webcam"

END

在您调整上述配置文件后,运行VLS

% vls -vv -f vls.cfg