Download Repository: ZIP Archive (13 MB)
View demo code and example exported movies on the project website: http://horchler.github.io/QTWriter/
========
QTWriter
Create a QuickTime movie writer object.
OBJ = QTWriter(FILENAME)
constructs a QTWriter object to write QuickTime movie data to a “.mov” file using lossless Photo PNG compression. FILENAME
is a string enclosed in single quotation marks that specifies the name of the file to create. If FILENAME
does not include an extension the QTWriter constructor appends the “.mov” extension. FILENAME
can include an absolute or relative path.
OBJ = QTWriter(...,'PropertyName','PropertyValue',...)
specifies options via property name-value pairs. In addition to the default 'Photo PNG'
compression, 'Photo TIFF'
and 'Photo JPEG'
formats can be specified via the 'MovieFormat'
property. Lossless Photo TIFF compression yields larger file sizes than Photo PNG, but is faster (using 'LZW'
or the default 'PackBits'
for the 'CompressionType'
property). Photo JPEG is a lossy format and the 'Quality'
property can be used to specify the level of compression to use. The 'ColorSpace'
property specifies if the movie is to be output as 24-bit RGB truecolor or 8-bit grayscale. The 'Transparency'
property indicates if the movie is to be output with an alpha channel (Photo PNG format only).
Frames are written via the writeMovie(FRAME)
method of the QTWriter object. The frame rate of the movie can be continuously varied via the 'FrameRate'
property of the QTWriter object (see strpenddemo
). The looping behavior of the output movie can be specified via the 'Loop'
property of the QTWriter object: 'none'
, 'loop'
, or 'backandforth'
. Finally, the output movie can be forced to play every frame via the 'PlayAllFrames'
property of the QTWriter object. The close()
method of the QTWriter object is called to finish writing the movie and clean up associated data.
Please refer to the detailed help included within QTWriter
for further details and options.
- Download and expand the QTWriter.zip ZIP archive.
- Move the resultant QTWriter folder to the desired permanent location.
- If you wish to add QTWriter to your Matlab path, navigate to QTWriter/ and run
QTWriter.install()
. This adds the necessary files and folders to Matlab's search path. To uninstall QTWriter, runQTWriter.install('remove')
. - Type
help QTWriter
in the Matlab command window to view the documentation. See below for how to contribute code to the project. Email enquiries of any nature are always welcome.
- Download and expand the QTWriter-master.zip ZIP archive of the full repository.
- Move the resultant QTWriter-master folder to the desired permanent location. Rename this folder if desired.
- If you wish to add QTWriter to your Matlab path, navigate to QTWriter-master/QTWriter/ and run
QTWriter.install()
. This adds the necessary files and folders to Matlab's search path. To uninstall QTWriter, runQTWriter.install('remove')
. - To view and edit the code, type
edit QTWriter
in the Matlab command window. - Two M-files are currently available for testing QTWriter:
qtwriter_unittest
andqtwriter_benchmark
. - Minor edits and bug reports and fixes can be submitted by filing an issue or via email. To add new functionality or make propose major changes, please fork the repository. Any new features should be accompanied by some means of testing. Email or file an issue if you have any questions.
A note about QuickTime Player and OS X 10.9 and later:
A feature in OS X 10.9 causes Photo PNG and Photo Tiff movies encoded using QTWriter to be converted to another format, lossy H.264, when opened with QuickTime Player (Version 10.3 ). This is less of an issue in OS X 10.11 as these formats are converted to lossless Apple ProRes 4444. Options like looping are not preserved in the conversion (and not supportted by Quicktime Player 10 ). A workaround is to use the legacy QuickTime Player 7 for playback. Other media players, e.g., the free VLC, also work, but may not support options like looping. Another workaround is to convert Photo PNG and Photo TIFF movies to the lossless Apple ProRes 422 codec before opening them with QuickTime Player. One way to do this is directly from the Finder using the Encode Selected Video Files context menu option. The resultant files will likely be larger, but options like looping will be preserved when played back using QuickTime Player. A potential enhancement to QTWriter would be to add an option to directly encode to Apple ProRes 422 (and the other ProRes formats). Any code contributions in this are would be welcome.
Andrew D. Horchler, horchler @ gmail . com
Created: 10-3-11, Revision: 1.1, 5-14-14
License: BSD 3-clause license (see below)
QTWriter is inspired by MakeQTMovie
by Malcolm Slaney (Interval Research, March 1999) and
parts are based on the VideoWriter
class in Matlab R2011b.
References:
– MakeQTMovie - Create QuickTime movies in Matlab
– QuickTime File Format Specification
This version tested with:
Matlab 8.1.0.604 (R2013a)
Mac OS X 10.9 Build: 13A603, Java 1.6.0_65-b14-462-11M4609
QuickTime Player Pro 7.6.6 (1709), QuickTime Version 7.7.3 (2826), and QuickTime Player 10.3 (727.1)
Matlab 8.5.0.173394 (R2015a)
Mac OS X 10.10.3 Build: 14D136, Java 1.7.0_60-b19
QuickTime Player Pro 7.6.6 (1709), QuickTime Version 7.7.3 (2890), and QuickTime Player 10.4 (833.6)
Matlab 9.0.0.341360 (R2016a)
Mac OS X 10.11.4 (Build: 15E65), Java 1.7.0_75-b13
QuickTime Player Pro 7.6.6 (1709), QuickTime Version 7.7.3 (2943.3), and QuickTime Player 10.4 (855)
Compatibility maintained back through Matlab 7.4 (R2007a)
Copyright © 2012–2017, Andrew D. Horchler
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of Case Western Reserve University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANDREW D. HORCHLER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.