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.
            Asked
            
        
        
            Active
            
        
            Viewed 2.0k times
        
    1 Answers
19
            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
        swapnil gandhi
        
- 816
 - 1
 - 20
 - 38
 
        MaVRoSCy
        
- 17,747
 - 15
 - 82
 - 125
 
- 
                    3xuggler jar file size is larger than my whole project :( – asyard Nov 16 '18 at 20:07
 - 
                    1Xuggler is outdated I would say. Is there a more recent solution? – kerner1000 Jan 09 '23 at 09:55