<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>MuxCloud.com</title>
	<atom:link href="http://muxcloud.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://muxcloud.com</link>
	<description>Video Computing in the Cloud</description>
	<pubDate>Sun, 09 Nov 2008 19:34:04 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<item>
		<title>Calling Mux from PHP</title>
		<link>http://muxcloud.com/2008/11/09/calling-mux-from-php/</link>
		<comments>http://muxcloud.com/2008/11/09/calling-mux-from-php/#comments</comments>
		<pubDate>Sun, 09 Nov 2008 17:08:55 +0000</pubDate>
		<dc:creator>Nathan o' Mux</dc:creator>
		
		<category><![CDATA[blog]]></category>

		<category><![CDATA[mux]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[sample]]></category>

		<category><![CDATA[transcoding]]></category>

		<guid isPermaLink="false">http://muxcloud.com/?p=140</guid>
		<description><![CDATA[This is a repost of lectures notes from Shawn Van Every&#8217;s &#8220;Mobile (Me)dia&#8221; class taught at NYU&#8217;s Interactive Telecommunications Program in Spring of 2008. Many thanks to Shawn for sharing Mux with his class and for writing up this great tutorial.
**********************
Often when recieving files from users, they aren&#8217;t in the ideal format to deliver to [...]]]></description>
			<content:encoded><![CDATA[<p>This is a repost of <a href="http://itp.nyu.edu/~sve204/mobilemedia/week5.html">lectures notes</a> from Shawn Van Every&#8217;s &#8220;Mobile (Me)dia&#8221; class taught at NYU&#8217;s Interactive Telecommunications Program in Spring of 2008. Many thanks to <a href="http://www.walking-productions.com/shawn.html">Shawn</a> for sharing Mux with his class and for writing up this great tutorial.</p>
<p>**********************<br />
Often when recieving files from users, they aren&#8217;t in the ideal format to deliver to other mobile devices or present on the web. Transcoding is the conversion from one format to another and is what we need to do to convert an MPEG-4 into a 3GP or FLV file.</p>
<p>Unfortunately, while their exist great tools for file conversion on the desktop (QuickTime Pro) doing such on the server side (automatically) can be considerably more complex. FFMPEG is generally considered to be the best open source transcoding tool available for use on the command line. Unfortunately, it is difficult to configure and install as well as keep up to date (if you are interested in installing it on your own host, I would be happy to help).</p>
<p>Thankfully a new web service called Mux has done much of the hard work for us.</p>
<p><strong>Transcoding with Mux</strong><br />
First of all, to use Mux you need to register on their site and apply for an ID and a Key</p>
<p>They will email you your ID and Key after you are approved (I talked to them, they should approve anyone from this class).</p>
<p>Following that, we can start programming:</p>
<blockquote><p><?PHP<br />
	include "Snoopy.class.php";</p>
<p>	$media_url = "http://itp.nyu.edu/~sve204/mobilemedia/php_popper/posts/1202423098_9136_057.3g2";</p>
<p>	$mux_api_key = "xxxxx";<br />
	$mux_api_caller_id = "xxxxx";</p>
<p>	$callback_page = "http://your.server.com/callbackpage.php";</p>
<p>	$mux_api_key_encoded = base64_encode($mux_api_caller_id . ":" . $mux_api_key);</p>
<p>	$snoopy = new Snoopy;</p>
<p>	$api_endpoint = "http://mux.am/api/endpoint/1/basic/";<br />
	$command = "TranscodeMediaUrlRequest";</p>
<p>	$submit_url = $api_endpoint . $command;</p>
<p>	$submit_vars = array();<br />
	$submit_vars['clr'] = $mux_api_key_encoded;<br />
	$submit_vars['url'] = $media_url;<br />
	$submit_vars['cb'] = $callback_page;</p>
<p>	$submit_vars['sot'] = "video/quicktime"; // Output formats<br />
	/*<br />
		video/mp4 MPEG-4<br />
		video/quicktime Quicktime<br />
		video/m4v iPod (M4V)<br />
		video/x-flv Flash Video<br />
		video/x-ms-wmv Windows Media<br />
		video/mpg MPEG-1/2<br />
		video/avi Windows AVI<br />
		video/3gpp 3GP Mobile<br />
		application/ogg OGG Theora<br />
		video/mp4-psp PSP MPEG-4</p>
<p>		image/jpeg JPEG Thumbnail<br />
	*/</p>
<p>	// These are optional<br />
	//$submit_vars['smt'] = "video/3gpp2"; // Input mime type, not required<br />
	$submit_vars['em'] = "xxx@xxx.com"; // Email address for notification<br />
	$submit_vars['h'] = 240; // output height, default is input height<br />
	$submit_vars['w'] = 320; // output width, default is input width</p>
<p>	//$submit_vars['s'] = 0; // starting point in seconds, omit for 0<br />
	//$submit_vars['l'] = 100; // length to transcode, omit for whole thing<br />
	//$submit_vars['br'] = 40; // kilobytes per second<br />
	//$submit_vars['fps'] = 10; // frames per second</p>
<p>	if ($snoopy->submit($submit_url,$submit_vars))<br />
	{<br />
		echo &#8220;<PRE>&#8220;.$snoopy->results.&#8221;</PRE>\n&#8221;;<br />
		/*<br />
		Should look like this:<br />
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><br />
<jobStartedResponse><br />
    <jobId>0AFD0FCF01183BDD6EA3F94E014741A3</jobId><br />
</jobStartedResponse><br />
		*/</p>
<p>		// Get the job id:<br />
		$matches = array();<br />
		if (preg_match(&#8217;/<jobId>(.*)<\/jobId>/&#8217;,$snoopy->results,$matches) > 0 &#038;&#038; sizeof($matches) > 1)<br />
		{<br />
			$mux_job_id = $matches[1];</p>
<p>		}<br />
		else<br />
		{<br />
			echo &#8220;Sorry, something went wrong with mux&#8221;;<br />
		}</p>
<p>		// You would use the job id on the callback page to know which job was finished</p>
<p>	}<br />
	else<br />
	{<br />
		echo &#8220;error fetching document: &#8220;.$snoopy->error.&#8221;\n&#8221;;<br />
	}<br />
?>
</p></blockquote>
<p>You can run this snippet of code from the command line and see that it makes a request to them for transcoding the file specified. You will need the Snoopy.class.php file in the same directory as this file for it to work correctly.</p>
<p>The above code snippet can be easily integrated into our upload script such as follows.</p>
<p><strong>Integrating into upload script</strong></p>
<blockquote><p><?PHP<br />
	echo "<?xml version=\"1.0\"?>\n&#8221;; </p>
<p>	// Turn on error reporting<br />
	ini_set(&#8217;display_errors&#8217;, true);<br />
	ini_set(&#8217;display_startup_errors&#8217;, true);<br />
	// You could also log them:<br />
	//ini_set(&#8217;log_errors&#8217;, true);<br />
	//ini_set(&#8217;error_log&#8217;, &#8216;/home/netid/php_errors.log&#8217;);<br />
	error_reporting(E_ALL);</p>
<p>	// Database connect function<br />
	$mySql = null;<br />
	function sqlConnect() {<br />
		# Configuration Variables<br />
		$hostname = &#8220;localhost&#8221;;<br />
		$dbname = &#8220;xxxx&#8221;;<br />
		$username = &#8220;xxxx&#8221;;<br />
		$password = &#8220;xxxx&#8221;;</p>
<p>		$mySql = mysql_connect($hostname, $username, $password) or die (mysql_error());<br />
		mysql_select_db($dbname, $mySql) or die(mysql_error());</p>
<p>		return $mySql;<br />
	}</p>
<p>?><br />
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"></p>
<p><html xmlns="http://www.w3.org/1999/xhtml"><br />
	<head></p>
<p>	</head></p>
<p>	<body></p>
<h1>File Upload Transcode Test</h1>
<p><?</p>
<p>	// Limit what people can upload for security reasons and because we only want video files<br />
	$allowed_mime_types = array("video/3gpp"=>&#8220;3gp&#8221;,<br />
								&#8220;video/mp4&#8243;=>&#8221;mp4&#8243;,<br />
								&#8220;video/3gpp2&#8243;=>&#8221;3g2&#8243;,<br />
								&#8220;video/mpeg&#8221;=>&#8221;mpg&#8221;,<br />
								&#8220;video/quicktime&#8221;=>&#8221;mov&#8221;,<br />
								&#8220;video/x-quicktime&#8221;=>&#8221;mov&#8221;,<br />
								&#8220;video/x-msvideo&#8221;=>&#8221;avi&#8221;,<br />
								&#8220;audio/vnd.wave&#8221;=>&#8221;wav&#8221;<br />
								);</p>
<p>	// Make sure form was submitted<br />
	if (isset($_POST['form_submitted']) &#038;&#038; $_POST['form_submitted'] == &#8220;true&#8221;)<br />
	{<br />
		// Check the mime type<br />
		$allowed_types = array_keys($allowed_mime_types);<br />
		$allowed = false;<br />
		if (isset($_FILES['bytes']['type']))<br />
		{<br />
			for ($i = 0; $i < sizeof($allowed_types) &#038;&#038; !$allowed; $i++)<br />
			{<br />
				if (strstr($_FILES['bytes']['type'], $allowed_types[$i]))<br />
				{<br />
					$allowed = true;<br />
				}<br />
			}</p>
<p>			// If the mime type is good, save it..<br />
			if ($allowed)<br />
			{<br />
				$uploadfilename = time() . "_" . rand(1000,9999) . "_" . basename($_FILES['bytes']['name']);<br />
				// Make sure apache can write to this folder<br />
				$uploaddir = '/xxxx/xxxx/xxxx/xxxx/xxxx/xxxx/';<br />
				$uploadfile = $uploaddir . $uploadfilename;<br />
				$uploadrelativefile = 'http://itp.nyu.edu/xxx/xxx/xxx/xxx/' . $uploadfilename;</p>
<p>				if (move_uploaded_file($_FILES['bytes']['tmp_name'], $uploadfile))<br />
				{<br />
					// Make sure the file isn't executable and you can delete it if you need<br />
					chmod($uploadfile, 0666);</p>
<p>					// Put it in the database<br />
					/* Database Table:<br />
						mobile_me_messages<br />
						message_id int(11) auto_increment<br />
						attachment varchar(255)<br />
						subject varchar(255)<br />
						body varchar(255)<br />
						from_name varchar(255)<br />
						from_domain varchar(255)<br />
						thumbnail_url varchar(255)<br />
						quicktime_url varchar(255)<br />
						mux_thumbnail_job_id varchar(255)<br />
						mux_transcode_job_id varchar(255)<br />
					*/</p>
<p>					$subject = "";<br />
					$message_text = "";</p>
<p>					if (isset($_POST['subject']))<br />
					{<br />
						$subject = $_POST['subject'];<br />
					}</p>
<p>					if (isset($_POST['message_text']))<br />
					{<br />
						$message_text = $_POST['message_text'];<br />
					}</p>
<p>					// Connect to the database<br />
					$mySql = sqlConnect();</p>
<p>					// Insert Data<br />
					$query = "insert into mobile_me_messages (attachment, subject, body, from_name, from_domain) values ('" . $uploadfile . "', '" . $subject . "', '" . $message_text . "', 'mobile web user', 'mobile web user')";<br />
					$result = mysql_query($query, $mySql);</p>
<p>					// Get the last insert id so that we can update the record<br />
					$mobile_me_messages_id = mysql_insert_id($mySql);</p>
<p>					// Now do the mux transcode request<br />
					include "Snoopy.class.php";</p>
<p>					// The media_url is the file that was just uploaded<br />
					$media_url = $uploadrelativefile;</p>
<p>					// The mux keys<br />
					$mux_api_key = "xxxxx";<br />
					$mux_api_caller_id = "xxxxx";<br />
					$mux_api_key_encoded = base64_encode($mux_api_caller_id . ":" . $mux_api_key);</p>
<p>					// The page that mux calls back when done<br />
					$callback_page = "http://itp.nyu.edu/xxxx/xxxx/xxxx/muxcallback.php";</p>
<p>					// Snoopy is charlie brown's friend<br />
					$snoopy = new Snoopy;</p>
<p>					// What we are hitting with snoopy (mux)<br />
					$api_endpoint = "http://beta2.mux.am/api/endpoint/1/basic/";<br />
					$command = "TranscodeMediaUrlRequest";</p>
<p>					$submit_url = $api_endpoint . $command;</p>
<p>					// Setup the array of variables to send to mux<br />
					$submit_vars = array();<br />
					$submit_vars['clr'] = $mux_api_key_encoded;<br />
					$submit_vars['url'] = $media_url;<br />
					$submit_vars['cb'] = $callback_page;</p>
<p>					// What format do we want back?<br />
					$submit_vars['sot'] = "video/quicktime"; // Output formats<br />
					/*<br />
						video/mp4 MPEG-4<br />
						video/quicktime Quicktime<br />
						video/m4v iPod (M4V)<br />
						video/x-flv Flash Video<br />
						video/x-ms-wmv Windows Media<br />
						video/mpg MPEG-1/2<br />
						video/avi Windows AVI<br />
						video/3gpp 3GP Mobile<br />
						application/ogg OGG Theora<br />
						video/mp4-psp PSP MPEG-4</p>
<p>						image/jpeg JPEG Thumbnail<br />
					*/</p>
<p>					// Email address for notification<br />
					$submit_vars['em'] = "xxxx@xxxx.com"; </p>
<p>					$submit_vars['w'] = 320; // output width, default is input width<br />
					$submit_vars['h'] = 240; // output height, default is input height</p>
<p>					//$submit_vars['s'] = 0; // starting point in seconds, omit for 0<br />
					//$submit_vars['l'] = 100; // length to transcode, omit for whole thing<br />
					//$submit_vars['br'] = 40; // kilobytes per second<br />
					//$submit_vars['fps'] = 10; // frames per second</p>
<p>					if ($snoopy->submit($submit_url,$submit_vars))<br />
					{<br />
						//echo &#8220;<PRE>&#8220;.$snoopy->results.&#8221;</PRE>\n&#8221;;<br />
						/*<br />
						Should look like this:<br />
							<?xml version="1.0" encoding="UTF-8" standalone="yes"?><br />
							<jobStartedResponse><br />
								<jobId>0AFD0FCF01183BDD6EA3F94E014741A3</jobId><br />
							</jobStartedResponse><br />
						*/</p>
<p>						// Get the job id:<br />
						$matches = array();<br />
						if (preg_match(&#8217;/<jobId>(.*)<\/jobId>/&#8217;,$snoopy->results,$matches) > 0 &#038;&#038; sizeof($matches) > 1)<br />
						{<br />
							$mux_job_id = $matches[1];<br />
							echo &#8220;Mux Job ID: &#8221; . $mux_job_id;<br />
						}<br />
						else<br />
						{<br />
							echo &#8220;Sorry, something went wrong with mux&#8221;;<br />
							$mux_job_id = &#8216;0&#8242;;<br />
						}</p>
<p>						// Put the job id in the database<br />
						$sql = &#8220;update mobile_me_messages set mux_transcode_job_id = &#8216;$mux_job_id&#8217; where message_id = $mobile_me_messages_id&#8221;;<br />
						$result = mysql_query($sql, $mySql);</p>
<p>					}<br />
					else<br />
					{<br />
						echo &#8220;error fetching document: &#8220;.$snoopy->error.&#8221;\n&#8221;;<br />
					}</p>
<p>					// Disconnect from the database<br />
					mysql_close($mySql);					</p>
<p>					// Tell the user<br />
					echo &#8220;
<p>Success <br /> <a href=\"" . $uploadrelativefile  . "\">&#8221; . $uploadrelativefile . &#8220;</a></p>
<p>&#8220;;<br />
				}<br />
				else<br />
				{<br />
					echo &#8220;
<p>Error on upload&#8230;!  Here is some debugging info:</p>
<p>&#8220;;<br />
					var_dump($_FILES);<br />
				}<br />
			}<br />
			else<br />
			{<br />
				echo &#8220;
<p>Type not allowed&#8230;! Here is some debugging info:</p>
<p>&#8220;;<br />
				var_dump($_FILES);<br />
			}<br />
		}<br />
		else<br />
		{<br />
			echo &#8220;
<p>Strange, file type not sent by browser&#8230;!  Here is some debugging info:</p>
<p>&#8220;;<br />
			var_dump($_FILES);<br />
		}<br />
	}<br />
	else<br />
	{<br />
?></p>
<form enctype="multipart/form-data" method="post" action="uploadmux.php">
<p>
				Title:<br />
<input type="text" name="subject" />
				Description:<br />
<input type="text" name="message_text" /></p>
<input type="file" name="bytes" />
<input type="hidden" name="form_submitted" value="true" />
				</p>
<input type="submit" name="submit" value="submit" />
</p></form>
<p><?<br />
	}<br />
?><br />
	</body><br />
</html>
</p></blockquote>
<p><strong>Callback page</strong></p>
<p>Submitting the media to Mux for transcoding is half the battle. What we need to do next is get the media back from them when it is done.</p>
<p>For these purposes they have implemented a &#8220;callback&#8221;. Essentially, you specify a URL when you submit your media to them and they call that URL with the URL to the transcoded media when they are done.</p>
<p>In the above example, the purpose of the $callback_url variable is just that, to tell them what page to hit when the trancoding is complete:</p>
<blockquote><p>
$callback_page = &#8220;http://itp.nyu.edu/~sve204/mobilemedia/muxtranscoder/muxcallback.php&#8221;;</p></blockquote>
<p>Here are the contents of muxcallback.php:</p>
<blockquote><p><?PHP</p>
<p>	// Extra Database connect function<br />
	$mySql = null;<br />
	function sqlConnect() {<br />
		# Configuration Variables<br />
		$hostname = "localhost";<br />
		$dbname = "xxxx";<br />
		$username = "xxxx";<br />
		$password = "xxxx";</p>
<p>		$mySql = mysql_connect($hostname, $username, $password) or die (mysql_error());<br />
		mysql_select_db($dbname, $mySql) or die(mysql_error());</p>
<p>		return $mySql;<br />
	}</p>
<p>	// Let's save it to a file so we can see what mux is sending back and get some output for ourselves to debug with<br />
	// We have to look at $HTTP_RAW_POST_DATA to get what mux sends us<br />
	$filename = "/xxx/xxxx/xxxx/xxxx/xxx/xxxx/muxcallback.txt";<br />
	$filehandle = fopen($filename, 'w');<br />
	$raw_input_data = print_r($HTTP_RAW_POST_DATA,true);<br />
	fwrite($filehandle, $raw_input_data);	</p>
<p>	/*<br />
	Should look like this when done:</p>
<transcodeCompletion>
		<url>http://mux.am/files/fooey</url><br />
		<expires>TODO</expires><br />
	</transcodeCompletion>
	*/</p>
<p>	// Get the job id:<br />
	$jobid_matches = array();<br />
	if (preg_match(&#8217;/<jobId>(.*)<\/jobId>/&#8217;,$HTTP_RAW_POST_DATA,$jobid_matches) > 0 &#038;&#038; sizeof($jobid_matches) > 1)<br />
	{<br />
		$mux_transcoded_jobid = $jobid_matches[1];<br />
		fwrite($filehandle, &#8220;Job ID Match: &#8221; . $mux_transcoded_jobid . &#8220;\n&#8221;);</p>
<p>		$url_matches = array();<br />
		if (preg_match(&#8217;/<url>(.*)<\/url>/&#8217;,$HTTP_RAW_POST_DATA,$url_matches) > 0 &#038;&#038; sizeof($url_matches) > 1)<br />
		{<br />
			$mux_transcoded_url = $url_matches[1];<br />
			fwrite($filehandle, &#8220;URL Match: &#8221; . $mux_transcoded_url . &#8220;\n&#8221;);</p>
<p>			$mux_transcoded_url = str_replace(&#8217;&#038;',&#8217;&#038;',$mux_transcoded_url);<br />
			$mux_url = parse_url($mux_transcoded_url);</p>
<p>			// DO DOWNLOAD<br />
			// Setup some variables<br />
			$transcoded_filename = &#8220;muxoutput_&#8221; . time() . rand(1000,9999) . &#8220;.mov&#8221;; // Specifying .mov here, not the best thing to do as we don&#8217;t know the format<br />
			$transcoded_file = &#8220;/xxx/xxxx/xxx/xxx/xxx/xxx/&#8221; . $transcoded_filename;<br />
			$transcoded_file_relative = &#8220;http://itp.nyu.edu/xxx/xxx/xxxx/xxxx/&#8221; . $transcoded_filename;</p>
<p>			//$ch = curl_init($mux_url['scheme'] . &#8220;://&#8221; . $mux_url['host'] . &#8220;:&#8221; . $mux_url['port'] . &#8220;/&#8221; . $mux_url['path'] . &#8220;?&#8221; . urldecode($mux_url['query']));<br />
			$ch = curl_init($mux_transcoded_url);<br />
			$fp = fopen($transcoded_file, &#8220;w&#8221;);</p>
<p>			curl_setopt($ch, CURLOPT_FILE, $fp);<br />
			curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);<br />
			curl_setopt($ch, CURLOPT_HEADER, 0);</p>
<p>			curl_exec($ch);</p>
<p>			//echo curl_getinfo($ch,CURLINFO_EFFECTIVE_URL) . &#8220;<br />\n&#8221;;</p>
<p>			curl_close($ch);<br />
			fclose($fp);			</p>
<p>			fwrite($filehandle, &#8220;File Saved: &#8221; . $transcoded_file_relative . &#8220;\n&#8221;);</p>
<p>			// UPDATE DATABASE<br />
			$mySql = sqlConnect();<br />
			$sql = &#8220;update mobile_me_messages set quicktime_url = &#8216;&#8221; . $transcoded_file_relative . &#8220;&#8216; where  mux_transcode_job_id = &#8216;&#8221; . $mux_transcoded_jobid . &#8220;&#8216;&#8221;;<br />
			$result = mysql_query($sql, $mySql);</p>
<p>			fwrite($filehandle, &#8220;SQL Statement: &#8221; . $sql . &#8220;\n&#8221;);<br />
		}<br />
	}</p>
<p>	fclose($filehandle);</p>
<p>?><br />
OK	</p></blockquote>
<p>This script, receives the XML POST that is sent by Mux, parses it looking for the &#8220;jobId&#8221; and then the URL of the media. Once those are found, it downloads the media and updates the database.</p>
<p>You will notice that I added two extra fields into the database to deal with the transcoded file. First is the &#8220;mux_transcode_job_id&#8221; so that when I submit I can keep track of requests to and from them and the second is the &#8220;quicktime_url&#8221; which holds the relative filename of the transcoded file after it is downloaded.</p>
<p>To get this script to work you will have to update the following variables in the code with the appropriate locations on your server (don&#8217;t forget the database connection information as well):</p>
<p>$filename should contain the path to a world writable file that will hold debugging output for this script. Since we are not running this from a web browser, rather it is getting hit by the mux service automatically, this is one way we can see what is happening.</p>
<blockquote><p>$filename = &#8220;/xxx/xxxx/xxxx/xxxx/xxx/xxxx/muxcallback.txt&#8221;;</p>
<p>$transcoded_file should contain the path to a directory that is world writable where the file that is downloaded from mux will be saved.<br />
$transcoded_file = &#8220;/xxx/xxxx/xxx/xxx/xxx/xxx/&#8221; . $transcoded_filename;</p>
<p>$transcoded_file_relative should be the corresponding web viewable url to the directory specified in $transcoded_file. In both cases, be sure to leave the &#8220;. $transcoded_filename&#8221; in place.</p>
<p>$transcoded_file_relative = &#8220;http://itp.nyu.edu/xxx/xxx/xxxx/xxxx/&#8221; . $transcoded_filename;</p>
</blockquote>
<p>You can download a package with all of these files here: <a href="http://itp.nyu.edu/~sve204/mobilemedia/muxtranscoder.zip">http://itp.nyu.edu/~sve204/mobilemedia/muxtranscoder.zip</a></p>
<p>There you have it, we have successfully integrated transcoding into our upload form. Of course, this could be integrated into the parseMailScript just as easily.</p>
]]></content:encoded>
			<wfw:commentRss>http://muxcloud.com/2008/11/09/calling-mux-from-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Calling Mux from Javascript</title>
		<link>http://muxcloud.com/2008/11/09/calling-mux-from-javascript/</link>
		<comments>http://muxcloud.com/2008/11/09/calling-mux-from-javascript/#comments</comments>
		<pubDate>Sun, 09 Nov 2008 05:51:50 +0000</pubDate>
		<dc:creator>Nathan o' Mux</dc:creator>
		
		<category><![CDATA[blog]]></category>

		<category><![CDATA[aws]]></category>

		<category><![CDATA[cloud computing]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[s3]]></category>

		<category><![CDATA[video transcoding]]></category>

		<guid isPermaLink="false">http://muxcloud.com/?p=135</guid>
		<description><![CDATA[Here is a quick, simple example of how easy it is to call Mux using Javascript&#8230; you simply pass in the URL of a video file you would like transcoded and the output mime-type you&#8217;d like to transcode it to. 
function doMuxRequest(mediaUrl, mimeType)
{
   statusUrl = API_ENDPOINT_SIMPLE_XML;
   statusUrl += &#8220;TranscodeMediaUrlRequest?&#8221;;
   [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a quick, simple example of how easy it is to call Mux using Javascript&#8230; you simply pass in the URL of a video file you would like transcoded and the output mime-type you&#8217;d like to transcode it to. </p>
<blockquote><p>function doMuxRequest(mediaUrl, mimeType)<br />
{<br />
   statusUrl = API_ENDPOINT_SIMPLE_XML;<br />
   statusUrl += &#8220;TranscodeMediaUrlRequest?&#8221;;<br />
   statusUrl += &#8220;clr=&#8221; + API_USER_ID + &#8220;:&#8221; + API_USER_KEY + &#8220;&#038;&#8221;;<br />
   statusUrl += &#8220;url=&#8221; + escape(mediaUrl) + &#8220;&#038;&#8221;;<br />
   statusUrl += &#8220;sot=&#8221; + escape(mimeType) + &#8220;&#038;&#8221;;</p>
<p>   initRequest(statusUrl,&#8217;GET&#8217;);</p>
<p>   window.setTimeout(&#8221;doCheckStatus()&#8221;, sleepTimeout);<br />
}</p></blockquote>
<p>The immediate response to this call will a JobID, which you can use to check the status of the transcode, and eventually download the completed output file.</p>
<blockquote><p>function processReqChange() {</p>
<p>    if (req.readyState == 4) {        </p>
<p>		if (req.responseXML.getElementsByTagName(&#8221;jobId&#8221;))<br />
		{<br />
			lastJobId = req.responseXML.getElementsByTagName(&#8221;jobId&#8221;)[0].firstChild.nodeValue;<br />
		}<br />
 }<br />
}</p></blockquote>
<p>This is the most basic use of Mux, but it proves how simple it can be to utilize the cloud. There are many other parameters and functions that can be called, as detailed in the <a href="/developers/guide">Mux Developer Guide</a></p>
<p>You can also view the complete Javascript sample source file here: <a href="http://mux.am/api/samples/to-be-downloaded/javascript/MuxClient.js">MuxClient.js</a></p>
]]></content:encoded>
			<wfw:commentRss>http://muxcloud.com/2008/11/09/calling-mux-from-javascript/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Sample Video</title>
		<link>http://muxcloud.com/2008/11/08/sample-video/</link>
		<comments>http://muxcloud.com/2008/11/08/sample-video/#comments</comments>
		<pubDate>Sat, 08 Nov 2008 17:35:00 +0000</pubDate>
		<dc:creator>Nathan o' Mux</dc:creator>
		
		<category><![CDATA[featured]]></category>

		<guid isPermaLink="false">http://muxcloud.com/?p=109</guid>
		<description><![CDATA[Mux powers the video encoding on the Cruxy Digital Marketplace. Here is a sample set of videos generated on Cruxy.
Typical &#8220;Medium&#8221; Quality  ~700bkps - 600&#215;350 Flash 7


Unalbe to show flash video


More sample video coming soon&#8230;
]]></description>
			<content:encoded><![CDATA[<p>Mux powers the video encoding on the <a href="http://cruxy.com">Cruxy Digital Marketplace</a>. Here is a sample set of videos generated on Cruxy.</p>
<p>Typical &#8220;Medium&#8221; Quality  ~700bkps - 600&#215;350 Flash 7<br />

<object id='monFlash' type='application/x-shockwave-flash' data='http://muxcloud.com/wp-content/plugins/hana-flv-player/template_maxi_1.6.0/template_maxi/player_flv_maxi.swf' width='600' height='350'><param name='movie' value='http://muxcloud.com/wp-content/plugins/hana-flv-player/template_maxi_1.6.0/template_maxi/player_flv_maxi.swf' /><param name='allowFullScreen' value='true' /><param name='FlashVars' value='flv=http://s3.amazonaws.com/openomic/preview/16016&amp;width=600&amp;height=350&amp;autoplay=1&amp;autoload=1&amp;loop=1&amp;showstop=1&amp;showvolume=1&amp;showtime=1&amp;showfullscreen=1&amp;srt=1' />
Unalbe to show flash video

</object></p>
<p>More sample video coming soon&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://muxcloud.com/2008/11/08/sample-video/feed/</wfw:commentRss>
<enclosure url="http://www.cruxy.com/media/preview/16016.flv" length="15814606" type="video/x-flv" />
<enclosure url="http://s3.amazonaws.com/openomic/preview/16016" length="15814606" type="video/x-flv" />
		</item>
		<item>
		<title>&#8220;Free&#8221; Mux.am</title>
		<link>http://muxcloud.com/2008/11/08/muxam-20-beta-release/</link>
		<comments>http://muxcloud.com/2008/11/08/muxam-20-beta-release/#comments</comments>
		<pubDate>Sat, 08 Nov 2008 15:37:38 +0000</pubDate>
		<dc:creator>Nathan o' Mux</dc:creator>
		
		<category><![CDATA[featured]]></category>

		<category><![CDATA[announcement]]></category>

		<category><![CDATA[clouds]]></category>

		<category><![CDATA[grid computing]]></category>

		<guid isPermaLink="false">http://muxcloud.com/?p=5</guid>
		<description><![CDATA[Open Network Television is excited to announce that we&#8217;ve released the 2.0 version of Mux.am - the free, public interface to the Mux Cloud. This new release features a redesigned user interface, the ability to upload files directly for conversion, and an improved set of mobile video options. Behind the beta is the new version [...]]]></description>
			<content:encoded><![CDATA[<p>Open Network Television is excited to announce that we&#8217;ve released the 2.0 version of <a href="http://mux.am">Mux.am</a> - the free, public interface to the Mux Cloud. This new release features a redesigned user interface, the ability to upload files directly for conversion, and an improved set of mobile video options. Behind the beta is the new version of the Mux Cloud, as well, which offers more power and fidelity for online video conversion needs.</p>
<p><a href="http://mux.am"><img src="http://muxcloud.com/wp-content/uploads/2008/11/muxconsumer.jpg" alt="" title="muxconsumer" width="499" height="308" class="alignleft size-full wp-image-112" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://muxcloud.com/2008/11/08/muxam-20-beta-release/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Mux Love from India</title>
		<link>http://muxcloud.com/2008/11/07/mux-love-from-india/</link>
		<comments>http://muxcloud.com/2008/11/07/mux-love-from-india/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 18:30:53 +0000</pubDate>
		<dc:creator>Nathan o' Mux</dc:creator>
		
		<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://muxcloud.com/?p=62</guid>
		<description><![CDATA[Rajeev Edmonds (Pro Blogger, Programmer from New Delhi, India) says on his FreshTechTips.com blog: 

Converting video files from one format to another becomes a necessity at times. Sometimes, we want to reduce the file size compromising on quality, and sometimes our video player doesn&#8217;t support the format. Whatever be the reason, video format conversion software [...]]]></description>
			<content:encoded><![CDATA[<p>Rajeev Edmonds (Pro Blogger, Programmer from New Delhi, India) says on his FreshTechTips.com blog: </p>
<blockquote><p>
Converting video files from one format to another becomes a necessity at times. Sometimes, we want to reduce the file size compromising on quality, and sometimes our video player doesn&#8217;t support the format. Whatever be the reason, video format conversion software are very handy in crunching the video stream and giving them our desired shape.</p></blockquote>
<p>Thanks, Rajeev. Glad we could be of service to you.</p>
]]></content:encoded>
			<wfw:commentRss>http://muxcloud.com/2008/11/07/mux-love-from-india/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Haven&#8217;t heard of Mux?!</title>
		<link>http://muxcloud.com/2008/11/07/havent-heard-of-mux/</link>
		<comments>http://muxcloud.com/2008/11/07/havent-heard-of-mux/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 18:29:04 +0000</pubDate>
		<dc:creator>Nathan o' Mux</dc:creator>
		
		<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://muxcloud.com/?p=60</guid>
		<description><![CDATA[The good bloggers over at MyMobileGeek.com proclaim Mux to be one of the &#8220;best websites you&#8217;ve never heard of&#8221;. I think we&#8217;re flattered&#8230; right?! Hmm&#8230;
From the extremely useful to the ridiculous, these sites should be in everyones favorite RSS reader or Link bar. Here are the top undiscovered web sites of 2008. 
Mux 2.0 - [...]]]></description>
			<content:encoded><![CDATA[<p>The good bloggers over at <a href="http://www.mymobilegeek.com/">MyMobileGeek.com</a> proclaim Mux to be one of the &#8220;best websites you&#8217;ve never heard of&#8221;. I think we&#8217;re flattered&#8230; right?! Hmm&#8230;</p>
<blockquote><p>From the extremely useful to the ridiculous, these sites should be in everyones favorite RSS reader or Link bar. Here are the top undiscovered web sites of 2008. </p>
<p>Mux 2.0 - Convert &#038; Download. Convert videos between any format &#038; save videos forever from popular websites! Upload &#038; Share- Send videos taken with your own digital camera to your friends &#038; family privately. It’s simple and secure! Go Mobile - Send video to your video-enabled mobile phone - including the Apple iPhone! Build Your Own - Use the Developer API to video enable your own sites and applications.</p></blockquote>
<p>We are definitely still getting our publicity act together, so perhaps this is a good kick in the pants!</p>
<p>read on:<br />
<a href="http://www.mymobilegeek.com/2008/11/the-best-web-sites-you-never-heard-of/">http://www.mymobilegeek.com/2008/11/the-best-web-sites-you-never-heard-of/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://muxcloud.com/2008/11/07/havent-heard-of-mux/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Building on Mux</title>
		<link>http://muxcloud.com/2008/11/07/developer-api/</link>
		<comments>http://muxcloud.com/2008/11/07/developer-api/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 18:21:34 +0000</pubDate>
		<dc:creator>Nathan o' Mux</dc:creator>
		
		<category><![CDATA[featured]]></category>

		<guid isPermaLink="false">http://muxcloud.com/?p=55</guid>
		<description><![CDATA[At the core of the Mux services are an open API that you can use to perform transcoding operations on media files of all types. Everything that’s available through the various MUX services is available through the API. Our goal is to make this API as simple as possible, and to support as many different [...]]]></description>
			<content:encoded><![CDATA[<p>At the core of the Mux services are an open API that you can use to perform transcoding operations on media files of all types. Everything that’s available through the various MUX services is available through the API. Our goal is to make this API as simple as possible, and to support as many different users as possible, so we’ll spare you the complex explanations of the internals. Assuming you have your programming language of choice, and it supports XML and HTTP, you will be able to get up and running pretty quickly.</p>
<p><a href="/developers">Learn More&#8230;</a></p>
]]></content:encoded>
			<wfw:commentRss>http://muxcloud.com/2008/11/07/developer-api/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Supported Video Formats</title>
		<link>http://muxcloud.com/2008/11/07/supported-media-types/</link>
		<comments>http://muxcloud.com/2008/11/07/supported-media-types/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 18:20:04 +0000</pubDate>
		<dc:creator>Nathan o' Mux</dc:creator>
		
		<category><![CDATA[featured]]></category>

		<guid isPermaLink="false">http://muxcloud.com/?p=53</guid>
		<description><![CDATA[Mux uses straight mime-types for determining output formats. We have also created a few extension types such as “video/mp4-ipod” for optimizing around a specific device. 

table
{
font-size:10pt;
}
tr
{
border-bottom:1px solid #555;
margin:1px;
}

Supported Mime-Types



Name
Mime Type
File Ext
Description


3G Mobile Video
video/3gpp
*.3gp
mobile phone video


3G2 Mobile Video
video/3g2
*.3g2
3GPP2 (for CDMA-based Phones, may have filename extension .3g2)


Apple iTunes Video
video/m4v
*.m4v
This media file can be played using Apple Quicktime, [...]]]></description>
			<content:encoded><![CDATA[<p>Mux uses straight mime-types for determining output formats. We have also created a few extension types such as “video/mp4-ipod” for optimizing around a specific device. </p>
<style>
table
{
font-size:10pt;
}
tr
{
border-bottom:1px solid #555;
margin:1px;
}
</style>
<h3>Supported Mime-Types</h3>
<table border="0">
<tbody>
<tr>
<th>Name</th>
<th>Mime Type</th>
<th>File Ext</th>
<th>Description</th>
</tr>
<tr>
<td>3G Mobile Video</td>
<td>video/3gpp</td>
<td>*.3gp</td>
<td>mobile phone video</td>
</tr>
<tr>
<td>3G2 Mobile Video</td>
<td>video/3g2</td>
<td>*.3g2</td>
<td>3GPP2 (for CDMA-based Phones, may have filename extension .3g2)</td>
</tr>
<tr>
<td>Apple iTunes Video</td>
<td>video/m4v</td>
<td>*.m4v</td>
<td>This media file can be played using Apple Quicktime, which can be downloaded at <a href="http://www.apple.com/quicktime">http://www.apple.com/quicktime</a>. If you have an iPod or iTunes installed, you have Quicktime.</td>
</tr>
<tr>
<td>Apple Quicktime</td>
<td>video/quicktime</td>
<td>*.mov</td>
<td>This media file can be played using Apple Quicktime, which can be downloaded at <a href="http://www.apple.com/quicktime">http://www.apple.com/quicktime</a>. If you have an iPod or iTunes installed, you have Quicktime.</td>
</tr>
<tr>
<td>DIVX Encoded Video</td>
<td>video/divx</td>
<td>*.divx</td>
<td>This a DIVX encoded video file that can be played using software from <a href="http://divx.com/">http://divx.com</a></td>
</tr>
<tr>
<td>Flash Video</td>
<td>video/x-flv</td>
<td>*.flv</td>
<td>Flash video</td>
</tr>
<tr>
<td>JPEG Image</td>
<td>image/jpg</td>
<td>*.jpg</td>
<td>This image file can be viewed using a compatible image viewer.</td>
</tr>
<tr>
<td>Mobile Phone Audio</td>
<td>audio/amr</td>
<td>*.amr</td>
<td>mobile phone ringtone audio</td>
</tr>
<tr>
<td>MP3 Audio</td>
<td>audio/mp3</td>
<td>*.mp3</td>
<td>This is a standard MP3 file. It can be played back using a variety of software, including <a href="http://www.apple.com/quicktime">Apple Quicktime</a>.</td>
</tr>
<tr>
<td>MPEG Video</td>
<td>video/mpeg</td>
<td>*.mpg</td>
<td>This is a standard MPEG file. It can be played back using a variety of software, including <a href="http://www.apple.com/quicktime">Apple Quicktime</a>.</td>
</tr>
<tr>
<td>OGG Video</td>
<td>application/ogg</td>
<td>*.ogg</td>
<td>Ogg is a patent-free, fully open and standardised multimedia bitstream container format designed for efficient streaming and file compression (storage) by the Xiph.Org Foundation. Download codecs and players for OGG at <a href="http://www.vorbis.com/">http://www.vorbis.com/</a></td>
</tr>
<tr>
<td>Windows AVI</td>
<td>video/avi</td>
<td>*.avi</td>
<td>This media file can be played using Microsoft&#8217;s Windows Media Player available at <a href="http://www.microsoft.com/windowsmedia">http://www.microsoft.com/windowsmedia</a></td>
</tr>
<tr>
<td>Windows Media Video</td>
<td>audio/x-ms-wmv</td>
<td>*.wmv</td>
<td>This media file can be played using Microsoft&#8217;s Windows Media Player available at <a href="http://www.microsoft.com/windowsmedia">http://www.microsoft.com/windowsmedia</a></td>
</tr>
<tr>
<td>MPEG-4 (H.264)</td>
<td>video/mp4-h264</td>
<td>*.mp4</td>
<td>H.264/AAC</td>
</tr>
<tr>
<td>iPod (H.264/AAC)</td>
<td>video/mp4-ipod</td>
<td>*.m4v</td>
<td>iPod optimized video</td>
</tr>
<tr>
<td>PSP MPEG-4</td>
<td>video/mp4-psp</td>
<td>*.m4v</td>
<td>PSP optimized video</td>
</tr>
<tr>
<td>MP4 Mobile</td>
<td>video/mp4-mobile</td>
<td>*.mp4</td>
<td>MPEG-4 optimized for mobile phones</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://muxcloud.com/2008/11/07/supported-media-types/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How Mux Works</title>
		<link>http://muxcloud.com/2008/11/07/how-mux-works/</link>
		<comments>http://muxcloud.com/2008/11/07/how-mux-works/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 17:41:45 +0000</pubDate>
		<dc:creator>Nathan o' Mux</dc:creator>
		
		<category><![CDATA[featured]]></category>

		<guid isPermaLink="false">http://muxcloud.com/?p=33</guid>
		<description><![CDATA[The Mux Transcoding Process is comprised of a series of steps:

Receive the incoming video file either by push (upload) or pull (download from URL link)
Analyze and detect the media type, including codec, size, bitrate and more
Convert the video file into a common MPEG-4-based format
Convert the intermediate file into the request output format, be it video, [...]]]></description>
			<content:encoded><![CDATA[<p>The Mux Transcoding Process is comprised of a series of steps:</p>
<ol>
<li>Receive the incoming video file either by push (upload) or pull (download from URL link)</li>
<li>Analyze and detect the media type, including codec, size, bitrate and more</li>
<li>Convert the video file into a common MPEG-4-based format</li>
<li>Convert the intermediate file into the request output format, be it video, just the audio track or a thumbnail image</li>
<li>Place the output video file onto a protected Amazon S3 bucket, ready for you to transfer back to your server, or serve directly to your user</li>
</ol>
<p>This entire process takes place within the Amazing Web Services computing cloud, utilizing a combination of on-demand processing, infinite storage and powerful, scalable message queues and database storage systems.</p>
]]></content:encoded>
			<wfw:commentRss>http://muxcloud.com/2008/11/07/how-mux-works/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Rev2: &#8220;Super Awesome Video Sharing&#8221;</title>
		<link>http://muxcloud.com/2008/05/05/rev2-super-awesome-video-sharing/</link>
		<comments>http://muxcloud.com/2008/05/05/rev2-super-awesome-video-sharing/#comments</comments>
		<pubDate>Mon, 05 May 2008 16:50:07 +0000</pubDate>
		<dc:creator>Nathan o' Mux</dc:creator>
		
		<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://muxcloud.com/?p=8</guid>
		<description><![CDATA[Tech trend blog Rev2.org used the phrase &#8220;super awesome&#8221; to describe the public Mux.am service, which always makes you feel good:
Mux deals with three basic issues in the video space: coverting, sharing, and mobilizing. More specifically, it can convert videos from URLs that you give to be ready to download to your PC, it makes [...]]]></description>
			<content:encoded><![CDATA[<p>Tech trend blog <a href="http://www.rev2.org/2008/03/04/mux-super-awesome-video-sharing/">Rev2.org</a> used the phrase &#8220;super awesome&#8221; to describe the public Mux.am service, which always makes you feel good:</p>
<blockquote><p>Mux deals with three basic issues in the video space: coverting, sharing, and mobilizing. More specifically, it can convert videos from URLs that you give to be ready to download to your PC, it makes it easy for you to share videos privately with friends and family, and lasty, send videos to your cell phone.</p>
<p>&#8230;</p>
<p>Mux to me seems like what video sharing, or sharing stuff in general, should be on the web these days.  Dead simple, fast, beautiful, easy, elegant, and something that always works. They’ve clearly spotted three equally important and un-served niches, and serve to them brilliantly. A well made product, and it’s usefulness is unquestioned.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://muxcloud.com/2008/05/05/rev2-super-awesome-video-sharing/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
