VLC命令行实例

【概述】

VLC是著名的音视频播放器,而且难能可贵的是,它支持二次开发:LibVlc、VLCDotNet……。VLC是开源的支持多平台(Windows、Linux、Android、iOS等),还支持对流的操作。VCL有丰富的命令行参数,在我们做二次开发的时候可以直接调用。命令行参数我们可以输入VLC =H获取到最详细的帮助。本文就给出几个最实用的命令行,供大家开发使用。

【说明】

通过我的测试,VLC强项是拉流,包括播放本地文件、本地设备,推流、串流效果不好,连接等待时间长(大约30秒),延迟也长,大约在6秒。请有经验的朋友能指点一二,争取榨干VLC的每一滴“血汗”,呵呵。

【参数实例】

  • 打开桌面(抓屏),指定大小

vlc screen:// 

  • 打开主屏幕(帧速率10)

vlc screen:// --screen-fps=10 --screen-width=1920 

  • 录屏含鼠标

vlc screen:// :screen-mouse-image=c:\player.png

录屏参数
Screen Input
      --screen-fps=       Frame rate
          Desired frame rate for the capture.
      --screen-top=
                                 Subscreen top left corner
          Top coordinate of the subscreen top left corner.
      --screen-left=
                                 Subscreen top left corner
          Left coordinate of the subscreen top left corner.
      --screen-width=
                                 Subscreen width
          Subscreen width
      --screen-height=
                                 Subscreen height
          Subscreen height
      --screen-follow-mouse, --no-screen-follow-mouse
                                 Follow the mouse (default disabled)
          Follow the mouse when capturing a subscreen. (default disabled)
      --screen-mouse-image=
                                 Mouse pointer image
          If specified, will use the image to draw the mouse pointer on the
          capture.
      --screen-fragment-size=
                                 Capture fragment size
          Optimize the capture by fragmenting the screen in chunks of
          predefined height (16 might be a good value, and 0 means disabled).
  • 打开麦克风

vlc dshow:// :dshow-adev="麦克风 (Realtek High Definition Audio)"

  • 同时打开桌面+麦克风

vlc screen:// --screen-fps=10 --screen-width=1920  :input-slave=dshow:// :dshow-adev="麦克风 (Realtek High Definition Audio)"

  • 打开摄像头

vlc dshow:// :dshow-vdev="Integrated Camera" 

  • 打开摄像头、麦克风

vlc dshow:// :dshow-vdev="Integrated Camera" :dshow-adev="麦克风 (Realtek High Definition Audio)"

  • 串流摄像头+麦克风(注意:杀毒软件对摄像头的防护、防火墙限制、摄像头是否在使用中)

服务端:
vlc dshow:// :dshow-vdev="Integrated Camera" :dshow-adev="麦克风 (Realtek High Definition Audio)" :dshow-size=320*240 :sout=#transcode{vcodec=VP80,vb=2000,acodec=vorb,ab=128,channels=2,samplerate=44100}:duplicate{dst=display,dst=rtp{sdp=rtsp://:8554/test}}

客户端:
vlc rtsp://127.0.0.1:8554/test

  • 虚拟摄像头串流

服务端:
vlc -vvv dshow:// :dshow-adev="virtual-audio-capturer" :dshow-vdev="screen-capture-recorder" --sout=#transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:rtp{sdp=rtsp://:8554/} :no-sout-all :sout-keep

客户端:
vlc rtsp://127.0.0.1:8554/

  • 抓屏推流

服务端:
vlc -vvv screen:// --screen-fps=10 --screen-width=1920  --sout=#transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:rtp{sdp=rtsp://:8554/} :no-sout-all :sout-keep
客户端:
vlc rtsp://127.0.0.1:8554/

【注意】

  1. 设备名称要与VLC界面中的一致
  2. 界面中的串流参数稍微修改后,就可以在命令行中使用

你可能感兴趣的:(程序开发,VLC,流媒体,音视频,VLC)