简体   繁体   中英

Getting video height and width via Java

Is there a general way to get the height and width of a video file in Java. I receive/own video files in formats such as .mov, .avi, .mpg, mp4, 3gp, and m4v and wish to display them systematically using java generated web pages. Currently, I am generating HTML 5 code where height and width are needed. Posts so far suggest using ASP.net or XUGGLER but these may be overkill for what I want to do. Any suggestions for getting these values?

I did not find an easy way to extract video size but I did find an easy workaround. First I converted all my valued videos to MPEG4. It took several tries of various converters and finally I found one that worked consistently but on OS X: WinX HD Video Converter for Mac

(Space savings are huge.) Next, on a hunch I tried mapping all my videos to 70% of my screen size and results are very satisfactory. Here is a sample display page for a video.

<!DOCTYPE HTML>
<HTML><BODY><small>
</small><video width="70%" height="70%" autoplay>
<source src="A1_Howard_Show2__.mp4" type="video/mp4">
Your browser does not support the video format .mp4!
</video></body></html>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM