DIY BROADCAST : How to build your own Internet TV Channel with Open-Source & other goodies

Here is our scenario : you are the technical director of a web startup, already having proven your talents with your thematic VOD streaming channel – and your boss suddenly thinks you’re a grown enough company to jump on the broadcast wagon and manage your own 24/7 live TV channel, targeting IPTV and multiplatform OTT, with a mix of some live studio shows and mainly pre-recorded programs. And of course readify it for later iTV DTT distribution. Quite an exciting challenge !

But once you passed the wow effect, you just realize that despite his high expectations for the TV channel, your boss has got just a web budget – which is close to 0$ – and of course a tight launch schedule. Therefore, your first duty is to be creative on how to build the platform for the lowest possible cost : that’s why, using your web reflexes, you naturally turn yourself towards the open-source world to achieve this impossible mission. Inexpensive or free closed-source software will eventually fill the gaps (and obviously there are some).

Fortunately, the web attitude has contaminated many industries with its desire to promote interoperability and avoid vendor lock-in with full-IP standard worflows. The BBC has shown the way for a long-time, funding many developments like the Dirac codec for its own needs of tapeless workflows and open-sourcing them quickly afterwards. Other TV channels like SVT from Sweden (with CasparCG) and many independent developers have jumped onboard, and by combining their efforts with your usual web video tools like FFmpeg or other free tools, you can for sure build the target platform.

Apart from this software layer, you’ll just need :
– commodity IT hardware to run all the software
– some inexpensive SDI cards
– the minimalistic general audio/video routing hardware & cables
– a reasonable amount of time to configure and interface all pieces
and of course the right IT/dev skills to bring it all together…

OK, Let’s build it now !

DIY Broadcast Platform

DIY Broadcast Platform

Pre-Production

Celtx interfaceScreenwriting : Celtx
Website : www.celtx.com
Twitter : @celtx
Languages : JS, XUL
Licence : CePL
Platforms : Windows, Linux, Mac
Price : free (desktop app), with addons for $9.99
Commercial equivalents : Adobe Story and many others

Celtx is an all-in-one media pre-production system, allowing you to write scripts for shows and films, to build storyboards and sketch setups, to schedule production and prepare roadbooks for the crew. While the desktop app is free, three addons are available for purchase (Plot view, Full screen mode and Performance tracker). Interestingly, you can also work on the go with their iOS mobile version ($4.99) or use their online service Studio to manage collaborative team work ($4.99 per month up to 5 users), all the desktop and mobile apps datas being synchronized with the Studio service. So their overall offer, while partly open-sourced, is very complete and affordable. What seems to lack here is a real community engagement around the product.

Non-Linear Production

Lightworks interfaceNLE : EditShare Lightworks
Website : www.lightworksbeta.com
Twitter : @ESLightworks
Languages : Probably C/C++
Licence : Unknwown yet
Platforms : Windows, Linux & Mac (planned for Q4 2011)
Price : Core version free, Edu & Pros £20/£40 per year for pro features (Avid DNxHD codec is £36 one-shot)
Commercial equivalents : Final Cut Pro, Avid Media Composer

With Avid Media Composer also released in 1989, Lightworks is one of the veteran NLE systems on the market. In 2009, EditShare acquired it and during the NAB10 they announced their plans for open-sourcing Lightworks. Since that time they have had many request from Linux/Mac users so they decided to port the software to those platfoms before open-sourcing (this is now replanned for Q3 2012). When ported, Lightworks will be the first cross-platform NLE, but for the moment, Lightworks is downloadable as a binary release and works on Windows only.
Lightworks is really playing in first division (The King’s Speech and Martin Scorcese’s Hugo were edited on it) with FCP and Media Composer, as it offers multicam editing, realtime effects in SD/HD/2K, MXF Op1a and OpAtom support, extensive third party integration (like AE, Combustion, Digital Fusion…) and pro codecs support like RED, DNxHD and ProRes. The pro features for which you have to subscribe are the licensable pro codecs, EDL features, shared projects, titling module, hardware I/O support and stereoscopic support.
Supported hardware includes specific Matrox and Blackmagic cards, and more AJA and DVS models coming in 2012. The Q4 2011 roadmap includes AVC intra and MPEG-2 long-gop support, DVD/BR timeline export, XDCAM HD/EX support, support for Tangent Element control surfaces, and Linux/OSX beta releases. In 2012, the main plans apart from open-sourcing are full 64bits support, audio plugins and remote editing with proxy files. All these current and upcoming features, combined to the predictable forthcoming community support after open-sourcing of the software definitely make Lightworks a worthy long-term choice.

