/*
* Files2MovExample.java
*
* Created on October 16, 2006, 10:43 PM
*
* <p>Title: Jim2mov</p>
*
* <p>Description: Create movies from image files</p>
*
* <p>Copyright: (C) Copyright 2005-2006, by Andre' Neto</p>
*
* Project Info: http://jim2mov.sourceforge.net
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library 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 Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
* </p>
*
* @author Andre' Neto
* @version 1.0.0
*
*/
package org.jim2mov.test;
import java.io.File;
import java.io.IOException;
import org.jim2mov.core.DefaultMovieInfoProvider;
import org.jim2mov.core.FrameSavedListener;
import org.jim2mov.core.ImageProvider;
import org.jim2mov.core.Jim2Mov;
import org.jim2mov.core.MovieInfoProvider;
import org.jim2mov.core.MovieSaveException;
import org.jim2mov.utils.MovieUtils;
/**
*
* @author andre
*/
public class Files2MovExample implements ImageProvider, FrameSavedListener
{
private String[] files = null;
private int type = MovieInfoProvider.TYPE_QUICKTIME_JPEG;
/**
* Creates a new instance of Files2MovExample
*/
public Files2MovExample(String[] files, int type, String saveFileLocation)
{
this.files = files;
this.type = type;
DefaultMovieInfoProvider dmip = new DefaultMovieInfoProvider(saveFileLocation);
dmip.setFPS(1);
dmip.setNumberOfFrames(files.length);
dmip.setMWidth(320);
dmip.setMHeight(240);
try
{
new Jim2Mov(this, dmip, this).saveMovie(type);
}
catch(MovieSaveException mse)
{
mse.printStackTrace();
}
}
public void frameSaved(int frameNumber)
{
System.out.println("Saved frame: " + frameNumber);
}
public byte[] getImage(int frame)
{
try
{
return MovieUtils.convertImageToJPEG(new File(files[frame].trim()), 1.0f);
}
catch(IOException ioe)
{
ioe.printStackTrace();
}
return null;
}
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
new Files2MovExample(args, MovieInfoProvider.TYPE_QUICKTIME_JPEG, "Test.mov");
}
}
Jim2Mov-开源
需积分: 20 163 浏览量
2021-06-27
19:20:49
上传
评论
收藏 2KB ZIP 举报
EngleSEN
- 粉丝: 47
- 资源: 4502
最新资源
- Win64OpenSSL-3-3-0.exe
- 课高分程设计-基于C++实现的民航飞行与地图简易管理系统-南京航空航天大学
- 航天器遥测数据故障检测系统python源码+文档说明+数据库(课程设计)
- 北京航空航天大学操作系统课设+ppt+实验报告
- 基于Vue+Echarts实现风力发电机中传感器的数据展示监控可视化系统+源代码+文档说明(高分课程设计)
- 基于单片机的风力发电机转速控制源码
- 基于C++实现的风力发电气动平衡监测系统+源代码+测量数据(高分课程设计)
- 毕业设计- 基于STM32F103C8T6 单片机,物联网技术的太阳能发电装置+源代码+文档说明+架构图+界面截图
- 基于 LSTM(长短期记忆)(即改进的循环神经网络)预测风力发电厂中风力涡轮机产生的功率+源代码+文档说明
- 基于stm32f103+空心杯电机+oled按键+运动算法
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论0