How to configure command line streaming on Linux?

About encoding, codec settings, muxers and filter usage
bobc02
Blank Cone
Blank Cone
Posts: 11
Joined: 26 Aug 2011 06:45

How to configure command line streaming on Linux?

Postby bobc02 » 10 Sep 2011 07:46

I can get the GUI to stream my camera output but when I configure a command line using the properties from the GUI the streaming doesn't work.

I think the problem is I'm not specifying the composite 1 input correctly. I am using --v4l2-input="1", but I couldn't find any examples showing how to do it, so I guessed.

Can someone please help me fix this?

Here's the GUI properties:

Code: Select all

:sout=#transcode{vcodec=WMV2,vb=800,scale=1,acodec=wma2,ab=128,channels=2,samplerate=44100}:http{dst=:8080/camera.asf} :no-sout-rtp-sap :no-sout-standard-sap :sout-keep
Here's what I've tried:

Code: Select all

cvlc v4l2:///dev/video0 --v4l2-input="1" --sout "#transcode{vcodec=WMV2,vb=800,scale=1,acodec=wma2,ab=128,channels=2,samplerate=44100}:http{dst=:8080/camera.asf}" --no-sout-rtp-sap --no-sout-standard-sap --sout-keep
Here's the log:

Code: Select all

-- logger module started -- main debug: using interface module "logger" main debug: TIMER module_need() : 1.452 ms - Total 1.452 ms / 1 intvls (Avg 1.452 ms) main debug: adding item `v4l2:///dev/video0' ( v4l2:///dev/video0 ) main debug: looking for interface module: 1 candidate main debug: using interface module "signals" main debug: TIMER module_need() : 0.861 ms - Total 0.861 ms / 1 intvls (Avg 0.861 ms) main debug: looking for interface module: 1 candidate main debug: rebuilding array of current - root Playlist main debug: rebuild done - 1 items, index -1 main debug: using interface module "globalhotkeys" main debug: TIMER module_need() : 2.830 ms - Total 2.830 ms / 1 intvls (Avg 2.830 ms) main debug: looking for interface module: 1 candidate dummy: using the dummy interface module... main debug: using interface module "dummy" main debug: TIMER module_need() : 0.922 ms - Total 0.922 ms / 1 intvls (Avg 0.922 ms) main debug: processing request item null node Playlist skip 0 main debug: starting new item main debug: creating new input thread main debug: Creating an input for 'v4l2:///dev/video0' main debug: thread (input) created at priority 10 (input/input.c:214) main debug: thread started main debug: using sout chain=`transcode{vcodec=WMV2,vb=800,scale=1,acodec=wma2,ab=128,channels=2,samplerate=44100}:http{dst=:8080/camera.asf}' main debug: stream=`http' main debug: looking for sout stream module: 1 candidate main debug: set config option: sout-standard-dst to :8080/camera.asf stream_out_standard debug: creating `http/(null)://:8080/camera.asf' stream_out_standard debug: extension is asf stream_out_standard debug: extension -> mux=asf stream_out_standard debug: using `http/asf://:8080/camera.asf' main debug: looking for sout access module: 1 candidate main: creating httpd main debug: net: listening to port 8080 main debug: using sout access module "access_output_http" main debug: TIMER module_need() : 1.754 ms - Total 1.754 ms / 1 intvls (Avg 1.754 ms) stream_out_standard debug: access opened main debug: looking for sout mux module: 1 candidate mux_asf debug: asf muxer opened mux_asf debug: Packet size 4096 mux_asf debug: meta data: title='', author='', copyright='', comment='', rating='' main debug: using sout mux module "mux_asf" main debug: TIMER module_need() : 1.341 ms - Total 1.341 ms / 1 intvls (Avg 1.341 ms) stream_out_standard debug: mux opened main debug: using sout stream module "stream_out_standard" main debug: TIMER module_need() : 6.213 ms - Total 6.213 ms / 1 intvls (Avg 6.213 ms) main debug: stream=`transcode' main debug: looking for sout stream module: 1 candidate main debug: set config option: sout-transcode-vcodec to WMV2 main debug: set config option: sout-transcode-vb to 800 main debug: set config option: sout-transcode-scale to 1 main debug: set config option: sout-transcode-acodec to wma2 main debug: set config option: sout-transcode-ab to 128 main debug: set config option: sout-transcode-channels to 2 main debug: set config option: sout-transcode-samplerate to 44100 stream_out_transcode debug: codec audio=wma2 44100Hz 2 channels 128Kb/s stream_out_transcode debug: codec video=WMV2 0x0 scaling: 1.000000 800kb/s main debug: using sout stream module "stream_out_transcode" main debug: TIMER module_need() : 2.121 ms - Total 2.121 ms / 1 intvls (Avg 2.121 ms) main debug: using timeshift granularity of 50 MiB main debug: using timeshift path '/tmp' main debug: `v4l2:///dev/video0' gives access `v4l2' demux `' path `/dev/video0' main debug: creating demux: access='v4l2' demux='' path='/dev/video0' main debug: looking for access_demux module: 1 candidate v4l2 debug: Trying direct kernel v4l2 v4l2 debug: opening device '/dev/video0' v4l2 debug: V4L2 device: Hauppauge WinTV-HVR1150 ATSC/QA using driver: saa7134 (version: 0.2.16) on PCI:0000:05:00.0 v4l2 debug: the device has the capabilities: (X) Video Capture, ( ) Audio, (X) Tuner, ( ) Radio v4l2 debug: supported I/O methods are: (X) Read/Write, (X) Streaming, ( ) Asynchronous v4l2 debug: device supports raw VBI capture v4l2 debug: video input 0 (Television) has type: Tuner adapter v4l2 debug: video input 1 (Composite1) has type: External analog input * v4l2 debug: video input 2 (S-Video) has type: External analog input v4l2 debug: video standard 0 is: NTSC v4l2 debug: video standard 1 is: NTSC-M v4l2 debug: video standard 2 is: NTSC-M-JP v4l2 debug: video standard 3 is: NTSC-M-KR v4l2 debug: video standard 4 is: PAL v4l2 debug: video standard 5 is: PAL-BG v4l2 debug: video standard 6 is: PAL-H v4l2 debug: video standard 7 is: PAL-I v4l2 debug: video standard 8 is: PAL-DK v4l2 debug: video standard 9 is: PAL-M v4l2 debug: video standard 10 is: PAL-N v4l2 debug: video standard 11 is: PAL-Nc v4l2 debug: video standard 12 is: PAL-60 v4l2 debug: video standard 13 is: SECAM v4l2 debug: video standard 14 is: SECAM-B v4l2 debug: video standard 15 is: SECAM-G v4l2 debug: video standard 16 is: SECAM-H v4l2 debug: video standard 17 is: SECAM-DK v4l2 debug: video standard 18 is: SECAM-L v4l2 debug: video standard 19 is: SECAM-Lc v4l2 debug: tuner 0 (Television) has type: Analog TV, frequency range: 0.0 kHz -> 268435455937.5 kHz v4l2 debug: tuner 0 (Television) frequency: 0.0 kHz v4l2 debug: device supports chroma GREY [8 bpp gray, GREY] v4l2 warning: Unable to query for frame sizes v4l2 debug: device supports chroma RV15 [15 bpp RGB, le, RGBO] v4l2 warning: Unable to query for frame sizes v4l2 debug: device codec RGBQ (15 bpp RGB, be) not supported v4l2 debug: device supports chroma RV16 [16 bpp RGB, le, RGBP] v4l2 warning: Unable to query for frame sizes v4l2 debug: device codec RGBR (16 bpp RGB, be) not supported v4l2 debug: device supports chroma RV24 [24 bpp RGB, le, BGR3] v4l2 warning: Unable to query for frame sizes v4l2 debug: device supports chroma RV24 [24 bpp RGB, be, RGB3] v4l2 warning: Unable to query for frame sizes v4l2 debug: device supports chroma RV32 [32 bpp RGB, le, BGR4] v4l2 warning: Unable to query for frame sizes v4l2 debug: device supports chroma RV32 [32 bpp RGB, be, RGB4] v4l2 warning: Unable to query for frame sizes v4l2 debug: device supports chroma YUY2 [4:2:2 packed, YUYV, YUYV] v4l2 warning: Unable to query for frame sizes v4l2 debug: device supports chroma UYVY [4:2:2 packed, UYVY, UYVY] v4l2 warning: Unable to query for frame sizes v4l2 debug: device supports chroma I422 [4:2:2 planar, Y-Cb-Cr, 422P] v4l2 warning: Unable to query for frame sizes v4l2 debug: device supports chroma I420 [4:2:0 planar, Y-Cb-Cr, YU12] v4l2 warning: Unable to query for frame sizes v4l2 debug: device supports chroma YV12 [4:2:0 planar, Y-Cb-Cr, YV12] v4l2 warning: Unable to query for frame sizes v4l2 debug: '/dev/video0' is a video device v4l2 debug: Extended control API not supported by v4l2 driver v4l2 debug: Available control: Brightness (980900) v4l2 debug: integer control v4l2 debug: valid values: 0 to 255 by steps of 1 v4l2 debug: default value: 128 v4l2 debug: current value: 128 v4l2 debug: Available control: Contrast (980901) v4l2 debug: integer control v4l2 debug: valid values: 0 to 127 by steps of 1 v4l2 debug: default value: 68 v4l2 debug: current value: 68 v4l2 debug: Available control: Saturation (980902) v4l2 debug: integer control v4l2 debug: valid values: 0 to 127 by steps of 1 v4l2 debug: default value: 64 v4l2 debug: current value: 64 v4l2 debug: Available control: Hue (980903) v4l2 debug: integer control v4l2 debug: valid values: -128 to 127 by steps of 1 v4l2 debug: default value: 0 v4l2 debug: current value: 0 v4l2 debug: Available control: Volume (980905) v4l2 debug: integer control v4l2 debug: valid values: -15 to 15 by steps of 1 v4l2 debug: default value: 0 v4l2 debug: current value: 0 v4l2 debug: Available control: Mute (980909) v4l2 debug: boolean control v4l2 debug: default value: 0 v4l2 debug: current value: 0 v4l2 debug: video audio-mute: 0 v4l2 debug: Available control: Mirror (980914) v4l2 debug: boolean control v4l2 debug: default value: 0 v4l2 debug: current value: 0 v4l2 debug: Available private control: Invert (8000000) v4l2 debug: boolean control v4l2 debug: default value: 0 v4l2 debug: current value: 0 v4l2 debug: Available private control: y offset odd field (8000001) v4l2 debug: integer control v4l2 debug: valid values: 0 to 128 by steps of 1 v4l2 debug: default value: 0 v4l2 debug: current value: 0 v4l2 debug: Available private control: y offset even field (8000002) v4l2 debug: integer control v4l2 debug: valid values: 0 to 128 by steps of 1 v4l2 debug: default value: 0 v4l2 debug: current value: 0 v4l2 debug: Available private control: automute (8000003) v4l2 debug: boolean control v4l2 debug: default value: 1 v4l2 debug: current value: 1 v4l2 debug: using streaming i/o (mmap) v4l2 debug: found default width and height of 720x576 v4l2 debug: will try to find optimal width and height. v4l2 debug: Found maximum framerate of -1.000000 v4l2 warning: Could not find optimal width and height, falling back to driver default. v4l2 debug: Driver requires at most 622080 bytes to store a complete image v4l2 debug: Interlacing setting: interleaved (bottom top if M/NTSC, top bottom otherwise) v4l2 debug: added new video es I420 720x576 main debug: selecting program id=0 main debug: using access_demux module "v4l2" main debug: TIMER module_need() : 34.973 ms - Total 34.973 ms / 1 intvls (Avg 34.973 ms) main debug: looking for packetizer module: 21 candidates rawvideo warning: invalid frame rate 0/0, using 25 fps instead main debug: using packetizer module "rawvideo" main debug: TIMER module_need() : 1.405 ms - Total 1.405 ms / 1 intvls (Avg 1.405 ms) main debug: thread (decoder) created at priority 0 (input/decoder.c:301) main debug: thread started main debug: starting in async mode main debug: looking for meta reader module: 2 candidates lua debug: Trying Lua scripts in /home/ubuntu/.local/share/vlc/lua/meta/reader lua debug: Trying Lua scripts in /usr/lib/vlc/lua/meta/reader lua debug: Trying Lua playlist script /usr/lib/vlc/lua/meta/reader/filename.luac lua debug: Trying Lua scripts in /usr/share/vlc/lua/meta/reader main debug: no meta reader module matching "any" could be loaded main debug: TIMER module_need() : 2.273 ms - Total 2.273 ms / 1 intvls (Avg 2.273 ms) main debug: `v4l2:///dev/video0' successfully opened main debug: Buffering 0% main debug: switching to sync mode main debug: adding a new sout input (sout_input:0x8559ca0) stream_out_transcode debug: creating video transcoding from fcc=`I420' to fcc=`WMV2' main debug: looking for decoder module: 30 candidates rawvideo warning: invalid frame rate 0/0, using 25 fps instead main debug: using decoder module "rawvideo" main debug: TIMER module_need() : 41.513 ms - Total 41.513 ms / 1 intvls (Avg 41.513 ms) main debug: looking for encoder module: 11 candidates avcodec debug: libavcodec initialized (interface 0x344802) avcodec debug: found encoder Windows Media Video 8 main debug: using encoder module "avcodec" main debug: TIMER module_need() : 15.289 ms - Total 15.289 ms / 1 intvls (Avg 15.289 ms) main debug: removing module "avcodec" main debug: Stream buffering done (67 ms in 67 ms) main debug: Decoder buffering done in 0 ms stream_out_transcode debug: late picture skipped (44602) stream_out_transcode debug: decoder aspect is 1.333333:1 stream_out_transcode debug: source pixel aspect is 1.066667:1 stream_out_transcode debug: scaled pixel aspect is 1.066667:1 stream_out_transcode debug: source 720x576, destination 720x576 stream_out_transcode debug: encoder aspect is 11520:8640 stream_out_transcode debug: destination (after video filters) 720x576 main debug: looking for encoder module: 11 candidates avcodec debug: libavcodec already initialized avcodec debug: found encoder Windows Media Video 8 main debug: using encoder module "avcodec" main debug: TIMER module_need() : 7.035 ms - Total 7.035 ms / 1 intvls (Avg 7.035 ms) main debug: adding a new input mux_asf debug: adding input main warning: late buffer for mux input (510053) stream_out_transcode debug: late picture skipped (522116) stream_out_transcode debug: late picture skipped (457760) stream_out_transcode debug: late picture skipped (392681) stream_out_transcode debug: late picture skipped (327551) stream_out_transcode debug: late picture skipped (262722) stream_out_transcode debug: late picture skipped (198261) stream_out_transcode debug: late picture skipped (135036) stream_out_transcode debug: late picture skipped (72033) stream_out_transcode debug: late picture skipped (5060) stream_out_transcode debug: late picture skipped (1820) stream_out_transcode debug: late picture skipped (1651) stream_out_transcode debug: late picture skipped (1651) stream_out_transcode debug: late picture skipped (1523) stream_out_transcode debug: late picture skipped (1783) stream_out_transcode debug: late picture skipped (2432) stream_out_transcode debug: late picture skipped (2276) stream_out_transcode debug: late picture skipped (1570) stream_out_transcode debug: late picture skipped (1892) stream_out_transcode debug: late picture skipped (1635) stream_out_transcode debug: late picture skipped (1720) stream_out_transcode debug: late picture skipped (1650) stream_out_transcode debug: late picture skipped (1988) stream_out_transcode debug: late picture skipped (4250) stream_out_transcode debug: late picture skipped (1545) stream_out_transcode debug: late picture skipped (1675) stream_out_transcode debug: late picture skipped (1520) stream_out_transcode debug: late picture skipped (1538) stream_out_transcode debug: late picture skipped (1553) stream_out_transcode debug: late picture skipped (1635) stream_out_transcode debug: late picture skipped (1709) -- logger module stopped --

