File size: 1,742 Bytes
a94e127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c796a5a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2f68272
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
dataset_info:
  features:
  - name: model_name
    dtype: string
  - name: id_prompt
    dtype: string
  - name: frame_prompt
    dtype: string
  - name: Image
    dtype: image
  - name: sub_images
    list:
    - name: bytes
      dtype: binary
  - name: videos
    list:
    - name: motion_bucket_id
      dtype: int64
    - name: video_bytes
      dtype: binary
  - name: sub_image
    dtype: image
  - name: motion_bucket_id
    dtype: int64
  - name: video
    dtype: binary
  splits:
  - name: train
    num_bytes: 751715811.0
    num_examples: 30
  download_size: 81637911
  dataset_size: 751715811.0
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
---

```python
from datasets import load_dataset 
from IPython import display
ds = load_dataset("svjack/OnePromptOneStory-Examples-Vid-head2-Exp")["train"]

def bytes_to_video(video_bytes, output_path="output.mp4"):
    """
        将二进制数据转换为视频文件并保存到指定路径。

        参数:
            video_bytes (bytes): 视频的二进制数据。
            output_path (str): 视频文件的保存路径。

        返回:
            str: 视频文件的路径。
    """
    with open(output_path, "wb") as video_file:
        video_file.write(video_bytes)
    return output_path

bytes_to_video(ds[3]["video"], "vid0.mp4")
display.Video("vid0.mp4", height = 512, width = 512)

bytes_to_video(ds[-3]["video"], "vid1.mp4")
display.Video("vid1.mp4", width = 512, height = 512)
```

## 视频演示

<video controls width="512" height="512">
  <source src="https://github.com/user-attachments/assets/fd41f9b8-3896-4caf-bf62-4b8b449b7271" type="video/mp4">
  Your browser does not support the video tag.
</video>