java使用Xuggler获得视频的时长,分辨率,高宽等信息,xuggler高宽,package cn.opackage cn.outofmemory.xuggler.intro;import com.xuggle.xuggler.ICodec;import com.xuggle.xuggler.IContainer;import com.xuggle.xuggler.IStream;import com.xuggle.xuggler.IStreamCoder;public class VideoInfo { private static final String filename = "c:/myvideo.mp4"; public static void main(String[] args) { // first we create a Xuggler container object IContainer container = IContainer.make(); // we attempt to open up the container int result = container.open(filename, IContainer.Type.READ, null); // check if the operation was successful if (result<0) throw new RuntimeException("Failed to open media file"); // query how many streams the call to open found int numStreams = container.getNumStreams(); // query for the total duration long duration = container.getDuration(); // query for the file size long fileSize = container.getFileSize(); // query for the bit rate long bitRate = container.getBitRate(); System.out.println("Number of streams: " + numStreams); System.out.println("Duration (ms): " + duration); System.out.println("File Size (bytes): " + fileSize); System.out.println("Bit Rate: " + bitRate); // iterate through the streams to print their meta data for (int i=0; i
java 视频 分辨率,java使用Xuggler获得视频的时长,分辨率,高宽等信息,xuggler高宽,package cn.o...
最新推荐文章于 2021-07-12 16:55:27 发布