Phantom Pillar Mac OS
When I first heard the name PhantomJS, I thought it was another Javascript framework or library, like AngularJS or NodeJS. I came to know how different it was once I studied more about it. In this blog, we are going to dive into what PhantomJS is and its many possibilities.
Halo: Combat Evolved “Halo: Combat Evolved! That's an order, soldier!” Halo: Combat Evolved, also known as Halo 1 or Halo: CE, is a First-person shooter science-fiction video game, created by Bungie Studios, which was a subsidiary of Microsoft Game Studios at that time. It was released for the original Xbox game console on November 15, 2001, and is backward. Platform: Windows, Mac OS, Linux, Steam, iPhone, Android. Type: GxB, visual novel, voice acting. Commercial with a demo 'Sakuya Morita always thought that her situation would have been better if she was born a man. One day, she is given the chance to try the new attraction at the Dream World virtual theme park, called the East Tower.
What is PhantomJS?
Phantomjs.org, the official PhantomJS website, describes it as “A headless WebKit scriptable with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.”
In simple words, we can say that PhantomJS is a browser without a GUI, but with the JavaScript API built in. The execution of PhantomJS happens at the command prompt. Using PhantomJS, we can load a web-URL, manipulate DOM, take screenshots, read/write files, and perform many more useful things. It can be easily integrated into Continuous Integration (CI) tools and can help us in website headless testing.
PhantomJS is an open source and free software and is distributed under the BSD license. Its first version was released in April 2011.
Use Cases
Page Automation: We can use PhantomJS to load and manipulate a web page, and to perform operations like DOM manipulation, clicking on buttons, etc. We can also include jQuery on a web page using page.include JS, which allows us to automate all interactions with a web page without having to open a browser.
Screen Capture: PhantomJS can be used to take screenshots of web pages. It can also capture the screen on display of SVG files, images, and Canvas elements. These screenshots can be rendered in different formats like PDF, JPEG, PNG, and GIF.
Network Monitoring: With the help of PhantomJS, we can monitor the network and validate the behavior and performance of a particular webpage. It is suitable to analyze network behavior and performance. We can hook into PhantomJS during a request-response cycle and collect data about the website. This data can then be reformatted, which allows us to check the performance of a webpage.
Headless Web Testing: PhantomJS is not a testing library, but many other popular testing libraries can run on top of it. PhantomJS test runners are available for pretty much every testing library you might want to use, including Mocha, Jasmine, and Qunit. It can run tests cases and show the result on the command line.
Features
- Multi-Platform: It is available on all major operating systems like Windows, Mac OS X, Linux, and other Unix.
- Fast and native implementation of web standards: DOM, CSS, JavaScript, Canvas, and SVG. No emulation!
- Pure headless: This is ideal for continuous integration systems. It also runs on Amazon EC2, Heroku, and Iron.io.
- Easy to install and use: Download, unzip and start using it.
Download and Installation
First, we need to install PhantomJS on our machine. Go to the download page of the PhantomJS official website, where you can download the .zip file according to your OS. Different versions are available for Windows, Mac, and Linux.
Once downloaded, unzip it, and you will find the following files:
Go to the 'bin' folder and check phantomjs.exe file. If you are using it on a Windows OS, then you can set the path variable under the environment variable for fast access through command prompt.
To check if it is working correctly, open the command prompt and execute the following command to check its version: C:> phantomjs --version
The command to run the PhantomJS program: C:> phantomjs [options] file.js arg1 arg2 …
Now create a simple program just to display a message and see how to execute it:
Create a file with the following line of code:
console.log(‘Hi, PhantomJS!’);
phantom.exit();
Save the file with the name 'HiPhantom.js'
In the above program, “phantom.exit()” is used to exit the script. If you don’t execute it, then the command prompt will think that the program is still executing.
To execute the program, go to the directory where you stored the file and execute the following command: C:> phantomjs HiPhantom.js
Screen Capture Example
Now let’s take another example to take a screenshot of a website.
Create a file and write the following code:
Save the file with the name 'TakeScreenShot.js'
Execute the program using the following command: C:> phantomjs TakeScreenShot.js
It will take few seconds to execute and generate a PDF file in the same directory where your JS file is stored.
Output:
Explanation:
The 'require('webpage').create()' command creates a webpage object. Using this object, we can open and manipulate a webpage. In the code shown, we used a webpage object to open the http://phantomjs.org website and then used the render function to take a screenshot and render it into a PDF format.
Page Automation Example
Create a file with name “PageAutomation.js” and write following code:
In the above program, we are opening Google's home page and taking a screenshot of it. Then, we are using the 'this.evaluate()' function to perform a certain event on webpage; in this example, we are clicking the “I’m Feeling Lucky” button. Inside the 'evaluate()' function, we can perform any type of action, like DOM manipulation or fire an event, like button click. The function will finish by taking a screenshot of the current state of the webpage. So after execution of this program, you will get two .PNG screenshots of the webpage's different states.
Execute the above program:
The output:
Before execution
and after execution.
Summary
In this post, we got to know about PhantomJS and its use cases and features, and explored some practical examples of how to use it. There are a lot of other possibilities, but they are difficult to cover in a single post. For example, PhantomJS provides many modules like WebPage, FileSystem, System, and WebServer. It also provides various objects and methods. In addition to this, you also get an example directory with the installation package, which contains a good number of examples of different use cases of PhantomJS. I recommend exploring the many possibilities offered by PhantomJS.
Vision Research’s Phantom cameras have almost no competition in the ultra high-speed digital cinema realm. And their newest line of cameras — the Miro M-Series — continue that dominance.
Unfortunately, shooting Phantom means dealing with a clunky workflow. Specifically, a PC-based workflow because Vision Research doesn’t provide Phantom support to Macs. That’s not a problem for some, but it can be for those used to pushing their footage through a Mac pipeline.
So you have two options if you want to use a Miro with a Mac: either pay for some plugins or use this free method I’m going to show you today. If you want to pay, stop reading and go here.
But if you think free sounds pretty nice, keep on reading and I’ll show you how to read, write, transfer, and re-format the CineFlash hard drives used with the Miro on your Max OS X system.
Problems with Phantom Miro Workflow and OS X
Before we get into the nitty gritty of file systems and command lines, it’s important to take a look at the production workflow of the Phantom Miro.
The Miro shoots exclusively to a proprietary SSD created by Vision Research called the CineFlash. It’s available in sizes of 60 GB, 120 GB and 240 GB. Though it sits inside the camera body, it is removable and works a lot like a memory card.
The way the camera is able to shoot such high-speed footage is by saving recorded clips — called Cine’s — to its internal RAM first before transferring the Cine’s to the CineFlash. When triggered to record again, the internal RAM of the Miro is wiped while saved Cine’s rest safely on the CineFlash.
To get your Cine files started in the post-production workflow, you have to get them from the CineFlash onto a computer.
In a PC environment, this is fairly simple. You can connect the camera directly over ethernet to transfer, review, and delete Cine files using included Phantom software. You also have the option of using the CineFlash dock — a standalone dock with eSata out.
With a Mac, you’re limited to the dock — Phantom doesn’t make software for OS X.
Should be simple then, right? Just plug in the CineFlash dock and open Finder…
Well, it’d be nice if it were that simple, but the CineFlash is formatted in a Linux standard EXT2 file system which is not natively supported by OS X. (To be fair, it’s not natively supported by Windows either, but adding support is easier.)
So the trick is to get your Mac to recognize EXT2 drives and thus work with the CineFlash.
It’s fairly straightforward, but it does involve installing some freeware and messing with system files via command-line code. Don’t worry though — I’m going to provide step-by-step instructions and nothing you’ll be doing is destructive to your system.
Let’s begin…
Installing the Right Software to Access the CineFlash
When Googling for solutions to mount EXT2 formatted drives on OS X, I found this article that has you install two things: OSXFUSE and a compatible plugin for it. Both are free, safe, and work with multiple versions of OS X from Snow Leopard (10.6) to Lion (10.7) and Mountain Lion (10.8).
Go ahead and install them on your computer.
Once installed, you can plug in the dock and the CineFlash will show up in Finder. You’ll be able to read the drive and copy files, but you won’t be able to write to it.
To enable write access, follow these instructions below:
- Open Finder
- Go to Macintosh HD > System > Library > Filesystems
- Right click on “fuse-ext2.fs” and select “Show Package Contents”
- In the new window, right click on “fuse-ext2.util” and choose “Get Info”
- At the bottom under “Sharing & Permissions,” make all the privilege’s Read & Write
- Now open the “Terminal” app found in Applications > Utilities
- Type “vi /system/library/filesystems/fuse-ext2.fs/fuse-ext2.util”
- Type “207G” — Note: capitalization matters here!
- Change OPTIONS=”auto_xattr,defer_permissions” into OPTIONS=”auto_xattr,defer_permissions,rw+” by navigating your cursor with the arrow keys and typing.
- Once done, press the escape key
- Type “:wq!” and press enter
If you already have the drive mounted when you do this, you’ll have to eject it and remount. I also recommend you restart your computer. You should now be able to read and write to the CineFlash.
Now, we’re almost done…
I just want to warn you of an issue that cropped up for me — deleting files off the CineFlash.
Reformatting CineFlash Drives on OS X
Having never worked with a Phantom before, I’m used to formatting hard drives within cameras. The camera reformats the media and ensures the correct filesystem is in place. Sometimes they’re picky — if you reformat a drive or card outside of the camera, it may not be compatible.
As far as I know, there is no way to reformat a CineFlash on the Miro. And I found no information about reformatting a CineFlash to shoot with the Miro except what filesystem it uses.
This wasn’t an issue until I noticed CineFlash files placed in my Mac’s trash weren’t being deleted.
When I went to continue shooting, the Miro told me the CineFlash was full even though Finder showed no files after emptying the trash. I plugged the dock into a Windows 7 PC and, again, nothing was there. I tried enabling hidden files on both systems and I still found nothing.
But despite the non-existence of these files, both computers and the camera reported the disk as full.
Eventually, Disk Utility revealed there were 17 files… somewhere. With a full disk and no way to delete the files that were (but weren’t) there, I had no choice but to reformat the CineFlash.
I was terrified. I was worried reformatting would make the drive irreversibly incompatible.
I held my breath, hit the button and…. it worked!
So, here’s how to do it…
- Open “Disk Utility” from your Applications > Utilities folder
- On the left sidebar, highlight the CineFlash disk
- On the top, choose the “Erase” tab
- Select “fuse-ext2” under Format and input your desired name for the drive
- Click “Erase…”
Phantom Pillar Mac Os X
This will safely re-format the drive with the Ext2 filesystem compatible with the Phantom Miro. It’s also more reliable for erasing files than dragging them into the Trash.
Shooting Phantom to Edit on Mac
Once you have set up your Mac to be compatible with EXT2 drives, you’ll be able to read, write, and reformat CineFlash drives on several versions of OS X from Snow Leopard to Mountain Lion.
But what if you’re a bit uncomfortable taking the steps I outlined above? You can still buy this plugin from Paragon for $40 that enables the same capabilities.
Also, if you’re working with a stock Mac, you won’t have an eSata port to connect to the CineFlash dock. In that case, purchase either an eSata to USB 3.0 cable or eSata to Thunderbolt adapter.
Mac Os Mojave
Vision Research doesn’t make it easy to shoot Phantom and edit Mac — and from what I’ve heard, have no plans to ease the pain — so if you want to continue the Phantom workflow on a Mac, you’re going to have to shell out $800 for GlueTools’ Phantom Cine toolkit.
Mac Os Download
That price is steep for some, but at least you’ll be able to backup your Cine files while you scrounge up the money it takes to edit your Phantom footage on a Mac.