Greg
Cone that earned his stripes
Cone that earned his stripes
Posts: 316
Joined: 24 Feb 2009 00:37

Re: How to configure command line streaming on Linux?

Postby Greg » 10 Sep 2011 22:01

Here is a working example
You can find the (your) input from the gui with "more options" box checked

Code: Select all

vlc v4l2:// :input-slave=alsa:// :v4l2-standard=0 --sout-keep --audio-desync=-160 :sout='#transcode{vcodec=h264,vb=200,fps=25,deinterlace,width=256,height=192,ab=32,acodec=mp3,samplerate=44100,audio-sync}:duplicate{dst=std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=192.168.0.11:8082/stream.flv},dst=display}'

bobc02
Blank Cone
Blank Cone
Posts: 11
Joined: 26 Aug 2011 06:45

Re: How to configure command line streaming on Linux?

Postby bobc02 » 10 Sep 2011 23:55

Thanks very much Greg! The "more options" was the key.

Here's the minimum command line that works for me:

Code: Select all

cvlc v4l2:///dev/video0 :input-slave=alsa:// :v4l2-input=1 --sout "#transcode{vcodec=WMV2,vb=800,scale=1,acodec=wma2,ab=128,channels=2,samplerate=44100}:http{mux=asf,dst=:1234/}" --no-sout-rtp-sap --no-sout-standard-sap --sout-keep
For completeness, and to help others with a similar setup my system is VLC 1.1.4 running under Ubuntu 10.04, Hauppauge WinTV-HVR1150 card with an analog camera attached to Composite output. I am running my own small HTTP server, instead of using VLC's builtin HTTP server, because I have other web pages that I need to present to users. To serve the stream to my website I followed the instructions found at http://wiki.videolan.org/Simple_Stream_VLC_to_Website. The transcode option dst=:1234/, shown above, is key to hooking up VLC stream to the website. The most difficult part was knowing which options to use. This is determined by getting the card working with the VLC GUI and then copying the "more options" and the "Generated Stream output string" from the GUI when you are setting up the Streaming. Most of the options from "more options" can be removed from your command line because the defaults appear to work fine. Do trial and error to figure out the minimal set of options.

I am able to see the camera stream from an IE8 browser running on a winbox on my LAN by pointing at URL http://192.168.1.109:2000/camera.html - which points to the camera.asx file that contains the <REF HREF="http://192.168.1.109:1234" /> - per Simple_Stream_VLC_to_Website.

I am currently only have one problem, it takes about two minutes from the time I point my browser at camera.html until the stream starts showing. I suspect this is solved by adjusting/adding an option. I'd like to get it down to about 10 seconds.

Greg
Cone that earned his stripes
Cone that earned his stripes
Posts: 316
Joined: 24 Feb 2009 00:37

Re: How to configure command line streaming on Linux?

Postby Greg » 11 Sep 2011 12:47

If you follow the link at the end (Note 5) in the Simple Stream wiki, it will take you to..... :)

The Flash method should achieve a delay of less than 10 secs


Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 22 guests