Blender interface3D modeling and rendering : Blender
Website : www.blender.org
Twitter : @blender3d
Languages : C/C++ with Python API
Licence : GPL
Platforms : Windows, Linux, Mac, FreeBSD
Price : Free
Commercial equivalents : 3DS Max, Maya

Blender has also a long track-record of production, as it was a ray tracer back in 1989 when owned by Not A Number Technologies. Open-sourced in 2003, Blender is a full-blended 3D authoring environment including modelin, shading, animation, physics & particles, with extensive file format compatibility and support for frameserving and external renderers like Renderman, Poverman or Virtualight.
With its  very mature codebase, extensive API, strong documentation and wide international users community, Blender has managed to place itself as a major actor in 3D production, and thus can be used without any difficulty in a TV workflow.

Blackmagic DaVinci Resolve interfaceColor-correction : DaVinci Resolve Lite
Website : blackmagic-design.com
Twitter : @Blackmagic_News
Languages : unknown
Licence : Commercial with features restrictions
Platforms : Mac
Price : Free (pro version is $995)
Commercial equivalents : DaVinci Resolve, Autodesk Lustre

This one is not an open-source tool, but it can enter the goodies category. After having purchased Da Vinci Systems in 2009, Blackmagic Design started providing a free version of Resolve that you can use for color-correction in production with some features limitations. Resolve is the result of 25 years of color-correction and it includes many useful features like multipe video tracks conforming, color-grading by curve/RGB mixer/HDRX, RT noise reduction, image stabilizer, OpenCL/CUDA support, FCP integration, AVID MXF compatibility and extensive format support.
The limitations of the lite version of the software are that you can work on HD max (that shouldn’t be a problem in our context), that you can have a maximum of two color correction nodes, only a single GPU and RED socket. Other features are disabled too : 3D workflow, noise reduction, power mastering (multiple resolution deliverables from a single master session), remote grading and external database.
So here you got a free solution which allows some simple color-correction operations on a Mac – this can be enough for simple video production workflows as we imagine them in the present case. Even if you upgrade to the Resolve pro, the main source of expense won’t be the software but rather the dedicated equipments like the control panels that you must use to be really productive in grading.

Live Production

Ingex Studio backuped deploymentMulticam ingest : Ingex Studio
Website : ingex.sourceforge.net
Twitter : @ingextv
Languages : C/C++, Perl
Licence : GPL
Platforms : Linux
Price : Free
Commercial equivalents : EditShare Flow Ingest, ToolsOnAir Just:In, Avid AirSpeed Multi Stream

Built on top of FFmpeg, the Ingex Studio application suite from the BBC is designed to build low-cost flexible tapeless recording workflows. It can handle 4 SD or 2 HD SDI feeds and outputs MXF OP-Atom with various video essences (DNxHD, DVCPro-HD, IMX, DV50…) while creating video proxies in real-time. The default application has been built for DVS Centaurus II SD/HD SDI cards but it can easily changed in the code to support your Blackmagic or AJA cards if needed.
Ingex Studio uses CORBA for communication between modules and the recorders can remotely controlled through the network. After capture, the video segments can be exported directly to Avid AAF or Final Cut XML through a web interface which also allows search features on the recorders’ assets pool. The player can be used in Director’s Cut mode to record the final live program and you can even multicast any of the captured streams during the live session.
Ingex Studio can be configured in various operation modes and is well documented – definitely a very flexible and powerful platform for multicam recording.

