Tuesday, June 10, 2008

Obscure Linux Tutorials : Red5 Ubuntu Wii FLV Server

Welcome to Obscure Linux Tutorials, a new article series I'll hopefully actually write about at a reasonable pace. I'm writing these articles because in Linux, you have a solid chance of comming across an "edge case"; a situation where you're stuck on a problem that unfortunately, most people aren't having. As such, you end up frantically looking for a solution that doesn't seem to exist, and after hours of working your fingers to the bone trying to fix your issue, you get your solution, and unfortunately, you're too tired by then to bother writing up any documentation for the next guy who come across this problem. I'm trying to break that chain as best I can.

In this edition of OLT, I cover how to create a Red5 server on your Ubuntu box in order to properly stream flash video to your Wii. (or your PS3, PSP, pretty much anything that can view Flash videos). You don't need Ubuntu, any Debian distro will do. In fact, if you can get Apache and Java6 JDK up and running, any Linux distro should cut it.

Let me explain why I needed this working :
- I have MythTV recording my shows and converting them to FLV (Flash Video, the stuff they use on Youtube) for web streaming automatically.
- The Wii can't cache videos, so I needed a real FLV server if I wanted the Wii watching the vids.
- There are only two FLV servers in existence. One of them costs a foo-ton of money, the other one is a pain to install.

Unfortunately, as I don't have the $4500 lying about for option A, I had to take option B, which doesn't seem all that easy to get working for an beginner. Hence this guide.

Warning : All of this mess is a lot easier to get up and running in Windows. Red Kawa has a program that does it all, made especially for the Wii, I believe. I had to take this route (using server-class software) because the only computer in my house with rock-solid stability is the workhorse linux box that is also our printserver, public 'net terminal, and personal video recorder. Getting Windows to do all that with the kind of stability the computer requires was nigh-impossible, so I had to install a Red5 to get MythTV's generated FLV files playing properly on the Wii/PSP/etc. Who knows, maybe this'll also make it easy for the iPhone to play back the streams in the future (it'll probably need some sort of rss/rtmp mechanism tho)?

Installing Red5



Download and install this deb file. If you require a simple terminal method, or aren't even reading the between-terminal code guides, might I suggest :


cd ~/bin/temp
wget -c http://dl.fancycode.com/red5/debian/0.6.2/red5_0.6.2-1_all.deb
sudo gdebi-gtk red5_0.6.2-1_all.deb

Keep in mind that Gdebi might stall at a Java installation. If it does, just click the terminal and hit the spacebar or enter key to continue. If you're not using Ubuntu, find your package here.


Adding your flash video streams



You're pretty much ready at this point. All you need to do is have it point properly to your FLV files and the RMTP links in your flash player should work. Now, I tried wrapping my head around Red5's tutorial for this, but I'm going to level with you. I have zero clue how to make a new folder for the FLV files that Red5 will properly distribute. As such, my solution revolves around the rather dirty hack of simlinking that folder to where your FLV files actually are. As such :


cd /usr/lib/red5/webapps/oflaDemo/
mv streams backup_streams
sudo ln -s /path/to/your/FLV/ streams


So for example, assuming your FLV files match the filenames of your videos, a recording RTMP link will be something like this :

rtmp://localhost/oflaDemo/1054_20080610085700.mpg.flv

You probably don't even need the .flv in most cases, btw.

At this point, you can use any RTMP-supporting flash video player swf file to show your videos, or even roll out your own. Assuming that you have zero clue as to how to do that, might I suggest the JW player?

Install Apache


If you're running mythweb, which you most likely are, you probably won't need this step. But, just in case, this part's easy :

sudo apt-get install apache2


Now you'll have a webserver running at : http://localhost/
Whatever you see in there is located in : /var/www/

Install and configure the JW FLV Media Player


1. First, download the player from the site. If you're using Firefox, it's going to save to the desktop. Either way, for simplicity's sake, save it there. The next set of directions will move it back to ~/bin/temp

2. Move it to temp, extract it, move to your webserver (this keeps a copy of the archive in temp just in case). At this point, the commands will download 7z just in case you don't have it. It's a helpful app, unzips practically anything.


