Video Encoding
If you have ffmpeg installed, you can record MP4 videos using the mp4
output plugin.
You can optionally use an audio file as input.
Depending on your computer and/or your setup, MP4 encoding can use a lot of CPU time, which will
slow down display and also break timers (auto sequence/colormap/image changes for example).
To avoid this, use the --soft-timers
option.
Encoding can be started and stopped through the web interface:
To automatically begin encoding when Le Biniou is started, use the --start-encoding
option.
Encoding an audio track using a playlist
You can batch-encode an audio track using sequences with the --playlist
(or -P
) option.
This option takes a JSON filename as argument:
{
"soft timers": true,
"mode": "cycle",
"end": "exit",
"seed": 2847592,
"tracks": [
{
"sequence": "My sequence #1",
"duration": 20
},
{
"sequence": "1596643366",
"duration": 30.5
}
]
}
You can set:
soft timers
: optional, use soft timers (recommended when encoding). If not set, defaults totrue
.mode
: optional, set the order for playing tracks. Can becycle
,shuffle
orrandom
. If the track list’s duration - matches the audio track length, you should usecycle
orshuffle
. If not set, defaults tocycle
.end
: what to do when playing all sequences are done. If not set, Le Biniou will continue running. If set toexit
, - encoding will stop. Note that encoding will automatically stop when the end of the audio track is reached, so this - is not really needed.seed
: optional, a positive random integer to seed the PRNG, so you can get reproducible videos.tracks
: mandatory, must be a list ofsequence
names with theirduration
.
So, given this example.json
playlist:
{
"tracks": [
{
"sequence": "My sequence #1",
"duration": 20
},
{
"sequence": "1596643366",
"duration": 30.5
}
]
}
HD encoding (1920×1080, 30fps) can be achieved using:
$ lebiniou --input sndfile --audio /path/to/some.wav --output mp4 --start-encoding --width 1920 --height 1080 --max-fps 30 --playlist example.json
The video will be saved as ~/.lebiniou/mp4/my_track-YYYY-MM-DD_HH-MM-SS.mp4
.
Tweak mp4 output quality
The mp4 output plugin uses FFMPEG's default values for video and audio encoding quality, which are not optimal and can lead to compression artifacts in both streams if you aim high quality.
Le Biniou provides 2 environment variables to tweak both to your convenience:
-
LEBINIOU_MP4_CRF
, which sets the FFMPEG parameter-crf
, which is the Constant Rate Factor for x264 encoding. It defaults to the same value as FFMPEG with libx264 encoding,23
. From FFMPEG's wiki:The range of the CRF scale is 0–51, where 0 is lossless, 23 is the default, and 51 is worst quality possible. A lower value generally leads to higher quality, and a subjectively sane range is 17–28. Consider 17 or 18 to be visually lossless or nearly so; it should look the same or nearly the same as the input but it isn't technically lossless.
-
LEBINIOU_MP4_AUDIO_ENCODING_RATE
, which sets the FFMPEG parameter-b:a
, which is the audio bitrate for AAC encoding. Its default value is the same as FFMPEG one,128k
.
Recommended bitrate for HQ stereo audio is 224k
to 384k
. More info at
FFMPEG's wiki
.
Exemple above with HQ 1080p mp4 output:
$ LEBINIOU_MP4_CRF=17 LEBINIOU_MP4_AUDIO_ENCODING_RATE=384K lebiniou --input sndfile --audio /path/to/some.wav --output mp4 --start-encoding --width 1920 --height 1080 --max-fps 30 --playlist example.json