|
|
@ -9,15 +9,20 @@ Author: JunJie Jiang |
|
|
|
## Interface |
|
|
|
|
|
|
|
```python |
|
|
|
__init__(self, key_frame: bool) |
|
|
|
__init__(self, start_time=None, end_time=None, sample_type=None, args=None) |
|
|
|
``` |
|
|
|
|
|
|
|
Args: |
|
|
|
|
|
|
|
- key_frame: |
|
|
|
- start_time: float |
|
|
|
- end_time: float |
|
|
|
decode video [start_time, end_time) |
|
|
|
|
|
|
|
sample_type: |
|
|
|
uniform_temporal_subsample |
|
|
|
args: |
|
|
|
num_samples: int |
|
|
|
|
|
|
|
True: Only return key frame |
|
|
|
False: Return all image frames of video |
|
|
|
|
|
|
|
```python |
|
|
|
__call__(self, video_path: str) |
|
|
@ -38,6 +43,23 @@ av |
|
|
|
|
|
|
|
## How it works |
|
|
|
|
|
|
|
from towhee import ops |
|
|
|
|
|
|
|
d = ops.video_decode.ffmpeg(start_time=10.0, end_time=20.0, sample_type='uniform_temporal_subsample', args={'num_samples': 10}) |
|
|
|
for frame in d(video_path): |
|
|
|
print(frame) |
|
|
|
|
|
|
|
result: |
|
|
|
Outputs(image=<towhee.types.image.Image object at 0x7fa444776310>, TIMESTAMP=10010) |
|
|
|
Outputs(image=<towhee.types.image.Image object at 0x7fa444776700>, TIMESTAMP=11078) |
|
|
|
Outputs(image=<towhee.types.image.Image object at 0x7fa444776310>, TIMESTAMP=12145) |
|
|
|
Outputs(image=<towhee.types.image.Image object at 0x7fa444776700>, TIMESTAMP=13280) |
|
|
|
Outputs(image=<towhee.types.image.Image object at 0x7fa444776310>, TIMESTAMP=14348) |
|
|
|
Outputs(image=<towhee.types.image.Image object at 0x7fa444776700>, TIMESTAMP=15482) |
|
|
|
Outputs(image=<towhee.types.image.Image object at 0x7fa444776310>, TIMESTAMP=16550) |
|
|
|
Outputs(image=<towhee.types.image.Image object at 0x7fa444776700>, TIMESTAMP=17684) |
|
|
|
Outputs(image=<towhee.types.image.Image object at 0x7fa444776310>, TIMESTAMP=18752) |
|
|
|
Outputs(image=<towhee.types.image.Image object at 0x7fa444776700>, TIMESTAMP=19887) |
|
|
|
|
|
|
|
|
|
|
|
## Reference |
|
|
|