mv ~/Desktop/mediaplayer-3-16.zip ~/bin/temp/
cd ~/bin/temp/
sudo apt-get install p7zip-full
7z x mediaplayer-3-16.zip
sudo mv mediaplayer-3-16 /var/www/mediaplayerjw


3. Make an html file in your /var/www/ folder called "testflv.html".

sudo gedit /var/www/testflv.html


4. Paste the following into it :

Get the Flash Player to watch this.







Now go to http://localhost/testflv.html and click the play button on the player. You should be watching the Transformers trailer any moment now. Congrats, your RTMP server now works, and is incredibly Wii-friendly. All you need to do if you want this to work outside of your local machine is sign up for a DDNS account, and once that works, forward port 1935 to the Red5 server computer's address on your router. Then just swap out localhost in the html to whatever your website's address is.

Wednesday, July 18, 2007

This week's idiot corner : Control Schemes, part I

Warning : The following is an Anger Rant(tm), and as such, it contains a variety of colorful language. I really doubt you have your kids reading some random bloke's blog, but if you do, turn them away this week.





The picture above is a very special thing. Obviously, it's a badly modelled controller, sketched up for the sole purpose of providing a quick example. You'll note that it essentially looks like those crappy PC game pads you find at your local computer retailer for like ten bucks. Maybe they have a few more buttons, or a thumbstick or two, possibly even a jog dial, but this is essentially the lowest common denominator as far as controllers are concerned. And that's why I used a mash-up of shapes rather than snatch a photo of Game-o-tek's Fighter Pad PC Duel Pro.

This is, essentially, the every-pad. It's the standard button arrangement we've had since like 1991, when the SNES came out. It's essentially the control scheme you can count on, because it exists, in some way, shape, or form, on every controller since then. At least every controller worth a damn, especially AFTER the 16-bit generation. It's been on every major console since. To clarify my point, let me list off, in most-recent order, which consoles support a game that uses every one of those buttons.

Playstation 3
Xbox 360
Playstation Portable
Nintendo DS
Xbox
Gamecube
Playstation 2

With the exception of the Xbox, each of these consoles are currently actively developed for. Meaning that if your game's design is limited to less than these six buttons, you can use the exact same control scheme on every console currently being purchased.

Most Japanese titles, arcade derived titles (not counting light gun shooters, vehicle games, and music titles), and pretty much every genre that doesn't have its roots on the PC, work fine under six buttons. And for pure home titles, context-sensitivity (where a game lets a button perform different actions based upon the situation at hand) lets you do a LOT with a few buttons. Heck, most games work fine with the four face buttons. And with that, the issue at hand.

Dear game companies : Stop changing your goddamn control schemes.

What am I talking about? Try playing a fighting game with more than two people in the room. Try playing Lumines with some friends. If you're lucky, you won't come across any problems. If not, this is what happens.

Player A started playing the Game X series at part II. Player B started playing it when part III came out. They both had that game for months, and the control scheme became second nature. However, regardless of the fact that Game X only has 3 or 4 major action buttons, Company X saw fit to change the face button arrangement from part II in part III. This usually happens because they were releasing it on a different console.



Now, both of these consoles have the exact same face button arrangement: The four face buttons arranged in a cross that you saw in the pic above. However, Company X still saw fit to change these buttons for, what I like to call, "no good goddamn reason". Now, a funny thing about the human condition: one of the major safety mechanisms in the human brain is to revert to old behavioral paterns when panic sets in. This is what caused a series of pilots to eject themselves from their plane for seemingly no reason. While nowhere near as dangerous a scenario, nothing's more annoying in a video game than a panicky situation (which happens in just about every game, from Tetris to Halo) on a different control scheme. What happens? Someone starts shooting at you from a vantage point you can't immediately see, and as your health beings to dwindle, you immediately stare at the ground instead of moving out of the way or looking up because your thumbsticks aren't set up right. Or you wildly turn a fast dropping puzzle piece because the buttons turn it in the opposite direction you're used to, they're dropping fast, and you drop the piece in a way that pretty much ends your game. Or you walk up to a pit and Mario throws a fireball and falls to his death instead of jumping over it. And assuming you spend the hours needed to embed a new control scheme into your brain, not only have you not completely eliminated the risk of dying/losing due to panic, you're also in for a wild ride if Company X changes it next year.

