Showing posts with label mac os x. Show all posts
Showing posts with label mac os x. Show all posts

Monday, January 28, 2013

Stream Videos From Mac To AppleTV Without iTunes

I have been looking for a solution to stream videos from my iMac to Apple TV without needing to use iTunes.

I don't like to keep vidoes in iTunes because my iTunes library is already rather unwieldy. Adding gigabytes of videos to it, and then subjecting the bloated thing to Time Machine backup? Does not sound like fun. I could opt to not copy the videos into my iTunes library when I add them, but that same setting will apply to my music as well. No joy there. So how can I stream these videos?

First there was AirFlick, but that stopped working with Lion. Then I thought perhaps Mountain Lion's AirPlay Mirroring would do the trick, except my iMac isn't recent enough to use it. Bummer. I even purchased a copy of AirParrot to wirelessly use an AppleTV connected HDTV as a second monitor to a MacBook when it's in the same room as the TV. But no joy to streaming videos stored on an iMac, which is in an adjacent room.

Then a solution hit me. Here is what I did to set things up:

  1. Open Termninal, and create a symbolic link under /home/me/Sites/Videos, pointing to where I have my videos stored.
  2. Edit /etc/apache2/users/me.conf thusly (sudo required):
  3. # Adding the "*" at the end enables the server to serve up sub-directories.
    <Directory "/Users/me/Sites/*">
        Options Indexes MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
    
  4. Go to System Preferences > Sharing, and turn on Web Sharing.
  5. Turn on and configure AirPlay on my AppleTV.

Now, whenever I want to watch a video stored in my iMac on my HDTV, I just:

  1. Open up Safari on an iOS device, and browse to http://myimac.local/~me/videos. Better yet, bookmark it.
  2. From the simplistic index page generated by Apache, choose a video to play.
  3. Once the video starts to play on my mobile device, tap on the AirPlay icon and choose AppleTV.
  4. In a few seconds, the video will start playing on the AppleTV. At this point, I can use the Remote app or the Apple Remote to control the playback on AppleTV.

This solution works perfectly, except for when my iMac is asleep. To overcome this, I installed the free mWOL app on my iOS devices and configured them to be able to remotely wake up the iMac as needed to stream videos.

By the way, the last two steps about choosing AirPlay to AppleTV are optional, especially when using an iPad.


Sunday, January 27, 2013

Stitching Together .m4v Files on OS X Lion

So I have a bunch of segmented .m4v files that I wanted to join together into one single file. A bunch of googling & experimentation later, I came across this solution:

  1. Download the most recent/stable version of GPAC, mount the disk image, and drag the application into the /Applications folder. Then, unmount the image.
  2. Open Terminal, and cd into the directory where my video files are.
  3. Suppose my files are named 1.m4v, 2.m4v, and 3.m4v, etc. Execute the following commands:
    • /Applications/Osmo4.app/Contents/MacOS/MP4Box -force-cat -cat 1.m4v movie.m4v
    • /Applications/Osmo4.app/Contents/MacOS/MP4Box -force-cat -cat 2.m4v movie.m4v
    • /Applications/Osmo4.app/Contents/MacOS/MP4Box -force-cat -cat 3.m4v movie.m4v
    • ... and so on ...

Voila! Now I can just play the one file instead of having to either playing each one individually to creating some sort of play list to do so.

Monday, December 15, 2008

Faster New Terminal Tab/Window Scripts

Reader Eric Allen commented on a shell script he's written to create new terminal tabs in Leopard faster. Very cool.

Thanks, Eric!

Friday, December 5, 2008

Passenger Rocks!

I am referring to, of course, to Phusion Passenger, a.k.a. mod_rails.

Prior to using Passenger, I had been serving up a Rails web application I've been working on using mongrel. However, I am anticipating more people hitting it (compared to just me and one other person), so I thought it's time to move up to something more robust.

The server platform I am using is the latest version of Tiger (client edition). I already have MacPorts installed in order to get Ruby and Rails. So, after installing Apache 2 using the port command, I simply followed the instructions on Passenger's web site and installed the passenger gem and the Apache module, and was serving up my application via a sub-URI in very little time. This is significant because I am not very versed in Apache configuration!

One suggestion. If you are using Tiger, don't bother following the link from the Passenger documentation to some guy's blog about setting up Passenger for Leopard. Just stick to the official docs.

As for performance relative to mongrel, it remains to be seen when the app is under some load. But when I first practiced this on an ancient 400MHz G4 running Tiger, I noticed a 2x jump in performance. That is, Apache2+Passenger with one user hitting the server is able to serve up pages twice as fast as a single instance of mongrel (using the -d -e production flags) with only one user. The same can't be said of the actual deployment machine, both serving methods yielded similar times for the one-user test.

