├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── bbb-mp4-install.sh ├── bbb-mp4.js ├── bbb-mp4.sh ├── bbb_mp4.rb ├── dependencies_check.sh ├── docker-entrypoint.sh ├── download-button.js ├── env-example ├── ffmpeg-cmd.sh ├── nsswrapper.sh ├── package-lock.json └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | composer.phar 2 | /vendor/ 3 | .env 4 | /node_modules/ 5 | nodetext.js 6 | ./index.html 7 | .history 8 | # Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control 9 | # You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file 10 | # composer.lock 11 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Docker base 2 | FROM ubuntu:bionic 3 | 4 | # Create working directory 5 | WORKDIR /usr/src/app 6 | 7 | # Install curl and gnupg2 for source file modification 8 | RUN apt-get -y update && apt-get -y install curl gnupg2 9 | 10 | # Install chrome-stable 11 | RUN curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add 12 | RUN echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list 13 | RUN apt-get -y update 14 | RUN apt-get -y install google-chrome-stable 15 | 16 | #Installing all other dependencies 17 | RUN apt-get -y install software-properties-common 18 | RUN add-apt-repository ppa:jonathonf/ffmpeg-4 19 | RUN apt-get -y update && apt-get -y install libgbm-dev ffmpeg gconf-service libasound2 libatk1.0-0 libc6 libcairo2 \ 20 | libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 \ 21 | libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 \ 22 | libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \ 23 | libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 \ 24 | libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 \ 25 | lsb-release xdg-utils wget xvfb fonts-noto \ 26 | dbus-x11 libasound2 fluxbox libasound2-plugins alsa-utils alsa-oss pulseaudio pulseaudio-utils 27 | 28 | # Install Node.js 29 | RUN curl -sL https://deb.nodesource.com/setup_14.x | bash 30 | RUN apt-get install --yes nodejs 31 | 32 | #copy all files from bbb-mp4 project 33 | COPY *.sh ./ 34 | COPY *.js ./ 35 | COPY *.json ./ 36 | COPY .env ./ 37 | 38 | RUN mkdir processing processed 39 | 40 | #Install npm scripts 41 | RUN npm install npm@latest -g 42 | RUN npm install 43 | 44 | #Initialize ENV 45 | ENV REC_URL=" " 46 | 47 | # Command that will execute when container starts 48 | ENTRYPOINT ["sh","docker-entrypoint.sh"] 49 | CMD node /usr/src/app/bbb-mp4.js $REC_URL 50 | 51 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Manish Katyan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BigBlueButton MP4 2 | 3 | Easily integrate this app into your BigBlueButton server to automatically convert class recordings into MP4 videos. 4 | 5 | ## How it works? 6 | 7 | After a BigBlueButton class ends, recording process kicks in, which will process recording in three stages - archieve, process and publish. Once recording is published, `/usr/local/bigbluebutton/core/scripts/post_publish/bbb_mp4.rb` is executed. 8 | 9 | In `bbb_mp4.rb`, we invoke `bbb-mp4.sh` with corresponding `meeting_id` to convert recording into mp4 video. 10 | 11 | `bbb-mp4.sh` starts a docker process to launch Chrome browser with the BigBlueButton playback URL in a Virtual Screen Buffer, that plays the recording and FFmpeg will capture the screen in mp4 format. MP4 will be moved to `/var/www/bigbluebutton-default/recording`. 12 | 13 | When you visit the default BBB playback url `https:///playback/presentation/2.3/`, either of the following two cases happen: 14 | 15 | - MP4 video exists: A download button will appear at the bottom right. 16 | - MP4 video doesn't exist: A download button will not appear. 17 | 18 | Hence, you can safely deploy this project on your existing BigBlueButton server. 19 | 20 | - Going forward, all your recordings would get converted into MP4 videos. 21 | - Older recordings will still be accessible as default BBB playback recording. 22 | 23 | ### Requirement 24 | 25 | 1. Install the Docker as per the instruction mentioned here https://docs.docker.com/engine/install/ 26 | 27 | ## Install 28 | 29 | ```sh 30 | # Assuming you install bbb-mp4 project at /var/www/ 31 | # SSH to your BigBlueButton server and execute the following commands 32 | cd /var/www 33 | git clone https://github.com/manishkatyan/bbb-mp4.git 34 | cd bbb-mp4 35 | ``` 36 | 37 | Edit `.env` to update the following parameters: 38 | 39 | 1. BBB_DOMAIN_NAME: (Example - bbb.higheredlab.com) 40 | 2. COPY_TO_LOCATION: location where converted MP4 videos should be kept. Leave it at the default value so that you can view MP4 video at `https:///recording/.mp4`. 41 | 42 | ```ssh 43 | # Execute the following to install all required packages. 44 | ./bbb-mp4-install.sh 45 | ``` 46 | 47 | `bbb-mp4-install.sh` will install the following packages In Docker : 48 | 49 | 1. XVFB 50 | 2. Google Chrome 51 | 3. FFmpeg 52 | 4. NodeJS 53 | 5. Dependencies 54 | 55 | During this installation, `bbb-mp4-install.sh` will also do the following: 56 | 57 | - create `bbb_mp4.rb` to invoke `bbb-mp4.sh` that will start automatic MP4 conversion after a class recording is published. 58 | - create a directory `recording` at `/var/www/bigbluebutton-default` to store converted MP4 videos that can be accessed via browser. 59 | - update the default index.html at `/var/bigbluebutton/playback/presentation/2.3/index.html` to provide download button. 60 | 61 | ```sh 62 | 63 | # add user bigbluebutton to docker group 64 | sudo usermod -aG docker bigbluebutton 65 | 66 | # change ownership of /var/www/bbb-mp4 to bigbluebutton 67 | sudo chown -R bigbluebutton:bigbluebutton /var/www/bbb-mp4 68 | 69 | ``` 70 | 71 | You need to give user bigbluebutton sudo access, as detailed above, for bbb-mp4 to run correctly. 72 | 73 | If you are using BigBlueButton 2.6 or higher version you need to add nginx location to access mp4 recording 74 | ```sh 75 | cd /usr/share/bigbluebutton/nginx 76 | sudo touch bbb-mp4.nginx 77 | sudo bash -c "echo 'location /recording { root /var/www/bigbluebutton-default; }' > bbb-mp4.nginx" 78 | sudo nginx -t 79 | sudo nginx -s reload 80 | ``` 81 | 82 | ## How to use it 83 | 84 | No changes are required from your side to view MP4 videos created by bbb-mp4. 85 | 86 | As we updated the default index.html, when you would visit the default playback url - `https:///playback/presentation/2.3/` - you would see a download button 87 | 88 | If you are using Greenlight or Moodle, you will continue to use the same way to view MP4 videos. 89 | 90 | ## Uninstall 91 | 92 | In case you want to restore the default playback.html, please follow the steps below: 93 | 94 | ```sh 95 | mv /var/bigbluebutton/playback/presentation/2.3/index_default.html /var/bigbluebutton/playback/presentation/2.3/index.html 96 | mv /usr/local/bigbluebutton/core/scripts/post_publish/bbb_mp4.rb /usr/local/bigbluebutton/core/scripts/post_publish/bbb_mp4.rb.old 97 | ``` 98 | 99 | With this, you would be able to restore default playback behavior and default post_poublish action. 100 | 101 | ## 🚀 Stress-free BigBlueButton hosting! Start free Trial 102 | 103 | **Save big with our affordable BigBlueButton hosting.** 104 | 105 | - Bare metal servers for HD video 106 | - 40% lower hosting costs 107 | - Top-rated tech support, 100% uptime 108 | - Upgrade / cancel anytime 109 | - 2 weeks free trial; No credit card needed 110 | 111 | Start Free Trial 112 | -------------------------------------------------------------------------------- /bbb-mp4-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Load .env variables 4 | cp env-example .env 5 | sed -i "s/BBB_DOMAIN_NAME=.*/BBB_DOMAIN_NAME=$(bbb-conf --secret | grep URL| cut -d'/' -f3)/g" .env 6 | 7 | set -a 8 | source <(cat .env | \ 9 | sed -e '/^#/d;/^\s*$/d' -e "s/'/'\\\''/g" -e "s/=\(.*\)/='\1'/g") 10 | set +a 11 | 12 | chmod +x *.sh 13 | 14 | echo "Adding bbb_mp4.rb" 15 | cp -r bbb_mp4.rb /usr/local/bigbluebutton/core/scripts/post_publish/ 16 | 17 | 18 | echo "Updating index.html" 19 | if [ ! -f "/var/bigbluebutton/playback/presentation/2.3/index_default.html" ]; then 20 | 21 | echo "index_default.html doesn't exist. Proceed with replacing."; 22 | 23 | # index_default.html is backup of default index.html that comes with fresh bbb install. If you want to remove bbb-mp4, rename index_default.html to index.html. 24 | cp /var/bigbluebutton/playback/presentation/2.3/index.html /var/bigbluebutton/playback/presentation/2.3/index_default.html 25 | 26 | # copying download-button.js 27 | cp download-button.js /var/bigbluebutton/playback/presentation/2.3/ 28 | # Add js tag just befor closing body tag 29 | sed -i 's/<\/body>/