Converting WebEx Video Files to MP4 Format

WebEx logo

I recently used WebEx to record a video conference that I intend to post on YouTube at some point in the future, though getting the video file into a format that is acceptable has not been as straightforward as it should be.

When using WebEx to record video, you can either choose to record on the server or on your computer. I chose to record on the server, then download the file to a PC for format conversion. First of all, in order to play or convert the file, you will need the WebEx Network Recording Player. This is because WebEx files are stored in a proprietary format with the “.arf” extension. I found that downloading the player through the link on the website did not give me the most recent version of the player (29.9.0.10068, as of 10-8-2014), but a version that was a couple of years old. The older version could not play the video I had just recorded, so I had to look for the current version, which I was able to find using these instructions.

Once you have the newest player installed, load the “arf” file and stop it from playing by clicking the stop button. Now you’re ready to convert the file. Use File –> Convert Format –> (whatever format you choose: WMV – Windows Media, SWF – Adobe Flash, or MP4). I chose MP4. This conversion process may take awhile, possible as long as the video is. Here’s where I ran into trouble. I selected the filename which I wanted the destination file to have, and it created that file (empty, at this point) along with a few other temporary files that were used for the conversion process. When the conversion process was complete, the MP4 file was deleted but a file with a seemingly random filename and a “.tmp” extension was left. Due to a bug in the conversion process, no MP4 file was present at this time.

I decided to see if the “tmp” file held the converted video, and fortunately it did. I changed the extension to mp4, and was able to open the file in Windows Media Player. Now, after some editing, I will be able to upload it to YouTube. Success!

Using the PHP explode() Function to Get Text Between Slashes of a URL

PHP logo

In the About.Me widget that I currently have on the right sidebar of this blog, there are quite a few HTML image tags used for the different social networks linked below the photo and bio.  None of these img tags had alt tags, which are used by Web crawlers when indexing websites.  Many SEO experts suggest having alt tags on most image tags, so I decided to fill these with the name of the service and my name.  The original PHP code that generates these icons, which is found in the “aboutme-widget/aboutme-widget.php” file on my WordPress.org site, is here:

foreach ( $data['app_icons'] as $v ) {
echo '<a href="' . esc_url( $v['url'] ) . '" target="_blank" class="am_service_icon" rel="me"><img src="' . esc_url( $v['icon'] ) . '" ></a>';
 }

Emitted HTML:

<a href="http://www.twitter.com/DeepInTheCode" target="_blank" class="am_service_icon" rel="me"><img src="http://dcbdluf1ahqio.cloudfront.net/twitter/32x32.png"></a>
<a href="http://www.linkedin.com/in/deepinthecode" target="_blank" class="am_service_icon" rel="me"><img src="http://dcbdluf1ahqio.cloudfront.net/linkedin/32x32.png"></a>
<a href="http://plus.google.com/101089969483487596905/" target="_blank" class="am_service_icon" rel="me"><img src="http://dcbdluf1ahqio.cloudfront.net/googleplus/32x32.png"></a>

As you can see, the source of the image is stored in the array element “$v[‘icon’]”, and has the format “http://(apparently random string).cloudfront.com/(service name)/32×32.png”.  I wanted to get the service name from each URL.  At first blush, this sounds like a regular expression problem.  However, while it is sometimes necessary, regex is often not the most elegant solution.

The PHP explode() function is perfect for this problem.  Essentially, I needed to build an array of strings from the URL and select the second from the last element of the array.  Since I didn’t need to keep this array intact, I treated it like a stack and used array_pop() to pop off the last two elements.  The code below was inserted into the foreach loop before the echo statement:

$iconarray = explode('/',$v['icon']);
 array_pop($iconarray);
 $servicename = array_pop($iconarray);

For each iteration of the loop, the $servicename variable will now hold the string that is before the last slash in the URL stored in $v[‘icon’].  I also wanted to capitalize the first character in the service name, and add ” profile for David Young” after each service name.  Since my name is stored in the array elements $data[‘first_name’]  and $data[‘last_name’], I used those in modifying the echo statement to make this code reusable by others — or by About.Me, should they decide to incorporate it into future versions of their code.

The complete loop now looks like this:

foreach ( $data['app_icons'] as $v ) {
$iconarray = explode('/',$v['icon']);
array_pop($iconarray);
$servicename = array_pop($iconarray);
echo '<a href="' . esc_url( $v['url'] ) . '" target="_blank" class="am_service_icon" rel="me"><img src="' . esc_url( $v['icon'] ) . '" alt="' . ucfirst($servicename) . ' profile for ' . esc_attr( $data['first_name'] ) . ' ' . esc_attr( $data['last_name'] ) . '"></a>';
 }

Emitted HTML:

<a href="http://www.twitter.com/DeepInTheCode" target="_blank" class="am_service_icon" rel="me"><img src="http://dcbdluf1ahqio.cloudfront.net/twitter/32x32.png" alt="Twitter profile for David Young"></a>
<a href="http://www.linkedin.com/in/deepinthecode" target="_blank" class="am_service_icon" rel="me"><img src="http://dcbdluf1ahqio.cloudfront.net/linkedin/32x32.png" alt="Linkedin profile for David Young"></a>
<a href="http://plus.google.com/101089969483487596905/" target="_blank" class="am_service_icon" rel="me"><img src="http://dcbdluf1ahqio.cloudfront.net/googleplus/32x32.png" alt="Googleplus profile for David Young"></a>