Basically streaming videos does not change anything compared to streaming audio: you just have to use video files instead of sound files! For instance, if you want to stream a single file to an icecast server in ogg format (with theora and vorbis as codecs for audio and video) you can simply type:
And of course you could have used a
playlist instead of
single to have
multiple files, or used other formats for the stream.
In order to test a video stream, it is often convenient to use the
output.graphics) which will open a window and display the video
stream inside. These can handle streams with video only, you can use the
drop_audio operator to remove the sound part of a stream if needed.
You should be expecting much higher resource needs (in cpu time in particular) for video than for audio. So, be prepared to hear the fan of your computer! The size of videos have a great impact on computations; if your machine cannot handle a stream (i.e. it's always catching up) you can try to encode to smaller videos for a start.
Video is a really exciting world where there are lots of cool stuff to do.
Transitions at the beginning or at the end of video can be achieved using
video.fade.out. For instance, fading at the beginning of
videos is done by
You can add a logo (any image) using the
video.add_image operator, as follows:
If your computer has a webcam, it can be used as a source thanks to the
input.v4l2 operator. For instance:
Suppose that you have two video sources
source2 and you want to
display a small copy of
source2 on top of
source. This can be achieved by
Adding scrolling text at the bottom of your video is as easy as
You might need to change the
font parameter so that it matches a font file
present on your system.
There are many of effects that you can use to add some fun to your videos:
video.lomo, etc. Read the
documentation to find out about them. If you have compiled
Liquidsoap with frei0r support, and have
installed frei0r plugins, they will be named
video.frei0r.*. You can have a
list of those supported on your installation as usual, using
You can say that a specific color should be transparent using
video.transparent. For instance, you can put yourself in front of a blue
screen (whose RGB color should be around 0x0000ff) and replace the blue screen
by an image of the weather using
Let's design an “anonymizer” effect: I want to blur my face and change my voice so that nobody will recognise me in the street after seeing the youtube video. Here is what we are going to achieve:
This video was produced thanks to the following script:
In this example we are going to use OSC integration in order to modify the parameters in realtime. There are many OSC clients around, for instance I used TouchOSC :
Here is how the video was made:
You want to show yourself in front of a video of a bunny, as in
The idea is to film yourself in front of a blue screen, make this blue screen transparent and put the resulting video in front of the bunny video (actually, I don't have a blue screen at home, only a white wall but it still kinda works).
Gstreamer codecs can be used to encode videos and audio as any natively supported format. For instance, suppose that you want to stream using harbor in x264 / mp3. This can be achieved as follows:
The video can be read after that at
http://localhost:8000/test and of course an
output.file could have been used instead of
output.harbor depending on your needs.
The usual way to stream a video is using icecast, as for audio. However, it can happen that you want to use weired formats or ways to to stream. In this case, using GStreamer as output (as opposed to simply a codec as above) might be a good idea. For instance, suppose that you want to stream mp4 video using RTP. This can be done as follows:
The stream can then be read with vlc for instance using
vlc test.sdp. Here,
the contents of the file
When I try
I get the error
This error means that the stream
s has an audio channel (as indicated by
output.sdl wants no audio channel. Namely, it's type is
which means that it wants 0 audio channel, 1 video channel and 0 midi
channel. The solution to correct the script is simply to remove the audio
channel using the
Internally, Liquidsoap uses a video format which is the same for all frames. You can change it by doing
Using higher values result in higher quality videos produced, but this also means more computations to perform!
Most videos need to be rescaled to the Liquidsoap internal format. The default
converter is the GAVL library but you can choose other (such as
If you are using
gavl, you can change the scaling mode by
Several modes beside
quadratic are available, use
to discover them. Keep in mind that you should keep a good balance between
performance and quality!