Furthermore, after I figured out the deployment steps, I wrote a simple Python script to automate it. Yes, I know I can use capistrano. But my deployment scenario is to simple right now that I simply don't need it.

One note on deployment. After you execute sudo apachectl start (or restart), it takes a long time to load the first page. That's probably when Apache is loading stuff into memory. After, it's all good. So I added a curl command as the last step to my deployment script to kick-start things.

Sunday, March 30, 2008

Time Machine Bug

My Leopard installation seemingly choked sometime in December after a software upgrade. Apparently, as a co-worker informed me later, the "fix" was to boot into safe mode, and then reboot again normally. Since I didn't know better at the time, I decided to perform a restore from Time Machine.

Afterwards, I began noticing certain weirdness that would crop up every once in a while with postfix. It happened again just now, where postfix was complaining really loudly into system.log the following message:

postfix/master[4751]: fatal: open lock file pid/master.pid: cannot create file exclusively: No such file or directory
Great.

Doing a man master told me that it is expecting the /var/spool/postfix/pid directory to exist. After I created it manually via sudo, I thought all would be well, until I saw that the error messages changed to this:

postfix/master[5266]: fatal: fifo_listen: create fifo public/pickup: No such file or directory
Doh!

This time, trolling around Google turned up this tip by Felix Geisendörfer on how to re-create files and directories not backed up by Time Machine.

After running sudo /etc/postfix/post-install create-missing, all is well.

Thanks, Felix!

Tuesday, March 18, 2008

Themed Leopard Terminal Scripts

I've updated Ruby scripts for Leopard's Terminal such that you can now optionally specify a setting (or theme) for the new tabs and windows created via a "-s" command-line option.

You can download the new scripts here.

Thursday, March 6, 2008

Updated Ruby Scripts for Leopard's Terminal

I now have two scripts I find useful when working within Leopard's Terminal. One is to open one or more tabs within the current window, and the other is to open one or more windows. The key advantage these scripts give you over hitting Command-T or Command-N on the keyboard is that you get to specify what directories the new tabs and windows start off in. The default is the directory you are in when either script is run.

Furthermore, both scripts now apply the current settings to the new tabs and windows created. For example, if I am working inside a terminal session using the "Grass" settings, new tabs and windows created using my scripts will have the same settings applied to them. Tabs opened using my earlier script always got the settings you've marked as default.

As before, these scripts make use of the rb-appscript gem.

Monday, February 18, 2008

New Terminal Tab Script for Leopard

My favorite tool for quickly opening a terminal window to a particular directory under Tiger is Marc Liyanage's Open Terminal Here toolbar script.

Now that I am running Leopard, most times I find myself wanting to open a new tab instead. This enhanced toolbar script fits bill, if I am staring at the folder within the Finder.

But, most of the time I find myself staring at a Terminal window, already in the directory I want the new tab to be in. Switching to the Finder in order to find the folder and then clicking on a toolbar button just doesn't cut it for me.

So, based on Solomon White's work, I came up with a similar Ruby script. Under tcsh, I set up an alias named nt pointing to the script. When invoked without any arguments, the script opens a new tab pointing to the same directory as the current one. If one or more directory paths are supplied as arguments, a new tab is opened for each one, placed into the corresponding directory.

The script works fine for me under 10.5.2. Feel free to download it for yourself. Note that the rb-appscript gem needs to be installed as a prerequisite.

Wednesday, November 28, 2007

Freeciv 2.1.1 GTK on Quartz, No Go!

As mentioned in the previous post, my Tiger installation got corrupted, and I had to start over. This gave me a chance to do a fresh install of MacPorts. When I saw this post, I decided to give it a go with Freeciv 2.1.1 to see if the GTK game client can also live without X11. I was half-expecting it work. But, it didn't work, which surprised me a bit. I mean, how can Freeciv be more complicated than Gimp?

In any case, I hope to publish the PowerPC version of Freeciv 2.1.1 soon.

Monday, November 12, 2007

Programmatically Determine Mac OS X Version Number

So when I decided to modify my Freeciv launcher to behave according to the version of Mac OS X it is running on top of, I needed a programmatic way to get at the OS version at run-time.

I read in Xcode 2.x's documentation that the best way seems to get it out of the file /System/Library/CoreServices/SystemVersion.plist. Even though it is a plain-text XML file, I didn't just parse it via brute-force and get at the number. So I had to parse it properly. It turns out to be pretty easy.

