Notes to Self

Alex Sokolsky's Notes on Computers and Programming

Video Lan Client (VLC) Use

vlc cli

HDR Too Dark

The default tone mapping for HDR “Hable” is too dark, tried “Reinhard”:

Preferences -> All -> Video -> Output modules -> OpenGL -> Tone mapping -> Tone-mapping algorithm = Reinhard (simple non-linear)

Did not really work for me.

Multi Channel Audio Output

Preferences -> Audio

All effects are off.

In Windows

Setting Value
Output module Windows Multimedia Device output
HDMI/SPDIF audio passthrough Enabled
Device Receiver

In Linux

Setting Value
Output module Alsa
Device Pick the one that works.

In MacOS

Does not seem to be supported?

Video Capture

Identify the resolution and formats supported by the webcam:

> v4l2-ctl --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture

        [0]: 'MJPG' (Motion-JPEG, compressed)
                Size: Discrete 640x480
                        Interval: Discrete 0.033s (30.000 fps)
                Size: Discrete 848x480
                        Interval: Discrete 0.033s (30.000 fps)
                Size: Discrete 960x540
                        Interval: Discrete 0.033s (30.000 fps)
                Size: Discrete 1280x720
                        Interval: Discrete 0.033s (30.000 fps)
        [1]: 'YUYV' (YUYV 4:2:2)
                Size: Discrete 640x480
                        Interval: Discrete 0.033s (30.000 fps)
                Size: Discrete 640x360
                        Interval: Discrete 0.033s (30.000 fps)
                Size: Discrete 424x240
                        Interval: Discrete 0.033s (30.000 fps)
                Size: Discrete 320x240
                        Interval: Discrete 0.033s (30.000 fps)
                Size: Discrete 320x180
                        Interval: Discrete 0.033s (30.000 fps)
                Size: Discrete 160x120
                        Interval: Discrete 0.033s (30.000 fps)

Based on the above, one arrives at MJPG, 1280x720, as the best format for video capture.

To display webcam in the default format:

vlc v4l2:///dev/video0

Specify the video capture format and metadata on the command line:

vlc --meta-title='Live Feed' \
    --meta-description='Straight from my desk' \
    'v4l2:///dev/video4:width=1920:height=1080:fps=15:chroma=H264:stereo=disabled:samplerate:44100'

v4l2 module cli.

RTSP Support

vlc in some distros is packed without RTSP support due to a license issue.

Use snap instead:

sudo apt purge -y vlc
snap install vlc

Video Streaming

Streaming HowTo

RTP Multicast Live Streaming

Capture, transcode the video and send it to a multicast IP address with the associated SAP announce:

cvlc --meta-title='Live Feed' \
    --meta-description='Straight from my desk' \
    --live-caching 300 \
    'v4l2:///dev/video4:width=1280:height=720:fps=15:chroma=H264:stereo=disabled:samplerate:44100' \
    --sout '#transcode{vcodec=h264,vb=6000,acodec=mp4a,aenc=fdkaac,ab=256}:rtp{mux=ts,dst=239.255.12.42,sdp=sap,name=Test}'

To view the stream:

vlc rtp://239.255.12.42

RTSP Live Streaming

cvlc --meta-title='Live Feed' \
    --meta-description='Straight from my desk' \
    --live-caching 300 \
    'v4l2:///dev/video4:width=1280:height=720:fps=15:chroma=H264:stereo=disabled:samplerate:44100' \
    --sout '#transcode{vcodec=h264,vb=6000,acodec=mp4a,aenc=fdkaac,ab=256}:rtp{dst=127.0.0.1,port=1234,sdp=rtsp://localhost:554/test.sdp}'

To view the stream:

vlc rtsp://localhost:554/test.sdp

Mosaic of RTSP streams

From here:

Create mosaic_vlc3.vlm and then:

vlc.exe --vlm-conf mosaic_vlc3.vlm