# AVSLib :: sample script # Copyright (c) 2007 George Zarkadas (gzarkadas@users.sourceforge.net) # This program is free software; you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR # PURPOSE. See the GNU General Public License for more details. # You should have received a copy of the GNU General Public License along with this program; # if not, write to the "Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA" LoadModule("avslib", "filters", "frames") Function ExportFramesReader(clip clp, string framesfile, string "path", string "type", bool "info") { # frames export runtime script FF_EXPORT_READER = """ file = %q type = LCase(%q) info = %b # Overlay is used to avoid colorspace conversion if type != ebmp ${read1} != 0 ? ( \ type == "ebmp" ? \ ImageWriter(last, file, current_frame, current_frame + 1, type, info) \ : \ Overlay(last, ImageWriter(last.ConvertToRGB24, file, current_frame, current_frame + 1, \ type, info), opacity=0, ignore_conditional=true) \ ) : last """ path = Default(path, "frame") type = Default(type, "ebmp") info = Default(info, false) return FrameFilterReader(clp, FF_EXPORT_READER, framesfile, path, type, info) } clp = AVISource("story.avi").ConvertToYUY2 ExportFramesReader(clp, "frames.txt", "reader", "jpeg") Compare(last, clp) # verify that clp is passed through ExportFramesReader untouched