Telekast interfacePrompter : Telekast
Website : telekast.sourceforge.net
Languages : JS, XUL
Licence : GPL, MPL 1.1
Platforms : Windows, Linux
Price : Free
Commercial equivalents : Promptdog, uPrompt2

Telekast is a simple script editor and teleprompter based on the Mozilla Framework. Doing the job, but not more.
It’s good for simple setups, obviously very light for shows with complex sequences structure.
You can also check Teleprompter Freeware – not open source but free.

OpenPlayout interfaceVision mixer : OpenPlayout
Website : sourceforge.net/projects/openplayout/
Languages : C++
Licence : unknwown
Platforms : Linux
Price : Free
Commercial equivalents : CutFourHD, VidBlaster

Very few (if none) informations are available on OpenPlayout’s website. Browsing the code, we can see that it’s based on GStreamer – it handles live switching between two inputs with a crossfade. It’s compatible with GStreamer v4l2src plugin so it should work when used with the Blackmagic DeckLink GStreamer Plugin and a DeckLink card, as well as with the DVEO HD-SDI QuadPort H/i card thanks to David Schleef’s work. Let’s point out here that DVEO cards drivers are open source (a very rare and precious exception in the broadcast equipment world – kudos to them !) and that their API allows low level access to the hardware, including SDI clocking and raw VANC and HANC data.
There are other open-source alternatives for vision mixing : use CasparCG (see HowTo here) with a DeckLink Quad card or the old open-sourced VideoToaster code if you still find a card compatible with it…

CasparCG flow chartLive Graphics : CasparCG
Website : www.casparcg.com
Twitter : @CasparCG
Languages : C++
Licence : GPL
Platforms : Windows
Price : Free
Commercial equivalents : Vidigo Graphics

Built over FFmpeg, CasparCG is developed by a team from the Swedish Broadcasting Corporation (“SVT”) where it is in use 24/7 for national broadcast in six TV channels (40 graphic servers). It handles the layering of video (live input and file-based like QUicktime, MPEG-2, AVI, DNxHD and all MPEG-4/H.264 flavours), dynamic graphics (developed in Flash, and linkable to any dynamic data source) and images with fine-grain control on each layer (playback, loop, transparency, position etc) and mix them with GPU-accelerated DVEs. CasparCG provides ActionScript classes for Flash templating, and Advanced Media Control Protocol (AMCP) is the main communication protocol used to control and query CasparCG Server 2.0. Their client software (demo included in AIR) listens for P-BUS commands from vision mixer and then executes the client macros – thus allowing complex interaction scenarios between cameras switching and visual behaviors. The system support several BlueFish cards for output but only DeckLink cards for input, and one only – nothing rude here as you can use the 4 channels DeckLink Quad (and even use CasparCG to replace a hardware vision mixer, as we’ve seen in the previous section).
The project is well documented and has many tutorials for the various software components – and the developers’ team is very reactive. It definitely sounds as a very high-grade solution and a good architecture choice.

Asset Management

Backblaze architectureArchive Storage : Backblaze
Website : blog.backblaze.com version 2 version 1
Twitter : @backblaze
OS : 64-bit Debian 4 Linux
Licence : unknown
Platforms : Linux
Price : Free
Commercial equivalents : Many storage systems…

Backblaze is a company providing backup service who opened source its storage pod design two years ago. While it’s primarily aimed at building cloud storage facilities, it can also fit our goals with some adjustments – but certainly not for on-linear systems working in uncompressed HD in real-time. Anyway, this design seems OK at least for archiving purposes, which is already a very good thing as using DLT for archiving needs expensive robots to be achieved. The 2nd generation storage pod designed by Backblaze costs $7.384 for 135 terabytes, it runs twice as fast as the first generation design, costs $500 less for double capacity. The pods are running on Linux with JFS filesystem and the RAID-6 volumes are accessed through HTTPS (Tomcat), each pod having its own IP. In their view NFS doesn’t scale well but it would be a necessary protocol to support for the archiving use case (as well as CIFS). Anyway, their design is already a very good starting point for those who master the software part that runs on top of it !

