Could I Run a TV Station on Linux?
JesusQuintana asks: "I'm working with a low-power television station to update their playback system. Currently they're using tape and I've been tasked to move them to computerized playback (MPEG-2, etc.) There are proprietary solutions (very expensive) and there are companies that bundle software with Windows and standard x86 hardware. Overall, they are generally unimpressive and won't sell the software without bundling it with their own hardware. (They won't let us buy our own storage.) We have the expertise to build our own infrastructure (NAS, redundancy, etc.), but really just need the equivalent of iTunes for high quality video. There are lots of other pieces needed to complete the work-flow (such as encoding the media), which could be accomplished on Mac or Windows or even Linux. But what about playback? We need something that will play back these files at their scheduled times (perhaps scheduling cron jobs to change playlists) to broadcast quality hardware (SDI or YUV video). Could we run a TV station on Linux?"
Mplayer should be able to do the job.
I think you are Looking for the Video Lan project, specifically the VLC player:
VLC
It wouldn't even be all that complex.
MySQL database that indexes all content.
Also have a table for the schedule.
Batch job queues up content. As one piece of content finishes, next piece is queued up and plays.
All of this can be made fairly redundant without too much effort. Setting up your schedule can be point & click.
The real work will be if you want to make it fancier to give the advertising department more direct control over what ads run when, as opposed to having the programming manager schedule all of that.
All of this can pretty easily give you a very detailed automated log of what content played when, when you gave your station ID's, what ads played, etc.
Pick one good well known scripting language, learn it well, and use it. I'm not going to enter the holy war of telling you which one to use.
MySQL can be replaced with PostgreSQL if you prefer. Doesn't matter which. You're not keeping your content in the database, just an index of where to find the content on the filesystem plus the broadcast schedule.
The REAL work in all of this is making it resilient so you don't hit dead air. Redundant systems with automated failover, etc. And the cost of entry may be high, but I can't recommend highly enough that your content be stored on a redundant SAN or NAS infrastructure. Most of my long nights repairing things have dealt with failed hard disks. A decent SAN or NAS will allow you to rest easily at night.
Additionally a system like this will allow you to have a much more intelligent content-rich web site.
And I'm also sure there are people at Google who would love to talk to you about your ad delivery system if you put something like this in place. You would like to increase your ad revenue, wouldn't you? Google is working on breaking into this space in a big way. It would be worth making a few calls.
Most all of the compositing, editing, and formatting software is for windows. For some very limited sorts of things, you could probably roll your own, but it would take a lot of development time, and probably be hard to use.
/
However, you should check out Apple's final cut pro. I've seen it used for small-medium sized TV stations, and it's not too hard to use. I like it.
http://www.apple.com/finalcutstudio/
http://www.apple.com/uk/pro/profiles/tourdefrance
Hmmm I have a number of Linux servers here that would disagree with you.
I see my ftp server has served up 14TB so far this month without a hiccup, and it's using ext3.
I don't blame you for posting anonymously. It's hard to post something like that in a way that people can hold your name accountable.
NO, MythTV is way overkill for something like this. He just needs a video player, possibly with a dynamic playlist.
Talk to the folks over at VideoLAN. The software is very robust and runs on any OS. Check the fora or get on the streaming mailing list.
The closer you are to the code, the happier you are. - Ancient Geek Proverb
I worked on a high-def digital cinema preshow playback system based on Linux. It is currently running in over 400 cinemas. Of course it would take work to find and glue them together. You would also need TV compatible video output with Linux drivers.
Fight Spammers!
If you're running off remote disks, then the NAS MUST be capable of greater output than is required to transmit, as you absolutely must allow for dropped packets and other glitches that force a retransmit. If there's not enough time to fix the problem, then you're going to transmit a picture with noise.
ALWAYS work ahead and cache pre-processed frames. There should be enough processed frames (encoded, digested and all ready to blast to the mast) that in the event of a failover (you DO have failover, don't you?
Your NAS should use a striped RAID array (although each stripe may also be mirrored). Striping is essential in keeping the data flowing fast, and your hardware should be geared to maximizing that throughput. Let the realtime handle the scheduling.
Don't bother using cron, or some other such userland service to start things. Exploit the FIFO queue. It won't run the next thing in the queue until the previous thing is finished. So long as you guarantee the stop time, you implicitly guarantee the next start time. You can then use cron to kill programs that overrun.
It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
In a way you are asking two different questions here, due to the technical difficulties involved with a TV station playback. So, lets put it this way then:
Do you require Frame Accurate playback? The reason that the profesional solutions you briefly mentioned are expensive and require their own storage are that they Garuntee frame accurate playback, no droped frames and everything else needed to playback everything flawlessly. One thing to remember about that, though. So long as you only keep the current days video on the server, you can stick with a video server with under 1/4 terrabyte of storage space (12Mbps vid+aud=~128GB) and have a seperate NAS for the next days video that just gets moved onto the video server throughout the day as what has already been played gets deleted.
The main problem with most consumer video playback I have seen is that it is not frame accurate. Even on a decent computer, most video programs don't run at exactly the framerate of the video using consumer playback programs. Also, unlike the profesional hardware, the consumer programs don't pre-buffer the next file for playback so that there is a delay between the end of one file and the beginning of the next.
We're also going to need to know what kind of outputs you want. Analog? What kind? SDI? HD-SDI What does your video router handle? Theoretically you could use a VGA/DVI output to a VGA/DVI-SDI adapter, if that's what you use. You'd also need to run it through a frame sync, but that's pretty standard for most stations anyway. Most likely you will not want to use the video card ouput of a PC, VGA/DVI/S-Video due to the need for then having a consumer program play it out.
For proffesional level playout you're going to want a card with hardware playback. SkyMicro and ViewCast make some playback cards that will run under linux that it looks like you could use. I'm just listing them as an example that showed up after a quick googling. These capture/playback cards are essentially going to become the heart of your system if you want something resembling a cheap profesional system.
So, as I said. It depends on how high end a system you want. However, it looks like it is possible to get a decent one going. One thing to remember, and I state it as habit, trial test whatever cards you are looking at before buying. Some of these cards can run to $2000 a piece and you're probably going to want redundancy.
Fly me to the moon Let me sing among those stars Let me see what spring is like On jupiter and mars
If you don't mind a Windows based solution, seriously consider Newtek's VideoToaster. It's up to version 4 and is a full broadcast tv station in a box. No HD yet though. It'll do everything you need.
If you want to do it for real, take a look at the MLT project: http://mlt.sourceforge.net/
That has support for for example the Bluefish444 SDI cards, and do playout of real broadcast formats, such as DVCPRO, but also regular MPEG formats.
It also provides ShotCut, a really competent Non-linear editor, that can send edited clips directly to playout.
I know it is in use in one of Indias largest broadcasters, and they transmit to millions of viewers. So it would definitely be good enough for a small station like the one you are talking about.
Noone but Gentoo buffs loads a new kernel ever 2 weeks. ...and yes, those reboots were usually either kernels or hardware re-locations.
My webservers when I ran them for an ISP didn't get a reboot, let alone a new kernel install for 6-12 months at a time.
See http://www.princetonservergroup.com/ Princeton Server Group
Or just buy one of these. He can do his MPEG decoding in linux, output to either DVI or VGA, and use a broadcast quality scan converter like the Magni to pump out a clean NTSC signal. In YUV if he wants.
1984 was supposed to be a warning, not an instruction manual.
"You can't do that. Broadcast television is interlaced. VGA is progressive. Never the twain shall meet."
Oh, I wouldn't say that.
BTW DVD players do an internal conversion to interlaced.
The whole "accidentally switching over with your mouse" thing is a real problem that needs to be directly addressed.
This is what you need:
*) At least one seperate video card monitor output per video channel (Matrox Gxxx, NVidia MVS 440)
*) A decent scan-line converter to convert and interlace the VGA into NTSC (one per sim. channel)
*) Ideally, a programmable, matrixed video switch.
With a decent 3U server you can stuff in a few PCI or PCIe cards and handle 4-7 channels simultaneously on one box without framedrops.
You're going to need to fiddle with your X configuration until you (at least) have a seperate screen per monitor. Disable your core pointer and input handling on the non-console X servers. Make sure to set the vertical frequency to 59.94 Hz so that you don't get flicker or tearing. Set the backdrop of each screen using xsri/xsetroot to an image to the effect of "Technical Difficulties, Please Wait" in case a playback program crashes or fails to launch.
Then what you do is manually launch fullscreen versions of (mplayer, vlc, whatever) in response to program events on an 'open' screen. Then you switch the matrix so that the VGA channel you just started a new video stream on, and send that to the scan-converter (and the rest of the broadcast stack).
You could (automatically, manually) script of all of this. I could imagine a cron job that wakes up at 15 second intervals to parse a configuration file that sort of encodes the days schedule -- starttimes, running times, intro padding time, which output channel to direct the matrix switch to, filenames or pointers to directories containing ad segments of various lengths, whatever.
You purposefully allow playback overlap, at which point the script would just allocate a new video channel to run the new video in, and issue a matrix switch so the video looks like it just cuts from one segment to the next at the appropriate time. When the running time is reached (or the player exits at the end of playback), it "reclaims" the channel so new videos can be run there.
You can manually assign input and output channel numbers instead of worrying about having the script keep track (or get the schedule entry app to do it for you).
THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
hollywood+ mpeg playback card.
Bingo... NTSC broadcast quality.
dont believe me? most of the weather channel boxes and TV guide boxed in CATV headends as well as the locall access channels used to use them and many still do.
linux compatable and works great. problem is that you haveto begin and end EVERY video clip with 1 frame of black or you get wierd artifacting.
using mplayer with it and you can do even more.
Hardest part is to generate a system to insert ad's and do the verification of playback for billing affidavits.. There is a reason that most TV and catv stations use seachange gear+ software for ad insertion.
Do not look at laser with remaining good eye.
To go one step further - of course you can - If your in the industery, you've probably heard of Avid. Guess what platform their servers run on (at least their iNews platform - not sure of their editing suite)
/ends of shows/ starts of feeds that have to run at a particular time - and I mean NOW (you might get away with a couple of frames of black/over, but it is sub second, the commercial systems will time to the frame, or even 1/2 frame)
No love of their backtimer (understatement), and they have a very limited api that they are willing to publish
for those lurking:
Your BIG issues are going to be "Hard Hits" (particularly if you are an affliate)
Hard Hits are the timing of commercials
Other issues will be things like getting video cards that support sync pulse (assuming NTSC signals)
Really comes down to - how good a signal do you want to put on the air, and how fancy does your low power station need to be? Let's face it, if your one of the big 3 networks and your worried about "broadcast quality" and "HD quality", down to the frame accurate level, with data going out in the VBI, your playing a different game than a small stand alone station
You pay your money, you take your choice...
(and yeah, I've worked on near broadcast quality encoding systems - but not playback, and have written code to interface with 2 different "newsroom systems")
-- 73 de KG2V For the Children - RKBA! "You are what you do when it counts" - the Masso