NSString * text = [NSString stringWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"];
NSDictionary * plist = [text propertyListFromStringsFileFormat];
NSString * productVersion = [plist valueForKey:@"ProductVersion"];

Three lines of code, and I can get at the strings such as 10.4.9 for Tiger and 10.5 for Leopard. Simple. I like it.

Friday, November 9, 2007

Leopard's X11 is Funky

From reading Ars Technica's review of Leopard, I knew something Leopard's X11 is different, but I didn't understand enough of the details to know how different until I looked into why my launcher is not working.

See, when you run my Freeciv launcher application and click on Run Freeciv, it ultimately executes the following command:

open -a X11 ~/Library/Application\
Support/Freeciv/2.1.0/run-freeciv.py

Under Tiger, this command launches X11 if it is not running, and causes the run-freeciv.py script to run, which in turns launches the GTK game client.

However, under Leopard, the same command launches X11 if it is not running, brings up an xterm window (with the strange title of "-xterm"), but the Python script does not run.  This is why my earlier post for the workaround works, because what you are doing is picking up where X11 left off.

I have filed this as a bug with Apple.  In the meantime, I will look into an alternate way to kick off the game client from within my launcher.

Wednesday, November 7, 2007

Getting Freeciv 2.1.0 to work on Leopard

Reader "j" commented that he is unable to get Freeciv 2.1.0 to run on Leopard. I concur. There is an issue. Until I get around to address it, here's a workaround.

First of all, if you haven't yet done so, run the Freeciv application, set your options as you like it, and click Run Freeciv. An xterm window will open, but not much else.

Then, click on the xterm window to bring it to the foreground, and execute the following command:

~/Library/Application\ Support/Freeciv/2.1.0/run-freeciv.py

This should launch the actual game client. This workaround is working on my 24" iMac running Leopard, and sound support is functional.

Let me know how it turns out for you.

Leopard Landing


So I received my copy of Leopard two days ago via Apple's up-to-date program for this big cat via FedEx Ground. I was expecting a retail box with the fancy hologram graphic. Instead, I get a plain, padded envelope containing the DVD and a small manual. A bit disappointing, but oh well.

It is my habit to always perform a clean install whenever I upgrade. This time is no different. I just had to make sure I can re-install iLife '08 on top afterwards. A co-worker did it, except he had to run Software Update after installing the application suite to get the Leopard-compatible versions.

Having read in Ars Technica's review its scathing criticism of Leopard's Finder, I was curious as to how it would be like for me. Having used it for the past two days, I must concur.

Nonetheless, I was impressed by the overall speed of Leopard's user interface. I am glad I opted for an iMac over a Mac mini for the more powerful graphics capabilities Leopard is offloading to the GPU. I am betting my iMac will run future versions of Mac OS X better than a mini. If you are running Leopard on a mini, I would like to hear about your experience with Leopard.

Moving along, the lack of support for Time Machine over a networked volume is rather disappointing. I read/hear a lot of complaints about its inability to backup large files (Entourage databases, virtual machine disk images, etc.) efficiently. But my experience with other backup mechanisms tells this is an issue with them, too, no? Maybe ZFS will help. But I am not holding my breath for it to happen within the 10.5.x timeframe. It seems like too big a change to put into a point release. I do, however, believe Apple should be responsible for trying its hardest to get Time Machine to work withe networked volumes, if what everyone says about it being pulled late in the beta process is true. Technically Apple isn't obligate, unless someone wants to take some class action along the lines of Mac OS X's failure to fully support G3 machines (see here and here). It's more of a goodwill, thing.

Cover Flow within the Finder is interesting, although it frustrated me at first. I downloaded several desktop backgrounds from interfacelift.com, which rendered nicely when viewed using Cover Flow. But when I copied some family photos from my old Mac (which was stored outside of iPhoto), the Cover Flow images looked pixelated and ugly. Then I found out from this forum
that I needed to remove the custom icons from these files. This worked, but it also modified the modification timestamp on my pictures, which many programs use to track when the picture was taken. Hmm. Maybe I'll try iPhoto. More on this in a future post.

Lastly, I installed Xcode 3.0 and did some brief reading on Objective-C 2.0. Sounds interesting.

There is a lot more to do to get my digital life onto the new Mac. Heck, I haven't even gotten E-mail set up yet. So much to do, so little time...

Cheers!

Saturday, November 3, 2007

Freeciv 2.1.0 Released

Freeciv 2.1.0 was released on the 27th of October. I finally got my act together and put up my Mac OS X package. You can download it here.

Even though I am writing this entry from my new 24" Core 2 Duo iMac, I am not planning on releasing an Intel version running on Tiger. My copy of Leopard is on its way, and I plan to start work on a Intel Leopard version once I have 10.5 installed.

My work on Freeciv relies heavily on MacPorts and requires X11. However, reports of compatibility issues between MacPorts and Leopard may trip things up for me. Furthermore, I also came across reports of changes in Leopard's X11 implementation that aren't backwards compatible with Tiger.

If these two things turn out to be showstoppers, I might looking into the SDL client as an alternative, since someone was able to build it on Tiger without MacPorts nor X11.

We will see...