📜 ⬆️ ⬇️

ACM ICPC Live Webcast: How it works



About championship


ACM ICPC International Olympiad is the largest event among the team student programming competitions in the world. The Olympiad has been held since the 70s (at that time it was more like a competition between US universities), since the late 90s other countries have been actively participating in it. ITMO University in 2015 became the six-time winner of ACM ICPC.

Naturally, interest in the Olympiad is shown not only by the participating universities themselves, but also by thousands of people around the world. And in order for ACM ICPC to be not a “chamber” event for the participants and their coaches, there is an online broadcast of the Olympiad final, which can be watched “live” even after the event (the broadcast of the 2015 final can be viewed here ). We will tell today “first-hand” on behalf of its organizers about how the broadcast is organized, what interesting technical solutions are used in its process.
')

ACM ICPC Broadcast History


For the first time, the online broadcast of the World Cup final was presented in 2009 in Stockholm. From 2009 to 2012, the team of the Sustainable Communications Center of the Royal Institute of Technology (Sweden) was involved in broadcasting. Their specialty was remote video editing, but the shooting and transmission was carried out in the traditional video way: SDI cameras and video editing.



It looked like a studio in 2011

However, ACM ICPC is a programming competition, and besides standard cameras on the site, which provide video for broadcast, a webcam is installed on each computer of the team, which streams the video of the team throughout the competition. In addition, the script launched in the background on the computers of the teams records and similarly transmits the screencast of each command.



Studio in 2012 - work is still being done in the traditional way

Therefore, when the ITMO University team began to answer for the online broadcast of the championship, it was decided to switch from standard video production technologies to more interesting solutions - streaming broadcast on Youtube and twitch, using powerful computers and VLC / ffmpeg for video editing and editing (as opposed to the previously used hardware solutions from Blackmagic).

This decision was made primarily due to the fact that the ACM ICPC finals are held in different countries every year, so the transportation of purchased equipment can be a significant problem for the organizers. In addition, the software for broadcasting can be used in other competitions.

Diagram of the broadcast device: the stage of receiving content


Technology and Hardware

The competition system provides us with a stream of webcams and a screen of all teams that participate in the competition, a feed of parcels from participants (the parcel is a solution to the problem sent for review), including the jury's verdict.

For shooting general views of the hall, two AXIS V5915 network PTZ cameras are used. This camera allows you to shoot video in 1080p resolution and is regulated using a web interface. In order to power the cameras installed in hard-to-reach places, we use PoE-injectors (this is a convenient way to supply power to network devices: a standard power supply is connected to the PoE-injector, the injector itself is connected to the Ethernet cable, and then connect the camera, while the power will be transmitted via Ethernet-cable).





In addition to the above, we use four portable video cameras, the signal from which is transmitted using four Teradek Clip , powered by SWIT batteries (they can work on these batteries during the entire contest).





On the basis of one of the Clip'ov we collected a mobile complex. It is a backpack with batteries, on one of the straps of which with the help of Velcro Clip and GoPro is attached. We plan to wear it on a volunteer who distributes balls to teams.



Balloons are distributed to teams for correctly solved tasks.

ICPC Analytics

The team of analysts is constantly developing its Katalyzer application, which receives not only the parcel log, but also regular backups from the participants' computers. Their analysis allows us to understand what task the team is working on (for example, if the a.cpp file is being actively modified, most likely on task A). In addition, analysts are watching the screens of the leading teams, they know who is in the team in which programming language they write, and they regularly evaluate everything that happens.

Team

The video group employed during the online broadcast consists of ten videographers, who in turn provide us with video from the venue of the championship and flash-zone for live interviews, as well as a recording of the analysis of tasks.



Hall for the championship

The team of analysts usually consists of fifteen people who (besides preparing and recording analyzes) watch interesting events from the autoanalyzer ( AutoAnalyst is an application designed specifically for the ACM ICPC championship, tracking the list of packages, backups of computers and screens of participants) and add interesting news to the event log manually. In addition, analysts prepare in advance for each team and for each participant a profile that we show when presenting the team.



