Hey all, first post so I'll make it a good one
.
I have written a script to pull a frame image from a QuickTime Movie. It works great on Snow Leopard and Leopard, but I get different results on Snow Leopard Server. When pulling on the non-server OS I get the frame at the specified time. However when I execute the exact same script with the exact same movie on SL Server I get a completely black frame (not sure if its black because of an error or because its pulling the first frame - which happens to be black). Would you mind taking a look at my code and see if I'm doing anything wrong? Has anybody else experienced weird results with QTKit on SL Server?
EDIT: Also works on Leopard Server
The script is written in Ruby so I apologize if its a little hard to read for you Objective-C people. Same commands, just slightly different syntax
. I appreciate the help!
require "osx/cocoa"
include OSX
OSX.require_framework 'QTKit'
# set the save path
savePath = "test.png"
# set the time code
timeCode = 889
# initailize the movie
qtmovie = OSX::QTMovie.alloc.initWithFile_error("movie.mov", nil)
# determine the timescale of the movie
timeScale = qtmovie.attributeForKey('QTMovieTimeScaleAttribute')
# build a QTTime object using the timeCode and the timeScale
time = OSX::QTMakeTime(timeCode, timeScale)
# pull the frame
frame = qtmovie.frameImageAtTime_withAttributes_error(time, {QTMovieFrameImageType => QTMovieFrameImageTypeNSImage}, nil)
# save the frame
bitmapRep = OSX::NSBitmapImageRep.alloc.initWithData(frame.TIFFRepresentation)
blob = bitmapRep.representationUsingType_properties(NSPNGFileType, nil)
blob.writeToFile_atomically(savePath, false)
I have written a script to pull a frame image from a QuickTime Movie. It works great on Snow Leopard and Leopard, but I get different results on Snow Leopard Server. When pulling on the non-server OS I get the frame at the specified time. However when I execute the exact same script with the exact same movie on SL Server I get a completely black frame (not sure if its black because of an error or because its pulling the first frame - which happens to be black). Would you mind taking a look at my code and see if I'm doing anything wrong? Has anybody else experienced weird results with QTKit on SL Server?
EDIT: Also works on Leopard Server
The script is written in Ruby so I apologize if its a little hard to read for you Objective-C people. Same commands, just slightly different syntax
require "osx/cocoa"
include OSX
OSX.require_framework 'QTKit'
# set the save path
savePath = "test.png"
# set the time code
timeCode = 889
# initailize the movie
qtmovie = OSX::QTMovie.alloc.initWithFile_error("movie.mov", nil)
# determine the timescale of the movie
timeScale = qtmovie.attributeForKey('QTMovieTimeScaleAttribute')
# build a QTTime object using the timeCode and the timeScale
time = OSX::QTMakeTime(timeCode, timeScale)
# pull the frame
frame = qtmovie.frameImageAtTime_withAttributes_error(time, {QTMovieFrameImageType => QTMovieFrameImageTypeNSImage}, nil)
# save the frame
bitmapRep = OSX::NSBitmapImageRep.alloc.initWithData(frame.TIFFRepresentation)
blob = bitmapRep.representationUsingType_properties(NSPNGFileType, nil)
blob.writeToFile_atomically(savePath, false)