可以通过以下方式实现:
<video id="myVideo" src="video.mp4" controls></video>
<script>
var video = document.getElementById("myVideo");
video.onloadedmetadata = function() {
var videoWidth = this.videoWidth;
var videoHeight = this.videoHeight;
console.log("视频宽度:" + videoWidth);
console.log("视频高度:" + videoHeight);
};
</script>
from moviepy.editor import VideoFileClip
video = VideoFileClip("video.mp4")
videoWidth = video.size[0]
videoHeight = video.size[1]
print("视频宽度:", videoWidth)
print("视频高度:", videoHeight)
上述代码使用moviepy库来读取视频文件,并通过size属性获取视频的宽度和高度。
领取专属 10元无门槛券
手把手带您无忧上云