diff options
author | scuri <scuri> | 2010-06-25 23:19:38 +0000 |
---|---|---|
committer | scuri <scuri> | 2010-06-25 23:19:38 +0000 |
commit | 052057cf14a565ec2ef6adcdc55752406d0c204b (patch) | |
tree | daa42b0dae0ee616ed4a963aeb258dd3a91e2797 /html/examples/makevideo.lua | |
parent | d14b0d38973e062dcac4de46705ce63c9d33cafe (diff) |
*** empty log message ***
Diffstat (limited to 'html/examples/makevideo.lua')
-rw-r--r-- | html/examples/makevideo.lua | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/html/examples/makevideo.lua b/html/examples/makevideo.lua new file mode 100644 index 0000000..1cb52fc --- /dev/null +++ b/html/examples/makevideo.lua @@ -0,0 +1,56 @@ +-- lua5.1 makevideo.lua newfile.wmv DSC0*.jpg + +require"imlua" +require"imlua_wmv" + +err_msg = { + "No error.", + "Error while opening the file.", + "Error while accessing the file.", + "Invalid or unrecognized file format.", + "Invalid or unsupported data.", + "Invalid or unsupported compression.", + "Insuficient memory", + "Interrupted by the counter", +} + +-- Margin parameters +new_filename = arg[1] +filename1 = arg[2] +if (not new_filename or not filename1) then + error("invalid parameters") +end + +function ProcessImageFile(file_name, ifile) + print("Loading File: "..file_name) + local image, err = im.FileImageLoad(file_name); + if (err and err ~= im.ERR_NONE) then + error(err_msg[err+1]) + end + + err = ifile:SaveImage(image) + if (err and err ~= im.ERR_NONE) then + error(err_msg[err+1]) + end + + image:Destroy() +end + +ifile = im.FileNew(new_filename, "WMV") + +ifile:SetAttribute("FPS", im.FLOAT, {15}) -- Frames per second + +file_count = 0 +for index,value in ipairs(arg) do + if (index > 5) then + ProcessImageFile(arg[index], ifile) + file_count = file_count + 1 + end +end + +ifile:Close() + +if (file_count > 1) then + print("Processed "..file_count.." Files.") +end +print("Saved File: "..new_filename) |