DAM : EnterMedia
Website : entermediadb.org
Twitter : @EnterMedia_DAM
Languages : Java
Licence : LGPL v3
Platforms : Linux, Windows, OS X, Solaris
Price : variable

Entermedia is a digital asset management that allows to organize, track and share video (and other  audio, images and text-based documents) assets through an online platform. It provides advanced metadata management and search through the assets catalogs. All the data is stored in XML, thus avoiding by default the need for complex systems to maintain – it can also be plugged to MySQL or SQL Server if you wish so. It integrates FFmpeg, LAME and ImageMagick for all video, audio and image conversion tasks. It’s also integrated with Drupal, WordPress and Joomla.
If you are more on the PHP side of things, you can check Kaltura Community Edition which provides the backend stuff and an impressive range of frontend APIs. An if you wish to have more control on your final platform, you can take a look at MediaMosa which is based on Drupal and provides a SOA approach via a full REST integration, as well as the usual FFmpeg integration. You can also find many more open source DAMs on this page : so much choice – but not all are suitable for video management…

Tape Archiving : Ingex Archive
Inside BBC’s Ingex software suite, we can find Archive, an ingest system designed for video tape archive preservation. Video tape is played back from a VTR, ingested over SDI, and stored as an MXF OP-1a file, including all audio channels, VITC and LTC timecodes and archive database metadata. Features include VTR-control, D-3 tape error recording, PSE analysis and MPEG-2 browse generation. This can be of good use if you have an important stock of tapes (D3, Digital Beta) to digitize with QC insurance. It includes output to LTO-3 tapes and H.264 proxy generation (quite useful for online scrubbing through the archives stock).

Playout Automation

Final Playout : MLT
Website : www.mltframework.org
Languages : C
Licence : LGPL (GPL for Melted server)
Platforms : Linux, BSD, OS X, Windows
Price : free
Commercial equivalents : FORK Playout Xpress , MasterPlay OnAir , Ninsight BB-TV

MLT aka Media Lovin’ Toolkit is a 7 years old project, sponsored by Indian company Ushodaya Enterprises (who operates a studio complex that offers production and post production facilities, and services for film makers). MLT is a multimedia framework designed for television broadcasting. As such, it provides a pluggable architecture for the inclusion of new audio/video  sources, filters, transitions and playback devices. It allows you to build services for authoring and manipulating playlists and multiple tracks, on which you can apply the supported effects and filters. MLT provides bindings for C++/C#/Java/Lua/Perl/PHP/Python/Ruby and TCL : rather complete ! On the multimedia level, it integrates many libraries, among which we find FFmpeg, Jack audio routing, of swfdec (Flash decoder) – and integrates image and text rendering. Provided effects include advanced features like motion-tracking and alpha-compositing. Developing on the platform goes through an XML authoring schema, a client/server protocol (MVCP) and an API for playout scheduling. Melted is the included multi-unit video playout server with realtime effects serving as reference application for the toolkit (beware, it’s all cmdline based). Live IP streaming output is supported through FFmpeg, and MLT supports libavformat’s protocols to read network streams such as multicast MPEG2-TS/UDP, RTP, RTMP, RTSP, MMS, and HTTP Live Streaming. As regards supported SDI devices, Blackmagic cards are supported with MLT Decklink module for input/output, and Linsys/DVEO cards are supported for output with MLT SDI module.  It also lets you read various formats such as DV, HDV, and TS over pipes. So it seems that with some coding efforts, we can handle really complex playout scenarios thanks to MLT.

