Bringing in a generic H.264 stream to Wirecast (via Wowza and Wirecast’s Generic IP Camera support)

Wirecast is truly a studio in a box. It has a great support for multiple cameras, mixing live and recorded sources, graphic overlays and so on. Recent versions even allow you to bring in live feeds from IP cameras including support for specific Axis cameras.

Since I am a big fan of IP cameras and Axis in particular this is great news. Unfortunately Wirecast doesn’t have direct support for most models and I had to dig quite a bit to get things to work using their “Generic” IP camera support.

First test was to get a straight H.264 encoded into Wowza and then out to Wirecast. To do this, I used the Flash Media Live Encoder and set it publish to “rtmp://localhost:1935/img” (I have Wowza running on my local machine and an application called “img” which is a copy of Wowza’s “live” application). I set the Stream name in FMLE to “media.sav” which is what Wirecast is looking for by default.

In Wirecast’s Source Settings, I added a new IP Camera and set it’s IP address to: “127.0.0.1:1935” and choose “Generic” as the type.

Viola! It works, the video is being captured and encoded by FMLE, sent to Wowza and pulled into Wirecast as a Generic IP camera. In this manner, I can have live cameras via FMLE from anywhere in the world brought live into my final stream.

(Big thanks to Steve McFarlin the developer of the LiveU iPhone broadcasting app for his post on Wirecast’s Forum detailing how he got his software working.)

Open for Business

Walking Productions provides software development and consulting services. Appealing projects are those that deal with online and mobile media (audio/video). Get in touch: vanevery@walking-productions.com

Android Application Development
Flash Video Players, including P2P (Adobe Stratus)
Wowza Media Server Plugin/Module Development
Flash Media Server Development
Development related to Axis IP Cameras
QuickTime/Darwin Streaming Solutions
Audio and Video Encoding/Transcoding Pipelines
iPhone Application Development
JME/J2ME Application Development
Asterisk and VoIP Application Development
Phone call to streaming applications
Voicemail to Blog/CMS
Podcasting Systems
Mobile and Microblogging Solutions
SMS Campaign Management Software
2 Screen Interactive Television Applications (Enhanced TV)
EBIF iTV Application Development
HTML 5 Video Player Development
Media Asset Management Systems
AJAX/JavaScript/DHTML Development
LAMP Application Development (Linux, MySQL, PHP)
Java Desktop Application Development
Mobile Video Capture, Sharing and Playback Applications
Live Mobile Video Streaming
Computer Vision Applications in Java and Flash
Flash Video Capture
Location Aware Mobile Applications
Video Indexing, Searching, Recommendation Engine and Presentation Systems
Network Controlled Devices
WordPress and Drupal Plugin/Module Development
Flash Lite Application Development
AIR/ActionScript 3 Application Development
WebService Integration and Development (XML-RPC, SOAP, REST)
Podcasting (Audio/Video) Solutions
MP3 Streaming Servers
MMS Gateway Solutions
Java and AJAX Chat Application Development
Interactive Whiteboard Applications

Mobile Art && Code

I am here at CMU in Pittsburgh at a conference called Mobile Art && Code. Great talks, great workshops, glad I came.

I am doing a workshop called Interactive Telephony for New Media Arts, here is the full set of notes.

One thing that I did for the workshop is a put together an Asterisk driven webservice in PHP for getting at live phone call data. If you have been working projects that get information from asterisk or use phone calls to control other applications, it might be worth checking out.

PHP AGI Script:

#!/usr/bin/php -q
<?PHP
require('/var/lib/asterisk/agi-bin/phpagi.php');

$agi = new AGI();

$agi->stream_file("vm-extension");
$return = $agi->wait_for_digit(10000);
while ($return['result'] > 0)
{
        $ascii = chr($return['result']);
        $agi->say_number($ascii);
        file_put_contents("/var/www/html/webservice/data.txt",time() . "," . $agi->request["agi_uniqueid"] . "," . $agi->request["agi_callerid"] . "," . $ascii . "\n",FILE_APPEND);
        $return = $agi->wait_for_digit(100000);
}
?>

PHP Web Service Script:

<?
	// The client will send a timestamp if it want's new stuff from the timestamp
	$timestamp = 0;
	if (isset($_GET['ts']))
	{
		$timestamp = $_GET['ts'];
	}

	$data = file_get_contents("data.txt");
	$dataarray = explode("\n",$data);
	if ($timestamp > 0)
	{
		// Send everything from the timestamp forward
		for ($i = sizeof($dataarray) - 10; $i < sizeof($dataarray); $i++)
		{
			$currentline = explode(",",$dataarray[$i]);
			if (sizeof($currentline) > 0)
			{
				if ($currentline[0] > $timestamp)
				{
					echo($dataarray[$i]."\n");
				}
			}
		}
	}
	else
	{
		// Just send the last one
		if (sizeof($dataarray) > 1)
		{
			echo($dataarray[sizeof($dataarray)-2]);
		}
	}
?>

Processing Example