However, all is not lost! Dealing with the problem is as simple as changing your buttons, right? And just about every game lets you change the controls, so what's the problem? The problem is that this option is almost NEVER fast. Let me list the games I've played that make this issue trivial :

Halo

In this title you have a profile you can save that contains your control scheme, is easy to edit, and is trivial to change. When the match over and a new friend hops in, he just picks his profile, which he/she'll need to create and set up once, no matter how often you folks play together.

And the titles that make this issue a goddamn mess?

Semi-bad :
Soul Calibur
Guilty Gear
Tekken

Bad :
Street Fighter III
Street Fighter II
Street Fighter Alpha
Street Figh... you get the point.

Goddamn Embarassing:
Virtua Fighter
Dead or Alive
Lumines

In the above titles, you have to stop playing completely, exit out of your current game mode, go into the fucking options screen (you'll call it that too, by the tenth time you have to go to it), and change it. This scenario takes between fifteen seconds and a minute to go through, depending on the game and its interface. It essentially has the value of loading time, 'cause there's pretty much shit else you can do while waiting for your buddy to customize the controls. Can you recall any games you've played lately with fifteen seconds to a minute of loading time? You don't, 'cause that's a fucking ridiculous a mount of time to wait every single fucking time you have a match.

Before you point out that I only have an issue with half a dozen games, I'd like to point out that they comprise pretty much the entirety of the fighting game genre. I'd also like to point out the most important part of this rant : what fucking year is this? Every game system currently up has a fucking hard drive, and it is goddamn arbitrary to make a profile system work.

What pisses me off is not one or two of those issues, it's essentially the systematic retardation that leads to failure on every single point. First, the Xbox controller was fucking modeled after the Dreamcast controller, so why, oh dear God why, is the control scheme in Dead or Alive 2 different from Dead or Alive 2 Ultimate? The Xbox 360 and PSP have the exact same face button and shoulder pad arrangements, so why in all damnation did Lumine's developer's feel the need to swap the primary block rotation buttons, along with eliminating the PSP's default config, even as an option? The closest thing they offer keeps the function of the lower left hand button but assigns nothing to the lower right hand button, for, once again, "no good goddamn reason". It's new kinds of fucking stupid. If your company doesn't have a choice, why haven't you implemented custom player profiles for control setups? Halo had that shit in 2001. What. Fucking. Year. Is. This. If you can't make profiles, at least let me pause and change. That leads to much less hair pulling. "Pause and change" is why Tekken and Soul Calibur top the "mess" list. Soul Calibur moreso, because you can do this during character selection, meaning you don't have to wait for the fight to start and then pause/change buttons, which disturbs the flow of the game a smidgen but nowhere near as much as exiting and going back three menus, ala Virtua Fighter. Street Fighter III is a special case : You can change the scheme in the single player mode, but not in multiplayer. That just reeks of retardation. Fortunately, Street Fighter's had the least amount of control scheme changes over the years, and they were all relegated to the shoulder buttons. However, it really just comes down to the fact that every goddamn fighting game currently on the market assumes you have only one fucking friend, and that for both of you, this is the first time you've played a title in their series.

It's not all bad news, however. Nintendo has announced that Smash Bros. Brawl will include a profile system which allows players to change button configurations and link them to their nickname, making the process of switching configs in and out pretty easy. It's actually pretty sad that Nintendo is at the forefront of making a game enjoyable when more people are playing than the amount of available slots for a single game, and people are switching in and out.

Next week we'll cover analog sticks and shooters! It will be a much shorter article, but way too big to make a part of this already large post.

Thursday, June 01, 2006

Overexpensive PS3's and ESRB Fiascos : This week's idiot corner

Okay, I'm not even sure if NEXT WEEK will have an idiot corner. I mean, this is my 2nd post, for cripe's sake. However, I really need this get this off my chest, so here we go :

The PS3 doesn't have to be exceedingly expensive.



All right, so Sony's releasing two PS3 models. One won't have HDMI or Wifi. So right off the bat we've already established that this will be the "budget" model, and they've already butchered its ability to be useful on high definition televisions. It's only $100 cheaper, and that still leaves it as the most expensive game console released since the 3D0, inflation be damned.

However, still months away from launch, Sony has an opportunity to change things significantly.

First, a smidgen of background : Sony has an audiophile centric music format called SACD. Along with DVD-Audio and HDCD, it offers listeners with a higher standard of musical appreciation (at least, that's the theory) to enjoy music at a higher quality, with more channels of separation (I will personally voice for the gloriousness of surround sound music, at least when mixed well). However, most next-generation audio formats have a fatal flaw : They don't play in regular CD players, and as such, have had incredibly difficult times working their way into the market, much like HD-DVD and Blu-Ray will in a year's time (and with that, I now have next week's topic). However, this is where Sony's genius comes into mind : SACD is a hybrid format by default. It has two layers : A DVD-5 platter, and a standard 74-minute CD platter. CD drives won't see the DVD disc at all, and SACD players are based on a simple logical mindset : If someone puts a music CD in the drive, the player tests for another layer. If it's there, that's the layer that gets played.

Do you see where I'm going with this?

Okay, think about it. Why is the "cheaper" version of the PS3 still $100 more than a comparably equipped Xbox 360 was a year earlier? It has an arguably cheaper processor, along with a cheaper video chip. The controller won't cost all that much more than its predecessor, and even then it'll still be a point of profit at retail. So where does the cost come in?

Enter Blu Ray.

The first Blu-Ray players, which have MUCH cheaper hardware for playback than Sony's next generation of game system, will still cost $800-1000 for a player at launch this summer. The problem is that Blu-Ray is one of the biggest shifts in how optical drives read data in a LONG TIME. DVD just used a nicer-quality version of CD's laser, shrunk down to read finer pits. HD-DVD features the same concept. Blu-Ray uses a completely new laser technology, and whether it's a result of lower yields due to the change or simply a more elaborate manufacturing process in the first place, the drives are going to be VERY expensive to produce for the first couple of years. This is why the PS3 was delayed for nearly six months, and why the Xbox 360 is getting an entire year without competition in its generation.

The situation, however, isn't hopeless. Sony can solve a good chunk of their problems in a very simple way : A new format. I'm going to call it Blu-Ray Game for the sake of clarity. Already games on the PS3 have a different region setup; there's no reason they can't have a different disc format.

And that's what it would be, in theory: a dual-platter design, featuring a DVD-5 and a BR-25 with game data on them. Eureka!

Pretty much every game in this generation is going to either run off've a popular game engine, or be heavily influenced by middle-ware tools and libraries. As such, no one in their right minds should be hand-coding functions to load and run media files. This is the key to what could be Sony's most brilliant endeavor:

First, force developers to produce two versions of their games : An HD 25-gig version and a SD 5-gig edition. Force is a bit of a loaded word; Sony will provide the down-sampling tools and support, all designed in a way to make the lower-end copy of the game as easy to produce as possible. Save for a difference in the media loaded, the two codesets of each version would be perfectly identical. Because by 2006, if your function to load a movie file (which would take up most of the space on a game over 5 gigs in size) is dependent on it being a certain resoltion.

Second, Sony releases a $300-400 20 gig, non-BluRay PS3. They'd simply call this model the Playstation 3. The $600 version would be released as the Playstation 3 HD. At $400, without a Blu-Ray drive, the lower-end edition can compete directly with the Xbox 360. A $300 it'd be gold; customers could pick up a PS3 for the same price they payed for the last two generations of Sony consoles. Lacking Blu-Ray functionally, it simply loads the DVD-5 version of the game.

And with that, you have a workable split in your customer base that's largely transparent to said customers. People who spend two grand on a 40 inch plasma with HDMI ports pick up a PS3HD, those with a $400 Samsung 27" HDTV get a PS3 with component cables. Heck, if Sony added a film grain filter to the component output on a DVD, 95% of the populace wouldn't even notice the difference. I'm not looking down on those people, I'm just pointing out the feature that probably accounts for 95% of the difference between an Blu-Ray and DVD transfer of any movie over 4 years old. But I'll save that for next week.

Now, with that topic out of the way, let's get onto round two :

The ESRB isn't doing shit.



What the hell has the ESRB been doing?! All they seem to accomplish is getting the occasional game pulled off the market and the ability to rate games based on videos from the publisher. God forbid they hire a dozen game testers to at least make some verification of said content. All right, in all honesty, given the breadth of the game industry, they'd probably need several dozen. And they'd still have trouble with "hidden" content. However, that's an argument for a whole 'nother day.

We have game consoles now that can afford the same level of parental protection found in DVD players and cable boxes.

This is UNBELIEVABLY idiotic.

Video games are NOT movies. They're NOT TV shows. Game violence prevention advocacy folks have been quite content to make this point at ever conceivable opportunity, so why hasn't the industry LISTENED yet?

What I'm about to propose may cost too much to work. Who knows. I think if, done in-line with the rest of development, and if help and support is provided by console manufacturers to make the process as transparent to developers as is possible, it can work.

Games differ from movies and other forms of linear entertainment in that they're interactive. They're written as CODE. Code is the foundation of a game. It links the artistic assets together, and gives them form and function. It turns a narrative into an experience. And it has the ability to load into its world only what the programmers decide it can load.

See where I'm going with this one?

As it currently stands, you can set a minimum rating for content that requires a password to access. Let's say you set it to T/Teen.

Your kid pops in a Mature-rated game, let's say Dead or Alive 4. The console does a quick check, and lo and behold, the game's rating is a bit higher than the minimum of Teen. So a password prompt shows up, and the kid can't play.

Kids can be pretty resourceful at times, and child restraint procedures aren't incredibly effective if a kid is left alone for a considerable amount of time, sometimes as high as fifteen minutes. Ask anyone running Netnanny for more than three months, at which point there's a good chance they've walked in on their kid breaking it with little effort, as to how effective procedures for content-blocking really are.

It's not really hard to call Microsoft technical support and tell them you bought a used Xbox 360 at Gamestop and it has a password that's preventing you from playing the half-a-dozen games you bought. If the kid sounds too young, they can just have one of their friends do it from their house. Surely MS tech support has an option for such a problem, some trick they normally don't disclose to customers.

Or maybe the kid gets past it with brute force. There's about 10,000 combinations in an Xbox 360 password. A kid could try for a few minutes each day for a month and secretly play Quake 4 with his parents none the wiser for who knows how long; few people change their bank's password often, let alone the password on the Xbox.

And kids will break past this security, not because they love the violence, but because, quite simply, they want to play the game.

So where's the solution for this problem? The same place you'll find the solution for state governments that want to see people carded at Target when they want to pick up a game.

The developers.

So back to where I was going. With enough help from a console manufacturer, a developer can work into his engine rating-flagged content. It's simple : if the console is protected from the loading of mature-rated games, don't load all the textures, models, sounds and animations on the m-rated list.

What we'd end up with is dual-rated games. How much easier does that make everyone's life?

A kid walks up to the counter at K-Mart with a copy of Mortal Kombat VII. The clerk asks him to pay. Kid hands him the cash his parents gave him. Kid walks back to mom over in sports equipment. They go home. Kid pops game in Playstation 3. Ratings password screen pops up. However, right above it, there's a button that's called "play anyway". Kid hits button. Game starts, and he's happily pummeling away at his opponents. However, no one's bleeding, there's no fatalities, and the game's introduction movie is nowhere to be seen. However, he's playing the game and learning the combos, and is either non the wiser, or probably just doesn't care, so long as he gets to enjoy his birthday present.

What else can we do to make this even easier? Well, that's where the ESRB kicks in. Call it the "Parent's Stand" program, or whatever. It's simple. You make a video, a DVD even, where you explain to parents what the ratings system is, including the kind of content that designates a particular rating, and then present them with a menu at the end of the video that presents each game console currently available on the market as a choice. Parent picks it, and the subsequent video shows them precisely how to set the parental lock on that game system.

The discs are put in small slip-cases, and the slip cases are packed into small long cardboard boxes at the counter, not unlike those free sampler CD's for AOL. The clerk sees dad buying his kid Solders of Misfortune Jungle Bloodbath Honor Medal, and he either hands dad the DVD or slips it into the bag with the game. In one swift motion he has coverd both his and the game producer's collective asses when dad doesn't do his job of looking over the title's rating and walks in on his 10-year-old blowing off someone's head with a P90.

In addition, the game industry ends up with one hell of a bargaining chip in the debate over their responsibility to keep minors away from violent content in games. In fact, I'd say they have an out.

- Pedro Martinez

Wednesday, May 17, 2006

Make Yourself Identity Theft-Proof (at least over e-mail)

Phishing is on the rise, apparently. 

A common scam now is for a person to steal an eBay account using this method  of identity theft and use it to lure buyers into a false sense of security (as the account targeted for theft will usually have a really nice seller's rating) and then selling them big-ticket items (such as televisions, stereo equipment, or computers) that they never plan on shipping out. By the time the complaints show up the scammer is long gone.

How do they steal the account? They log on using the target's username and password, and then promptly change the password. This is easy to do in just about any online service from Paypal to your local bank's website, so long as they have your username and, well, password. But how do they get such privious information?

Simple : They ask for it.

It's a very simple method you've probably seen in action. You check your inbox, and poof, there's an email "from Paypal" telling you that your account has been terminated due to some technical mishap, and ask you to log into your account to rectify the problem. Only the link in the email will take you to a place far, far away from any computer actually owned by Paypal. However, the website the link leads to has been meticulously designed to perfectly resemble the site you're expecting to go to. Some newer phishing sites even fake the URL box that some people might double-check to be certain. Others look for easy-to-make typos that people going to legitimate financially-oriented institutions might make, and establishing a phish site to resemble said institution's page.  This practice has escelated to the point where everyone from Mozilla to Microsoft is looking to implement features in their software  to limit the capability of these scam sites.

However, phishing is nowhere near as dangerous as it might possibly seem to a remotely educated computer user. Or to the very least, someone with "the guide". And with that, I present you :

How to make yourself phish-proof (in a few easy steps) :

1. Check your bills.
Look at all of your credit card bills. Each one should have a website listed on it. Type it into your web browser. Double, triple, and quadruple check each address, to make sure you have typed it in perfectly. Now bookmark it. This is because most bank's have really long, easy-to-mistype addresses. Overstocked 'n Amazon don't have this problem.   =3

If you know how to, move the bookmarks to a folder called "Credit Cards" for easy access.

2. NEVER click a link in any emails you get. If it's a technical problem and they need account verification, delete the e-mail and go to their site on your own.

I'm not talking about e-mails you get from frends, like cute animated postcards and the like. I'm talking about (of course!) anything you get from a site you do any sort of business with. Anything involving money, really. Any time you get an email from a site like this, asking you to check up on your account, delete the email, immediately.

Now simply go to that business's website. Log in. If there are any real problems, you should see t hem immediately. No company lets you log in and do business if your account's been disabled. Can you navigate the site with no problems? Congratulations! You've just avoided a phishing e-mail! If your account was actually disabled, instructions should be there on how to fix things. 

3. Rule number 2 also applies to phone calls.

Simple as can be. If your bank or credit card company ever calls you and needs you to verify some information, tell them you're busy at the moment. Call them back , NOT using your Caller ID, but the number on your bank statement, bank card, or checkbook. Tell them that you're returning their call. They don't recognize said call? There's no problem with your account? Report the number that called you if you have Caller ID.

4. Shred anything with important information that you're throwing away. Bills and the like.

This is partly paranoia, partly common sense, and already pretty common practice. Anytime you get a credit card offer or are tossing a bill or any other confidential information, put it through
a paper shredder. Cross-cut shredders are pretty cheep nowadays, and will take care of said information pretty cleanly.

Hopefully this helps SOME people.