Graphics : CasparCG
As we have seen previously, CasparCG can be used for live production with camera switching and manual triggering (via GUI remote control app) of Flash animations and Images/Text display as overlays on top of video. But thanks to its extensive automation protocol Advanced Media Control Protocol (AMCP), CasparCG can be used in headless mode to provide fully automated graphics playout for the TV channel. This is what SVT does for its channels with 40 CasparCG servers running 24/7 in automation mode. If SVT does, why not us ?

Workflow : Kamaelia
Website : www.kamaelia.org
Languages : Python
Licence : Apache Software Licence
Platforms : all Python compatible ones
Price : free

Kamaelia is a Python library by BBC Research for concurrent programming using a simple pattern of components that send and receive data from each other. Axon is the root framework of Kamaelia, managing the components concurrency. On top of this core, Kamaelia provides an extensive range of libraries for managing automation mechanisms, audio manipulation, codec work, DVB tables and streams management, integrates many internet or video streaming protocols (unicast or multicast), alongside many utils and visualisation libs to build your perfect workflow system. Nothing is packaged as a ready-to-go product, but that’s OK for you as you – Pyhton master – like to build custom systems with powerful libraries !

Head-End

IPTV Encoding : Open Broadcast Encoder
Website : code.google.com/p/open-broadcast-encoder/
Twitter : @obencoder
Languages : C
Licence : GPL
Platforms : Linux
Price : Free

Lead by Kieran Kunhya, a developer from the x264 project, Open Broadcast Encoder has the ambition to free broadcasters from the vendors’ inertia and provide x264 state of the art video encoding features combined to other great libraries such as libmpegts and FFmpeg. So the Realtime version of OBE (there is also a special version for VOD encoding) provides 8/10 bits AVC encoding or MPEG-2 (with s262) and soon VP8 (with xvp8), multiformat audio encoding (MP2/AC3/AAC/Dolby-E), and is compatible with DeckLink/Linsys/Dektec cards for SD/HD SDI input. Inputs can also be one of the various IP possibilities like UDP, UDP/RTP unicast and multicast, RTSP or RTMP. It can also be DVB-ASI/T/C/S with the corresponding cards.  As regards transport capabilities, OBE can stream in UDP/RTP unicast and multicast, and soon DVB-ASI (with extra Dektec or Linsys card). Statmux pools for MP2/H.264 are currently in development and the system already provides a SNMP control interface.
While it has a cmdline-only interface for the moment, the API will provide a convenient way of building web frontends when it will be released. OBE can safely go in production right now only for SD encoding, because HD still requires some minor work, mainly on the x264 side of it. To accelerate, OBE needs to widen its developer base after the initial commitment of two broadcasters alongside Kieran’s efforts. Anyway, it’s a great project that has to be closely monitored, as it will finally provide all the features of very expensive encoders on the market.

Multiplexing/HbbTV : OpenCaster
Website : www.avalpa.com
Languages : Python
Licence : GPL
Platforms : Linux
Price : Free
Commercial equivalents : httvStream HbbTV, Icareus Playout, MIT-xperts iMux Multiplexer

OpenCaster is a 3 years old product (since version 1.0), developped by Italian company Avalpa who offers a packaged product (hardware+software, additional web GUIs) built around OpenCaster. It’s a transport stream data generator & packet manipulator which can (re)multiplex transport streams in multicast and include data carousels in it. OpenCaster can output carousels using different iTV standards : Ginga, MHP, MHEG, OTA and of course HbbTV – and it support the most interesting feature of carousels, the real-time event insertion (aka do-it-now events in HbbTV). As regards the muxing capacities, it supports MPEG-2 and H.264 video streams and DTS or AC3 5.1 audio streams – and allows many kinds of clock manipulations on PCR, PTS and DTS timestamps. Apart from playing PSI/SI/SIT tables and data carousels, OpenCaster can also playout local A/V files with supported media essences. It therefore allows basic playout features, maybe useful to switch to fallback files in case your TS stream is broken on the encoder side. Pure failover between two TS encoders could also be achieved in a similar way. Dektec DVB in/out cards are fully supported. It’s definitely a great product for prototyping your service freely – but a more featured version may be required to go in production on large scale.

