Vlc

From Hurlster Wiki
Jump to navigation Jump to search

This page is for information in regards to playing and streaming media files utilizing VLC

VLC Options

  • Diffserv Code Point (dscp)
vlc --dscp number streaming-output-info

Utilize the table below to find the corresponding number value, use the number on the far left of the table for VLC.
http://www.hurlster.com/wiki/tostable.html

  • Example EF set bit
vlc-wrapper --dscp 184 -I dummy pvr:// :pvr-device="/dev/video0" --sout '#rtp{mux=ts,dst=123.456.789.123,port=5004}'

Hauppauge PVR-250

Set Video Input

v4l2-ctl -i 1
  • Startup Script
#!/bin/bash

echo Current:
#v4l2-ctl --get-fmt-video
#v4l2-ctl --set-fmt-video=width=720,height=576
#sleep 1
v4l2-ctl -i 1
sleep 1
echo Current:
v4l2-ctl -L |grep audio_layer_ii_bitrate
v4l2-ctl -c audio_layer_ii_bitrate=13
sleep 1
echo Current:
v4l2-ctl -L |grep 'video_bitrate_mode (menu'
v4l2-ctl -c video_bitrate_mode=1
sleep 1
echo Current:
v4l2-ctl -L |grep 'video_bitrate (int'
v4l2-ctl -c video_bitrate=27000000
sleep 1
echo Current:
v4l2-ctl -L |grep video_peak_bitrate
v4l2-ctl -c video_peak_bitrate=27000000
exit 0
  • Working config
User Controls

                    brightness (int)    : min=0 max=255 step=1 default=128 value=128 flags=slider
                      contrast (int)    : min=0 max=127 step=1 default=64 value=64 flags=slider
                    saturation (int)    : min=0 max=127 step=1 default=64 value=64 flags=slider
                           hue (int)    : min=-128 max=127 step=1 default=0 value=0 flags=slider
                        volume (int)    : min=0 max=65535 step=655 default=58880 value=58880 flags=slider
                       balance (int)    : min=0 max=65535 step=655 default=32768 value=32768 flags=slider
                          mute (bool)   : default=0 value=0
                    chroma_agc (bool)   : default=1 value=1 flags=update
                   chroma_gain (int)    : min=0 max=127 step=1 default=40 value=47 flags=inactive, slider, 00000080

MPEG Encoder Controls

                   stream_type (menu)   : min=0 max=5 default=0 value=0 flags=update
                               0: MPEG-2 Program Stream
                               2: MPEG-1 System Stream
                               3: MPEG-2 DVD-compatible Stream
                               4: MPEG-1 VCD-compatible Stream
                               5: MPEG-2 SVCD-compatible Stream
             stream_vbi_format (menu)   : min=0 max=1 default=0 value=0
                               0: No VBI
                               1: Private Packet, IVTV Format
      audio_sampling_frequency (menu)   : min=0 max=2 default=1 value=1
                               0: 44.1 kHz
                               1: 48 kHz
                               2: 32 kHz
                audio_encoding (menu)   : min=0 max=4 default=1 value=1 flags=update
                               1: MPEG-1/2 Layer II
        audio_layer_ii_bitrate (menu)   : min=0 max=13 default=10 value=9
                               9: 192 kbps
                               10: 224 kbps
                               11: 256 kbps
                               12: 320 kbps
                               13: 384 kbps
             audio_stereo_mode (menu)   : min=0 max=3 default=0 value=0 flags=update
                               0: Stereo
                               1: Joint Stereo
                               2: Dual
                               3: Mono
   audio_stereo_mode_extension (menu)   : min=0 max=3 default=0 value=0 flags=inactive
                               0: Bound 4
                               1: Bound 8
                               2: Bound 12
                               3: Bound 16
                audio_emphasis (menu)   : min=0 max=2 default=0 value=0
                               0: No Emphasis
                               1: 50/15 us
                               2: CCITT J17
                     audio_crc (menu)   : min=0 max=1 default=0 value=0
                               0: No CRC
                               1: 16-bit CRC
                    audio_mute (bool)   : default=0 value=0
                video_encoding (menu)   : min=0 max=1 default=1 value=1
                               0: MPEG-1
                               1: MPEG-2
                  video_aspect (menu)   : min=0 max=3 default=1 value=1
                               0: 1x1
                               1: 4x3
                               2: 16x9
                               3: 2.21x1
                video_b_frames (int)    : min=0 max=33 step=1 default=2 value=2 flags=update
                video_gop_size (int)    : min=1 max=34 step=1 default=15 value=15
             video_gop_closure (bool)   : default=1 value=1
            video_bitrate_mode (menu)   : min=0 max=1 default=0 value=1 flags=update
                               0: Variable Bitrate
                               1: Constant Bitrate
                 video_bitrate (int)    : min=0 max=27000000 step=1 default=6000000 value=6000000
            video_peak_bitrate (int)    : min=0 max=27000000 step=1 default=8000000 value=8000000 flags=inactive
     video_temporal_decimation (int)    : min=0 max=255 step=1 default=0 value=0
                    video_mute (bool)   : default=0 value=0
                video_mute_yuv (int)    : min=0 max=16777215 step=1 default=32896 value=32896
           spatial_filter_mode (menu)   : min=0 max=1 default=0 value=0 flags=update
                               0: Manual
                               1: Auto
                spatial_filter (int)    : min=0 max=15 step=1 default=0 value=0 flags=slider
      spatial_luma_filter_type (menu)   : min=0 max=4 default=1 value=1
                               0: Off
                               1: 1D Horizontal
                               2: 1D Vertical
                               3: 2D H/V Separable
                               4: 2D Symmetric non-separable
    spatial_chroma_filter_type (menu)   : min=0 max=1 default=1 value=1
                               0: Off
                               1: 1D Horizontal
          temporal_filter_mode (menu)   : min=0 max=1 default=0 value=0 flags=update
                               0: Manual
                               1: Auto
               temporal_filter (int)    : min=0 max=31 step=1 default=8 value=8 flags=slider
            median_filter_type (menu)   : min=0 max=4 default=0 value=0 flags=update
                               0: Off
                               1: Horizontal
                               2: Vertical
                               3: Horizontal/Vertical
                               4: Diagonal
    median_luma_filter_minimum (int)    : min=0 max=255 step=1 default=0 value=0 flags=inactive, slider
    median_luma_filter_maximum (int)    : min=0 max=255 step=1 default=255 value=255 flags=inactive, slider
  median_chroma_filter_minimum (int)    : min=0 max=255 step=1 default=0 value=0 flags=inactive, slider
  median_chroma_filter_maximum (int)    : min=0 max=255 step=1 default=255 value=255 flags=inactive, slider
     insert_navigation_packets (bool)   : default=0 value=0

