How can i get video length in java

你离开我真会死。 提交于 2019-11-28 08:00:50

问题


I used xuggler to get the video length but it is giving wrong length may be it is time for reading data from video file using xuggler. But i need to get actual video length or duration.


回答1:


You can get it with the getDuration() and getFileSize() method of IContainer. You can do it like this:

private static final String filename = "c:/myvideo.mp4";
IContainer container = IContainer.make();
int result = container.open(filename, IContainer.Type.READ, null);
long duration = container.getDuration();
long fileSize = container.getFileSize();

You can see a complete example here

Hope this helps



来源:https://stackoverflow.com/questions/29984612/how-can-i-get-video-length-in-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!