OTT : two different software combos…

Our scenario here is to stream for PC, smartphones/tablets and all other devices supporting HTTP ABR H.264 streaming. This means supporting Adobe Flash HDS, Apple HLS and Microsoft Smooth Streaming. Here the difficulty is that there is no free HTTP Origin/repackaging Server on the market, and obiously no free encoder supporting all the output packaging types. Hence we must investigate several closed-source, non-free options (apart from Open Broadcast Encoder and Nginx) which exact features I’ll let you discover on their respective websites or in my previous posts about encoders and repackagers.

That’s why we here propose two different approaches of doing the job, depending on which level in the platform we decide to produce the bitrate variations needed for the ABR streaming features :

* option 1 :    all encoding are done on the encoder, the server just does the repackaging
Encoder : Expression Encoder 4 Pro with CUDA acceleration
Origin Server/repackager : Nginx with Codeshop Unified Streaming Platform

* option 2 : the encoder produces just the highest stream bitrate (for example the 720p), and the server produces the sub-bitrates and repackages for the different outputs
Encoder : Open Broadcast Encoder
Origin Server/repackager : Wowza Media server 3 with CUDA (Linux) or QuickSync (Windows) hardware acceleration

While option 1 might appear safer as we are used to produce encoding variants upstream in the production chain, it might in fact be more risky as Expression Encoder requires huge resources and is famous for its instability. Adding a CUDA card is a feature available in the pro version and it indeed can provide the necessary power to transrate and resize variants of the highest stream – but here we miss a few field feedbacks to evaluate the stability of such a solution. Codeshop supports BuyDRM for live PlayReady protection.

Apart from being more affordable (1000$ instead of 1500$), option 2 brings a possible WebM output through Wowza’s new software transcoding module, greater DRM choice and cross-platform support with Wowza integration of PlayReady AND Verimatrix, and also an extensive API which allows you to build many complex scenarios on your origin server. Using the Windows version is recommended as QuickSync provides much more horsepower than CUDA. Linux drivers for QuickSync should be released by Intel before end of 2011 , so be patient !

Goodies

Before closing this already too long panorama of great software and frameworks, I’d like to point out some other very useful tools that you could integrate for very specific needs inside your workflow :

MP4Box : this tool is the reference multiplexer for MP4 and 3GP container formats, it can add, remove, multiplex audio, video and subtitles in different formats.
FFmpeg/FFmbc : while FFmpeg is the ever-shining star component and basis for many tools presented here and can be integrated for very custom workflows, its variant FFmbc (FFMedia Broadcast) flies under the radar but nevertheless is of great help for manipulating and muxing broadcast codecs like IMX/D-10, AVCHD, AVCIntra, DVCPROHD, MXF, DNxHD or XDCAM.
slowmoVideo : this tool speaks for itself, creation slow-motion videos from your footage if its format is supported by FFmpeg.
Shotcut : a cross-platform video editor, based on the MLT framework – an alternative to Lightworks

The Missing Parts

Yes of course, we can build many parts of a TV channel with open source or free software. But as we have seen with OTT distribution, some features zones are not (entirely) covered by OSS. This is the same case for FX, Virtual Sets, NewsRoom, Traffic Systems and DRM (at least before Widevine goes free). If you know some open source / free products in these categories, please point them out in comments to this article, I’m sure this will be useful to many of us in the community, as well as your field feedback of developments and integration of these technologies. And I also wanted to report an interesting URL to follow after this article : Open Source Video website.

Okay, I hope that this article was a good bootstraper for your upcoming TV channel and that, apart from the code back-contributions that you shall do in some cases, you will donate a part of the money you will have saved to the great open source projects listed (or not) on this page !