-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0293116
commit eb7d793
Showing
36 changed files
with
162 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from PIL import Image | ||
import numpy as np | ||
import imageio | ||
|
||
# 图片路径 | ||
image_path = './files/icon.jpg' | ||
# 输出视频路径 | ||
video_path = './videos/32.mp4' | ||
|
||
# 打开图片 | ||
image = Image.open(image_path) | ||
|
||
# 将图片转换为所需的模式,例如"RGB" | ||
if image.mode != 'RGB': | ||
image = image.convert('RGB') | ||
|
||
# 定义帧率 | ||
fps = 24 | ||
|
||
# 创建一个Writer对象,用于写入视频 | ||
writer = imageio.get_writer(video_path, fps=fps) | ||
|
||
# 假设我们想创建10秒的视频 | ||
for i in range(fps * 10): | ||
# 将图片写入视频 | ||
writer.append_data(np.array(image)) | ||
|
||
# 完成视频写入 | ||
writer.close() | ||
|
||
print(f"Video has been created: {video_path}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>32 MP4 Videos in Grid</title> | ||
<style> | ||
.video-container { | ||
display: grid; | ||
grid-template-columns: repeat(8, 1fr); /* 8列 */ | ||
grid-template-rows: repeat(4, auto); /* 4行,每行的高度根据内容自动调整 */ | ||
gap: 10px; /* 网格项之间的间隙 */ | ||
width: 100%; /* 容器宽度 */ | ||
margin: auto; /* 居中显示 */ | ||
} | ||
.video-item { | ||
width: 100%; /* 视频宽度 */ | ||
height: auto; /* 视频高度自适应 */ | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
|
||
<div class="video-container"> | ||
<!-- 32个视频标签 --> | ||
<video class="video-item" controls> | ||
<source src="videos/1.mp4" type="video/mp4"> | ||
Your browser does not support the video tag. | ||
</video> | ||
<video class="video-item" controls> | ||
<source src="videos/2.mp4" type="video/mp4"> | ||
Your browser does not support the video tag. | ||
</video> | ||
|
||
<!-- ... 以下是自动生成的剩余视频标签 ... --> | ||
<video class="video-item" controls> | ||
<source src="videos/32.mp4" type="video/mp4"> | ||
Your browser does not support the video tag. | ||
</video> | ||
</div> | ||
|
||
</body> | ||
<script> | ||
// 使用JavaScript动态生成剩余的视频标签 | ||
var container = document.querySelector('.video-container'); | ||
for (var i = 5; i <= 31; i++) { | ||
var video = document.createElement('video'); | ||
video.className = 'video-item'; | ||
video.setAttribute('controls', ''); | ||
|
||
var source = document.createElement('source'); | ||
source.src = 'videos/' + i + '.mp4'; | ||
source.type = 'video/mp4'; | ||
|
||
video.appendChild(source); | ||
video.innerHTML += 'Your browser does not support the video tag.'; | ||
|
||
container.appendChild(video); | ||
} | ||
</script> | ||
</html> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.