Streaming

GUI

Command line commands

Linux Platform

HTTP stream PVR-250 card

  • as root no transcode
vlc-wrapper -I dummy pvr:// :pvr-device="/dev/video0" --sout '#standard{access=http,mux=ts,dst=192.168.0.254:8081}'
cvlc -vv -I dummy pvr:// :pvr-device="/dev/video0" :norm=ntsc :bitrate=2000000 :maxbitrate=3000000 --cr-average 1000 \
--sout '#standard{access=http,mux=ts,dst=192.168.0.254:8080}'
cvlc -v -I dummy --color pvr:// :pvr-device="/dev/video0" :norm=ntsc:bitrate=2000000:maxbitrate=2500000 --cr-average 1000 \
--sout '#transcode{vcodec=mp4v,vb=2024,deinterlace,scale=1}:std{access=http,mux=ts,dst=192.168.0.254:8081}'

Flash Stream

cvlc -I dummy pvr:// :pvr-device="/dev/video0" --cr-average 1000 \
--sout "#transcode{vcodec=FLV1,acodec=mp3,samplerate=44100}:std{access=http,dst=0.0.0.0:8080/stream.flv}"

RTP to relay server

#MP4 to streaming server
cvlc -I dummy pvr:// :pvr-device="/dev/video0" :norm=ntsc :size=720x480 :bitrate=2000000 :maxbitrate=3000000 \
--sout '#transcode{vcodec=mp4v,acodec=mpga,threads=3,scale=.75,vb=2000,ab=128,venc=ffmpeg{keyint=80,hurry-up,vt=800000},deinterlace,sfilter={marq{marquee=Testing,x=3,y=10,color=16776960}}}:rtp{mux=ts,dst=1.2.3.4,port=5004}' --ttl 12

H264 Stream on port 8080

# stream source
device=/dev/video0
norm=ntsc
capture_height=640
capture_width=480
bitrate=4000000
maxbitrate=8000000

# transcoding
#width=448
#height=336
width=640
height=480
fps=25

vcodec=h264
vbitrate=1024

acodec=mp4a
abitrate=128
achannels=1

# streaming
access=http
mux=asf
bindaddress=192.168.0.254
port=8080