Peking University team. Shot from the championship broadcast

The ICPCLive team consists of fifteen people - director, director, designer, programmers, video editors. If everything goes well, during the competition it remains only to choose which teams' screens to show at what point, add new videos to the schedule and connect the view from the most interesting camera in time.

Optional: media service rollers and video footage

In the online broadcast, we use pre-recorded video. They include the videos of the ICPCNews media service (these videos are further available on their youtube channel), interviews of key people, championship favorites and sponsors. Most of these videos are recorded in advance.

With video of tasks, the situation is different. The conditions of the tasks are an object of increased secrecy, so the recording of video footage begins simultaneously with the start of the competition, when all teams are already reliably isolated from the outside world on the court. Analysts prepare, record and, together with ICPCNews, assemble the analyzes and broadcast them, the director decides when to put them on the air.

Content Processing Phase


Technology and Hardware

Our video stream can be divided into two completely different parts: a picture from the cameras and an infographic that is overlaid on top with the help of a standard chroma key. Let's start with the simplest, namely with the cameras. To control the flow of information from them, the easiest and most reasonable solution for us was the external Wirecast software.

Wirecast turned out to be surprisingly convenient for downloading pre-recorded videos using the API, which we also used to schedule the upcoming videos. At the same time, Wirecast is relatively inexpensive, especially if you compare the cost of software with the payment of contractor services during the broadcast.

The entire infographics for the project is also created in-house, by the team. Java was chosen as the programming language. At the same time, the simplest solution in terms of creating infographics turned out to be the most elegant at the same time - all graphics are drawn on the canvas; widgets are redrawn every 1/25 second. As for the small video blocks in the corner of the screen, for their creation we managed the vlcj library, which is a Java wrapper for the native function call of the vlc player.

The main difficulty in working with a video stream is not in creating one or another of its components, but in managing them. Last year, management was conducted through standard Java forms that reported tcp information to infographics. In the same year we went further and wrote a special http-server that supports changes from several users at the same time and gives all the information (what and how to show) on a tcp computer drawing an infographic.



What it looks like: video plus infographics

After reviewing the existing frameworks for writing Java http servers, we chose Vaadin . Perhaps this solution was not optimal, as in the process of working with the framework, there were occasional problems with the streams and the network. However, in the end we managed to solve them and get a distributed system that allows anyone (with a login and password) to influence the output image.

For those who want to get a similar exotic experience in the future, it makes sense to highlight the small technical difficulties that we encountered:


Split Screen Mode

Last year, as well as in this one, the second screen has two control modes. Initially, as part of last year’s contest, we launched an automatic mode that operates according to the following logic:


During the first hour of the contest, it became clear that this algorithm did not meet the requirements of the audience at all: the majority were not interested in the first 12 teams, while everyone was much more interested in looking at the code, and not watching the work of the teams on the webcam. Therefore, we decided to switch Split Screen to manual mode: we ourselves watched comments on youtube, twitch and twitter, and chose which commands to show.

Therefore, this year this direction has undergone the greatest changes. First, now the viewer always sees two video streams - one from the screen and the other from a webcam; in most cases, the “big” video will contain code.

Secondly, this year we are testing automatic “voting” for a team that will work according to the following algorithm: it tracks twitter messages from # ICPC2016, “pulls out” the first hashtag corresponding to the command on the myicpc website and increases the number of votes for the selected command per unit.



ITMO-2016 University team: Adam Bardashevich, Anton Kovsharov, Andrey Stankevich (coach) and Vladimir Smykalov

When the number of votes for a team reaches 5, it is added to the queue at the show (the command is never added to the queue twice, and if the command is in the queue, then the number of votes for it does not increase). To reduce the automatic tamping of votes, we plan to count only one tweet per user per minute. Third, in addition to user automation, we still plan to show the first 12 teams at some points.

