📜 ⬆️ ⬇️

How we made a studio to record online courses

In short, Stepic is a platform where each user can create and host his own online course. Last year, Stepic was used in the Bioinformatics Algorithms course on Coursera as an engine for testing programming and data analysis tasks.

After some time, we realized that it was worth helping to develop online education in Russia. What is needed for that? Good teachers and a good studio where you can record video. Since we love programming, we decided to start with courses that are somehow related to programming, these are algorithms and data structures , operating systems and C ++ language from teachers at the Computer Science Center.

And after some time we realized that the more good recording studios there are, the better for all of us and education in general . Therefore, we decided to tell, show and put in open-source all those small developments that currently exist in Stepic in terms of video courses and their production.

Studio and equipment


This diagram shows the automated video lecture recording process to which we arrived:
')
image

We decided not to reinvent the wheel, but to see how similar projects are equipped abroad. The starting point was the studio in the Swiss EPFL , where the EMOOCs 2014 conference took place in the winter. A video about the studio in EPFL can be viewed here .

A list of necessary equipment was made (approximate prices in Russia are indicated):
  1. 2 stands for the background (3'000 rub. Per piece)
  2. 4 racks for 4 light sources (1'500 rubles apiece)
  3. 2 sources of FalconEyes with 5 energy saving lamps of cold light on a background light (5'500 rub apiece)
  4. 2 sources with cold light lamps for lecturer lighting (DFL-556) (11'000 rub. Per piece)
  5. White and green background (1'500 rub. Per piece)
  6. Canon XA25 camcorder (90'000 rubles)
  7. Tripod under the camera Libec TH-950DV (10'000 rub.)
  8. Audio-Technica AT2031 microphone (8'000 rub.), Stuck into the camera
  9. Stand under the microphone Samson MB1 Mini Boom Stand (2'500 rub.)
  10. Microphone mount for AT8410a Microphone Shock Mount (3'500 rub.)
  11. Wacom Cintiq 24HD Interactive Pen Display DTK-2400 (120'000 rub.) - a monitor on which you can draw by hand on the slides
  12. Apple Mac mini: i5, 2.5HGz (Late 2012) (~ 25'000 rub.) - the teacher's computer, which is connected to the monitor Wacom
  13. PC (Server): i7, 3 TB HDD, 16 GB RAM, Win (~ 25'000 rub.) - a computer on which the server is running and where video streams flow
  14. AJA ROI (35'000 rub.)
  15. BlackMagic DeckLink Duo (18'000 rub.)

Total, approximately: 385 thousand rubles.

I think the choice of all items, with the exception of three, does not cause questions. But about why we chose this canon and why AJA ROI and DeckLink are needed, I would like to tell you below.

AJA ROI and DeckLink Duo


AJA ROIDecklink Duo

In our studio (as in the studio of the Swiss), we use BNC wires that come out of the camera and AJA ROI and come to Decklink Duo on the PC. Which, at a certain point, at the request of the teacher, begins to record two streams and carefully fold them into a daddy on the server. AJA ROI serves as a signal splitter, it is installed between Mac mini and Wacom, it duplicates the channel that Mac mini receives and sends it to the server.

Above was presented a schematic view of the studio so that you can understand how we have the light sources and how the wires are drawn.

Camera


Camera Canon XA25 was not chosen by chance. The fact is that this model is the only one on the market in a similar price segment that has SDI output, and this is very important.

What kind of SDI channel is this and why is it so rarely heard about it if it is so good?

SDI is an image transmission standard that is still used in television and the transmission medium of this channel is the usual 75-ohm coaxial cable found in every radio store. That's all. So why use this SDI? It's very simple, if you have 2 SDI channels encoded in real time, you have no problems, if you use the HDMI protocol instead of SDI, then you may already need additional equipment capable of processing these streams in real time.

Also advantages SDI is the relative lack of restrictions imposed on the length of the cable and its secure attachment

So, everything has arrived, everything has been collected, let's launch and see what problems we face.

Problems


The first unpleasant surprise that awaited us was the restriction on the format of the image via the SDI channel from the camera. As I already mentioned, the camera is the only one in this price segment that can produce HD video through an analog interface. But the fly in the ointment is that the SDI image is broadcast in 1080i format ( here you can read about the differences between 1080i and 1080p ).

The second problem: there is no signal! The fact is that the SDI interface is very sensitive to the frame rate and resolution, so if the camera gives you 1080i and 50 frames per second (the camera canon gives this format), then the server should have exactly 1080i and 50, otherwise You will see a black screen and you will think that the problem is not in the settings.

Even if the settings on the camera and the server are the same, sometimes it may happen that there is no image - it may be in the wires themselves. In this case, you just need to check all contacts and find the weak link. Although the SDI mounts themselves are very reliable and never fall out, the problem may be somewhere in the middle of the cable. We encountered such a problem and by trial and error found and eliminated a weak spot.

Well, if everything works, let's move on.


Studio

How now to write lectures on the server? I want some simple solution. However, the most obvious solution (using the software that comes bundled with the BlackMagic DeckLink capture card) is far from the most convenient.

First of all, the lecturer himself cannot start recording, which means he needs a person who will do it.

Secondly, DeckLink Studio does not allow encoding in real time, which means we will receive uncompressed video = 1 minute about 1 GB ...

Well, the last inconvenience is that it is necessary to open two copies of the application from different users. This is of course solved by writing a bat-script (I remind you: Windows server), but by pressing the recording in two different channels manually, we get 2 unsynchronized files.

Synchronous recording of two video streams


The obvious solution is to use a Mac server and buy a Movie Recorder for $ 1000 per channel. This is exactly what was done by our colleagues in Switzerland. But we decided to go the other way. Of course, there were ideas to implement a custom interface using the DeckLink SDK, but then we got a wonderful device that really helps us to this day. So, meet:

ATEM Television Studio

ATEM Television Studio. In general, the purpose of this card: in real-time encode video from different cameras and allow the operator to switch between them. As usual, the software supplied is not very convenient. However, on the Internet, a ready-made software ( MXLight ) was found which has a command line interface and allows you to record an image from the channel connected to this card.

So, we have a bat-file that can start recording from the camera, and another bat-file that can stop this process:

set name=D:\VIDEO\CPP_Course\Week3\Professor\Step4 set TIMESTAMP=%TIME:~0,2%_%TIME:~3,2%_%TIME:~6,2% if exist %name%.TS ( START D:\VIDEO\MXLight\MXLight.exe record-to-file=%name%_%TIMESTAMP%.TS record=on ) else ( START D:\VIDEO\MXLight\MXLight.exe record-to-file=%name%.TS record=on ) 

It remains to deal with the interface card DeckLink. The solution was found very quickly - ffmpeg for Windows supports DirectShow, and the DeckLink card is nothing more than a DirectShow device.

And voila - here it is a bat-file which starts the screen recording:

 set name=D:\VIDEO\CPP_Course\Week3\ScreenCast\Final_ScreenCast_LAST set EXT=mp4 set TIMESTAMP=%TIME:~0,2%_%TIME:~3,2%_%TIME:~6,2% if exist %name%.%EXT% ( START D:\VIDEO\ffmpeg\bin\ffmpeg.exe -y -video_size 1920x1080 -pixel_format uyvy422 -rtbufsize 702000k -framerate 24 -f dshow -i video="Decklink Video Capture" %name%_%TIMESTAMP%.%EXT% ) else ( START D:\VIDEO\ffmpeg\bin\ffmpeg.exe -y -video_size 1920x1080 -pixel_format uyvy422 -rtbufsize 702000k -framerate 24 -f dshow -i video="Decklink Video Capture" %name%.%EXT% ) 

But with the stop recording screen had to tinker a bit, the fact is that you can not just take and close ffmpeg. In this case, the capture file will be damaged, and may be reproduced with interference. For correct completion of the video capture mode, we need to send a keypressed event "q" from the keyboard.

Thus, you still need a person who starts the recording and stops it correctly.
I really didn't like it, and I decided to raise a simple Node.js server as an experiment, and since I never wrote JS, I would kill two birds with one stone.

This is how the epicStudio application was born, the launch of which is carried out by the lecturer himself from a browser opened on Wacom (Mac mini). Link to Gihtab - epicStudio .

epicStudio

After starting, the teacher begins to tell a lecture and draw on slides. At the end of the lecture, the teacher stops recording himself and can start recording a new topic. At the end of the day I can only download files from the server and glue the lecture.

This process, we also tried to optimize. So, I have written various tools for automatically cutting out unnecessary pieces, overlaying watermark and bringing all videos to the same volume. I think they will be briefly told about them next time, in any case, I post my tools in this repository and you can see them there.

Finally, examples of the resulting video:





UPD: In January 2015, we updated the configuration of our studio - it became more convenient, better and ... cheaper. We will write more details on the post, but if you are urgently interested in the configuration and equipment list, ask at team@stepic.org . We are also building a similar studio in Moscow, which will be open to teachers who host MOOCs on Stepic . So if you would like to record a course with us, please contact us.

UPD2: Continued (April 2015): habrahabr.ru/company/stepic/blog/255053

Source: https://habr.com/ru/post/235867/


All Articles