package vedio.ffmpeg;
public class ffmpegexception extendsexception {
private static final long serialversionuid= 1l;
public ffmpegexception() {
super();
}
public ffmpegexception(string message){
super(message);
}
public ffmpegexception(throwable cause){
super(cause);
}
public ffmpegexception(string message,throwable cause) {
super(message, cause);
}
}
4.获取ts流的时长、大小以及分辨率(用到了xuggle,需要下载对应jar包)
importcom.xuggle.xuggler.icodec;
importcom.xuggle.xuggler.icontainer;
importcom.xuggle.xuggler.istream;
importcom.xuggle.xuggler.istreamcoder;
*/
public static void getvedioinfo(string filename){
// first we create a xuggler containerobject
icontainer container =icontainer.make();
// we attempt to open up thecontainer
int result = container.open(filename,icontainer.type.read, null);
// check if the operation wassuccessful
if (result<0)
return;
// query how many streams the call to openfound
int numstreams =container.getnumstreams();
// query for the total duration
long duration =container.getduration();
// query for the file size
long filesize =container.getfilesize();
long secondduration =duration/1000000;
system.out.println("时长:"+secondduration+"秒");
system.out.println("文件大小:"+filesize+"m");
for (int i=0; i
istreamstream = container.getstream(i);
istreamcoder coder = stream.getstreamcoder();
if(coder.getcodectype() == icodec.type.codec_type_video){
system.out.println("视频宽度:"+coder.getwidth());
system.out.println("视频高度:"+coder.getheight());
}
}
}