Stage of content output to the network


Since we needed to ensure broadcasting not only to the Internet, but also to the internal network at the competition (out of 1,500 Olympiad participants, only 384 compete, the rest - coaches, guests, organizers - follow the competition), we decided to use the Wowza server as an intermediary which the video stream came from Wirecast, then transmitted to clients. Among other things, it solved the problem of recording video on a disk and made it possible to assemble a commentary studio without too much difficulty.

There will be two commentator studios this year: one for English-language comments, the other for Russian speakers. At the same time, as part of the experiment, we decided to assemble them with the help of various equipment: for the “English” studio we purchased good headsets and an audio console, and the “Russian” studio would be made from the cheapest materials at hand. The main point of the experiment is to check what is really important for ensuring high-quality broadcasting and what is not. In the future we plan to make more localized commentary studios.

For the Wowza server and the two main streams (the main stream with Wirecast and the second with Split Screen) we use MSI GE 62 Apache pro loaded “to the eye”. To each of them we generously added usb 3.0 and HDMI splitters.

From the point of view of the software, both studios will work in the same way: ffmpeg will be launched on them, which takes the video stream from Wowza, adds sound from the microphones and transmits the received video stream with comments back to Wowza. For example, the following is a line that adds audio commentary to a ready stream:

ffmpeg -re -i "rtmp://%ip%:1935/icpclive/main" -f dshow -i audio="Microphone" -filter_complex "[0:a][1:a]amerge,pan=stereo:c0<c0+2*c2:c1<c1+2*c3[out]" -map 0:v -map "[out]" -vcodec copy -acodec aac -ab 100000 -ac 2 -f flv rtmp://%ip%:1935/icpclive/comments/rus 


What had to change


In 2015, when our ICPCLive development team made an online broadcast for the first time, working with mobile cameras and final editing was carried out by the hands of contractors. It turned out that only one additional node between the director and the video editing significantly impairs the quality of the channel. To control the sound in 2015, an application was used on the iMac - as it turned out, clicking the mouse to select the sound channel turned out to be inconvenient and too slow, so this year we use audio controls.

Initially, as HDMI2WiFi transmitters, we did not use Teradek Clip, but their Teradek Vidiu “rechargeable brothers”, but we encountered an interesting feature. When streaming video on a local network, you can use one of many different data transfer protocols. A computer, for example, using the ffmpeg command can “raise” an http stream on itself, which will be available to computers on the local network.

However, it is quite difficult to “shove” into the size of a portable transmitter the capabilities of streaming hosting, therefore, transmitters are often limited to supporting the RTMP protocol, which is designed to transmit the stream to the restrimer.

As a restramer, Wowza used by us is perfectly able to act, but it turned out that the transmission of an RTMP stream through Wowza creates a delay of about ten seconds, which we were not ready to go to, and in addition, two such streams load the monster computer with the Wowza server up to 70% CPU, which did not leave this option no chance of survival.

ICPCLive and New Broadcast Format


Usually the live broadcast of events consists of kilometers of SDI-wires and ready-made hardware solutions that allow you to switch the signal, embed the picture in the picture and mix the sound correctly. This makes online broadcasting services very expensive, virtually accessible only to the units of companies in each country that have the appropriate equipment.

Using Wi-Fi and computers for the entire broadcast chain makes it ultra-portable - we can look at the camera where the wires do not reach, automatically show the most interesting things during the competition, show the screens and webcams of interesting teams to viewers and make special broadcasts for the competition. different languages.

The code for our great project is here .

Have questions? Want to help? Email us at icpc-live-team@googlegroups.com!

On the morning of May 19, connect to the live broadcast of the ACM ICPC 2016 student team championship on programming on ICPCLive , subscribe to youtube and twitch channels (English broadcast here , Russian - here , second screen - here ) - we promise spontaneous inclusions and the most interesting details.

And, of course, support ITMO University!

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


All Articles