Video
Getting started with video
In order to stream video, you should first inform your script that you are going to use video by doing
set("frame.video.channels",1)
Optionnaly, you can also set the width, the height and the number of frames per seconds of the streamed video with
set("frame.video.width",320) set("frame.video.height",240) set("frame.video.fps",25)
And that's almost it! You can use usual operators such as single
or playlist
to read video files. For now, only file in the ogg/theora format are supported (you can use the ffmpeg2theora program to convert your videos to this format). For instance, a playlist of ogg videos can be streamed using
output.icecast.theora(playlist("my_playlist"))
where my_playlist
is a list of video files.
If you have SDL support in Liquidsoap, the video part of the stream can be previewed locally using the output.sdl
operator. For example, the script
output.sdl(single("file.ogv"))
will display the video file file.ogv
.
Video effects
A lot of video effects are available in Liquidsoap. The corresponding operators are named video.*
. In particular, the video.fade.in
and video.fade.out
should be used to program transitions, similarly to the fade.in
and fade.out
operators for audio.
Known issues and limitations.
Current support for video is not complete. There are several limitations. In particular, liquidsoap cannot do any video framerate conversion. This means that all video files must have the same number of frames per second as the global setting.
Additionally, in order to maintain audio and video synchronisation, you have to make sure that the duration of a liquidsoap frame is a multiple of the duration of a video frame and the duration of an audio frame.
For instance, if you want to read videos with 10 frames per seconds, and audio is sampled at 44.100 Hz, then
if x
is the length of a liquidsoap frame – set with set("frame.size",x)
:
-
For now liquidsoap frame duration is exactly the audio duration, then the liquidsoap frame duration is:
x*44.100
. -
For this duration, there are exactly:
y = floor(x*44.100/10)
video frames. -
The duration of the
y
frames is:y*10
.
Hence, the equation is: y*10 = x*44.100
for x
and y
integers. We can for instance take y = 1
, such that there
will be a single video frame per liquidsoap frame, and then x = 4.410
, and you have to add the following at the begining of your script:
set("frame.video.channels",1) set("frame.size",4410) set("frame.video.fps",10)
This limitation will be removed with the next major release.