I should note that this was built very quickly and therefore somewhat buggy. I don’t think the Processing example is thread safe and the PHP should really be using a database.. Also, the Processing example is a riff off of something Dan Shiffman put together for getting Asterisk and Processing to talk through a Java server.

Academic Asterisk Adventures

In my continuing adventures as an adjunct professor at NYU’s Interactive Telecommunications Program, I taught a new course last semester entitled “Redial: Interactive Telephony“.

The purpose of the course was to utilize emerging telephony technologies, concepts and services such as VoIP as a tool for building interactive applications and devices. ITP students are famous for their imaginative use of new technology. One of my goals in this course was to help them apply some of their creative and critical thinking to new telephony technology in the context of the rich history of telephony.

The course content was focused around voice and touch-tone based applications using Asterisk, SIP, RTP, text to speech (using Festival), speech recognition (using Sphinx) and the like.

The results of this course were truely fantastic and I will take a bit of time in the coming days/weeks to highlight their projects.

For a quick taste, checkout these projects

For now I want to write a bit about using Asterisk in an environment such as this in the hopes that some Asterisk users/developers offer suggestions and perhaps implement some of my suggestions.

We (18+ students in my class, myself and a couple of students following along without actually being members of the class) used an older Intel P3 machine running RedHat Enterprise Linux 4 (as I recall) with the Secure Linux enabled. We used Asterisk 1.2 and each student had a normal linux user account on the machine. We also had Apache 2, PHP, MySQL (running on another machine), PHP AGI, Perl, Festival and Sphinx.

Many of the issues that we ran into were a direct result of running PHP for both AGI scripting in Asterisk and normal web development with Apache. PHP’s safe mode and SE linux contributed to these difficulties.

The problem is that Asterisk was running as the “asterisk” user and Apache was running as a different user. PHP safe mode was relaxed to allow the group to execute the files but this still threw many of us for a loop several times.

I don’t want to whine about this too much as it is what was available and we just had to deal with it. One thing that might help would be to enable suexec within Asterisk so that AGI scripts could run as the owner of the script. This, I believe is how Apache can be setup to handle things and would go a long way towards alleviating many of the issues we had with both security and usability.

The next major problem we had was in developing dialplans and editing other Asterisk configuration files. At first, I setup an extensions file for each student that was included (using #include) in the main Asterisk extensions.conf file. Unfortunately, we ran up against a hard limit to the number of includes that Asterisk would handle and half of the files never got included.

To alleviate that problem, I put together a PHP script and a shell script that would cat together all of the extension files that needed to be included. These scripts also took care of issuing the reload command to the asterisk manager interface. This worked reasonably well but didn’t have any error checking so that if one user’s extensions file had errors or if they used a context that was named the same as another user problems would arise.

This is probably a harder problem to solve in the current design of Asterisk. I am interested in hearing other’s thoughts on how these problem could be solved. My thoughts are that Asterisk could somehow take some pointers from Apache and allow individual users to have a set of configuration files that get included at run time when their extension is entered. Something similar to the concept of a public_html directory. Asterisk when told to go to a specific user’s context would look in a specific directory and include the dialplan from there.

Perhaps I am just dreaming.. ;-) What do you think?

In any case, none of this would have been possible in a world without Asterisk and on behalf of my students and myself a big thank you to all those who have contributed to Asterisk!

Asterisk 1.4 Coming Soon!

Digium – The Asterisk Telephony Company

Ok, this is a big deal. The next version of Asterisk supports GoogleTalk!

From the Press Release:
Asterisk 1.4 is the first major release of Asterisk since the release of Asterisk 1.2 in November 2005. With over 20 new functionality additions including IPFAX compatibility, unified messaging capabilities and Jabber/Jingle/GoogleTalk protocol compatibilities, Asterisk 1.4 features overall quality and performance improvements, as well as increased scalability and interoperability.

Verizon Naked DSL Working!

In July, I complained that Verizon was constantly changing my IP address.

I theorized that it had to do with my impending transition to VoIP and that Verizon may have been punishing me… Well, turns out that I was wrong and that it was probably due to a lightning storm.

After contacting support several times I was finally sent a new DSL modem which is working great. I am still having some period disconnects but the reconnect is almost immediate and I am once again happy with my DSL. The speed is much closer to where it should be as well.

In other news, I was able to transition my phone number to Broadvoice and keep my DSL (without any problems). Now when I pickup the phone at home that is connected directly to the Verizon line I get a message saying that this is a dedicated data line and can not be used to make calls). Yippee!

ITJ Project Beta Released

Interactive Tele-Journalism
So.. I have finally released ITJ on SourceForge.net.

With support from Konscious and Manhattan Neighborhood Network we have packaged and uploaded the latest version and it can be downloaded at: http://sourceforge.net/projects/itv-ism/.

YouTube APIs.. Is this new?

YouTube – Broadcast Yourself.

Hmmn.. This could be very interesting..!

“YouTube is excited to offer APIs to the developer community. Using our APIs, you can easily integrate online videos from YouTube’s rapidly growing repository of videos into your application. The APIs currently allow read-only access to key parts of the YouTube video respository and user community.”

Thanks Steven.