Converting Guac Session Recordings to MP4

Guide to convert Guac session recordings to MP4 using two steps: first, convert from Guac format to M4V, then from M4V to MP4 using FFmpeg. This method works across Linux, Windows, and macOS environments using Docker

Table of Content

  1. Prerequisites
  2. Setup Docker Container
  3. Convert Guac Session Recording to MP4

Prerequisites:

  1. Docker: Ensure that Docker is installed and running on your machine.
  2. Guacamole Session Recordings: You should have Guacamole session recordings that need to be converted.

Setup Docker Container

Step 1: Create a Dockerfile

The following Dockerfile sets up an environment with all the required dependencies to convert Guac recordings. It installs necessary libraries, downloads, and installs the Guacamole server, and includes FFmpeg for further video conversion.

Dockerfile

FROM ubuntu:24.04

ENV LD_LIBRARY_PATH=/usr/local/lib


# Install dependencies

RUN apt update && apt install -y libcairo2-dev libjpeg-turbo8-dev libpng-dev libtool-bin libossp-uuid-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev wget ffmpeg make


# Download and install guacamole-server

RUN wget -O guacamole-server-1.5.5.tar.gz "http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/1.5.5/source/guacamole-server-1.5.5.tar.gz"

RUN tar -xzf guacamole-server-1.5.5.tar.gz

WORKDIR /guacamole-server-1.5.5

RUN ./configure --with-init-dir=/etc/init.d --disable-dependency-tracking

RUN make

RUN make install


# Set the default command

ENTRYPOINT ["/bin/bash"]

Step 2: Build the Docker Image

Once you have the Dockerfile created, build the Docker image by running the following command in the directory where the Dockerfile is located:

sudo docker build . -t guacdenc

This will create a Docker image named guacdenc.

To check you have successfully built the image you can check by running the follow command

sudo docker image ls | grep "guacenc"

Step 3: Run the Docker Container

After building the Docker image, run the container and mount the local folder containing Guacamole session recordings to /recordings inside the container.

sudo docker run -v "<local_path_of_your_recordings>:/recordings" --rm -d -it --name guacenc guacdenc:latest

Replace <local_path_of_your_recordings> with the actual path of the folder containing the recordings on your local machine.

Note: The steps above just for first time setup

 


 

Convert Guac Session Recording to MP4


Step 1: Download recording file

Download the recording file from user portal 

Note: Ensure the status is available

Screenshot_16Screenshot_17

Step 2: Upload the downloaded record file to directory

After the download is complete, upload the recording file to <local_path_of_your_recordings> directory (Refer to Setup Docker Container part step 3).

Step 3: Convert to m4v format using guacenc utility

To convert a recording to the M4V format, use the guacenc utility inside the running container. Run the following command:

sudo docker exec -it guacenc guacenc -f /recordings/<recording_filename>

Replace <recording_filename> with the name of the Guacamole session recording (without file extension).

Step 4: Convert M4V to MP4 Format using ffmpeg

To convert the M4V file to MP4 using FFmpeg inside the container. Run the following command:

sudo docker exec -it guacenc ffmpeg -i /recordings/<recording_filename>.m4v /recordings/<recording_filename>.mp4

Replace <recording_filename> with the actual name of your M4V recording.

Once done, you can find the converted MP4 file in your local recordings folder.


Troubleshooting

  • Error with guacenc command: Ensure that the Guacamole recording file exists in the /recordings folder and has the correct file extension.
  • FFmpeg conversion issues: Ensure that FFmpeg is installed properly inside the container. You can check the FFmpeg version by running ffmpeg -version.

Note: If you want to convert multiple videos, you need to repeat the step for each video.