Jibri For Recording Mobile Video, Changing Screen Sizes and Multiple Screen Sizes

Question about Jibri and recording different screen sizes. Jibri uses a virtual chrome instance for doing recordings as such:

    // The flags which will be passed to chromium when launching
    flags = [
      "--user-agent='Jibri Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36'"

So I imagine if I add the flags --window-size I can change the default screen height of 800x600 to whatever I want. And a recording or livestream to from Jitsi to Jibri is initiated as such:

let record = room.startRecording({
                mode: JitsiRecordingConstants.mode.FILE,
                appData: JSON.stringify({
                    'file_recording_metadata': {
                        'share': shouldShare,
                        'event_id': [some_event_id],
                        'jwt': '[some_jtwt]'

The problem I am running across is not everyone wants the same resolution when recording, ie desktop users want a desktop view, mobile users want a mobile view. And sometimes the screen size is larger than the chromium window. A few questions:

1. Dynamically Setting The Height
Is there a way where I can pass in in a value that dynamically will set the --window-size attribute?

2. Changing Screen Size
If the contents goes below the fold, it will be cut off the recording. Can Chromium adjust its own widget and height to accommodate new content?

3. Multiple Jibri Instances
It is possible to setup multiple Jibri instances to record? For example the record button is hit, two Jibris are called, one that does a desktop recording of the session and another that does a mobile recording?

jibri doesn’t record or stream the Chrome window, it records the desktop. So changing Chrome window size will not work.

1 Like

@emrah so re-phrasing the question, is it possible to dynamically set or change the window size of the desktop to be that of a mobile device dimensions?

jibri uses fmpeg while processing the video. If you find a way to pass the requested screen size to it, ffmpeg can crop the video.

@emrah Thanks, I think I understand but I have one point of confusion. First, for my recordings, I am overriding the ffmpeg by having a custom ffmpeg in my /usr/bin/local/ffmpeg as such:

echo ffmpeg in $0 #Comment this line after making sure, that running ffmpeg, points to this script.

ARGS=$(echo $ARGS | sed 's/-tune zerolatency/-tune zerolatency -vf scale=1920x1080 /') #Scale Video to 854x480

echo $ARGS >> /tmp/ffmpeg.log

exec /usr/bin/ffmpeg $ARGS

Let’s say I pass a crop in the query string such as this in Jitsi:

record = room.startRecording({
                broadcastId: [some_id],
                mode: JitsiRecordingConstants.mode.STREAM,
                streamId: rtmp://www.example.com/live?crop=640x1136

And in my /user/local/bin/ffmpeg I had:

if [[ -n "$(echo $ARGS | grep ' crop=')" ]]; then
    CROP = awk 'BEGIN { RS=";" ; FS=": " } $1 ~ /crop/ { print $2 }'


Wouldn’t it not matter because the because the desktop is still 1080p and Chromimun is still at 1080p, and the croup would just be cutting off part of the video vs recording the correct dimension?

Right, the desktop resolution will be the same but ffmpeg will crop unneeded parts and resize the video according to the parameter

Maybe instead of cropping it, you can use the “scale” ffmpeg filter to change the resolution to a lower one - for example instead of 1920x1080 just put a “scale=720:-1”, it should reduce the output to 720p. If I understood correctly…

IIUC @BingeWave want to change the orientation too

Then maybe transpose? Although I haven’t used it for JIbri, so this is all just theoretical :slight_smile:

p.s.: FFmpeg has a lot of parameters and filters, so almost anything is possible, but it’s important to have in mind that you can’t get more video info than there already is in the source. So rotating, for example, may work technically, but how usable the result will be - @BingeWave you’ll have to test and determine this.