svjack commited on
Commit
c796a5a
·
verified ·
1 Parent(s): a94e127

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +29 -0
README.md CHANGED
@@ -37,3 +37,32 @@ configs:
37
  - split: train
38
  path: data/train-*
39
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  - split: train
38
  path: data/train-*
39
  ---
40
+
41
+ ```python
42
+ from datasets import load_dataset
43
+ from IPython import display
44
+ ds = load_dataset("svjack/OnePromptOneStory-Examples-Vid-head2-Exp")["train"]
45
+
46
+ def bytes_to_video(video_bytes, output_path="output.mp4"):
47
+ """
48
+ 将二进制数据转换为视频文件并保存到指定路径。
49
+
50
+ 参数:
51
+ video_bytes (bytes): 视频的二进制数据。
52
+ output_path (str): 视频文件的保存路径。
53
+
54
+ 返回:
55
+ str: 视频文件的路径。
56
+ """
57
+ with open(output_path, "wb") as video_file:
58
+ video_file.write(video_bytes)
59
+ return output_path
60
+
61
+ bytes_to_video(ds[3]["video"], "vid0.mp4")
62
+ display.Video("vid0.mp4", height = 512, width = 512)
63
+
64
+ bytes_to_video(ds[-3]["video"], "vid1.mp4")
65
+ display.Video("vid1.mp4", width = 512, height = 512)
66
+ ```
67
+
68
+ https://github.com/user-attachments/assets/fd41f9b8-3896-4caf-bf62-4b8b449b7271