vlc-wrapper --intf dummy pvr:// :pvr-device="$device":norm=$norm:height=$capture_height:width=$capture_width:bitrate=$bitrate:maxbitrate=$maxbitrate \
--sout "#transcode{fps=$fps,width=$width,height=$height,vcodec=$vcodec,venc=x264{aud,profile=baseline,level=30,keyint=30,ref=1},\ vb=$vbitrate,scale=1,acodec=$acodec,ab=$abitrate,channels=$achannels,deinterlace}\
:duplicate{dst=std{access=$acces,mux=$mux,dst=$bindaddress:$port}}"
vlc-wrapper --intf dummy pvr:// :pvr-device=/dev/video0 :norm=ntsc:height=640:width=480:bitrate=4000000:maxbitrate=8000000 \
--sout #transcode{fps=25,width=640,height=480,vcodec=h264,venc=x264{aud,profile=baseline,level=30,keyint=30,ref=1}\
,vb=1024,scale=1,acodec=mp4a,ab=128,channels=1,deinterlace}:duplicate{dst=std{access=http,mux=asf,dst=192.168.0.254:8080}}

Webcam

 vlc-wrapper "v4l2:///dev/video0" --sout="#transcode{vcodec=theo,vb=256}:standard{access=http,mux=ogg,dst=:8082}" -I dummy
JustinTV from Linux

http://apiwiki.justin.tv/mediawiki/index.php/Linux_Broadcasting_API

  • VLC Setup

Broadcast file

vlc-wrapper "movie.avi" -v --sout='#transcode{venc=x264{keyint=60,idrint=2},vcodec=h264,vb=2500,acodec=mp4a,ab=128,channels=2\
,samplerate=22050}:rtp{dst=127.0.0.1,port=1234,sdp=file:///home/user/movie.sdp}'

Broadcast Live Video(hauppauge)

vlc-wrapper -v --intf dummy pvr:// :pvr-device="/dev/video0" --sout='#transcode{venc=x264{keyint=60,idrint=2},vcodec=h264\
,vb=2500,acodec=mp4a,ab=128,channels=2,samplerate=22050}:rtp{dst=127.0.0.1,port=1234,sdp=file:///home/user/video0.sdp}'
  • Justin.tv Stream Key
http://www.justin.tv/broadcast/adv_other
  • JTVLC Setup
cd /usr/local/src/
git clone https://github.com/justintv/jtvlc.git
cd jtvlc

nano config.py

# app specific
version = '0.41'
user_agent = 'Justin.tv Jtvlc ' + version
api_key = 'jla8h4Dei14Tr2'
website = 'http://community.justin.tv/mediawiki/index.php/Vlc'

# user specific
username = ''
streamkey = ''
sdp_location = ''

# justin.tv specific
realm = 'Justin.tv'
password = 'jtv'
ip = 'live.justin.tv'
port = 1935
domain = 'rtsp://%s:%d' % (ip, port)
file = ''
uri = ''

packet_log = False
debug_log = False
video_server_connection = None
sdp_contents = None
rtp_ports = []
rtcp_ports = []
o1 = ''
o2 = ''
live_sent = 0
should_reconnect = 0
  • Start it up
jtvlc.py jtvusername live_13158546_sdijfsdufsd234Fuw file:///home/user/movie.sdp
Windows Platform

Stream it (RSTP)

vlc -vvv dshow:// :dshow-vdev="Hauppauge WinTV PVR PCI II Capture" :dshow-adev=  :dshow-caching=200 /
--sout "#rtp{dst=69.163.154.1,port=554,sdp=rtsp://straming.hurlster.com/streaming.hurlster.com/live.sdp}"

View it

vlc -vvv dshow:// :dshow-vdev="Hauppauge WinTV PVR PCI II Capture" :dshow-adev=  :dshow-caching=200

Stream it (HTTP MP4) - slams CPU

vlc -vvv dshow:// :dshow-vdev="Hauppauge WinTV PVR PCI II Capture" :dshow-adev=  :dshow-caching=200 /
:sout=#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100} /
:http{mux=ffmpeg{mux=flv},dst=:8080/} :no-sout-rtp-sap :no-sout-standard-sap :sout-keep

Test Stream to DSS

vlc -vvv dshow:// :dshow-vdev="Hauppauge WinTV PVR PCI II Capture" :dshow-adev=  :dshow-caching=200 
--sout "#transcode{venc=ffmpeg{keyint=1},vcodec=mp4v,vb=100k,acodec=mp4a,fps=10,ab=8k,channels=1,samplerate=16000}
:rtp{mp4a-latm,dst=69.163.154.1,port-audio=20000,port-video=20002,ttl=127,name=CHANNEL,sdp=file:///usr/local/movies
/channel.sdp}"

Relaying

"Middle Man" server to relay the stream (1.2.3.4)

cvlc -v rtp://1.2.3.4:5004 ":sout=#std{access=http,mux=ts,dst=1.2.3.4:8081}"

Playing

GUI

Command line commands

Linux Platform
Windows Platform