Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encode_fomats bug fix #316

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions video2dataset/subsamplers/frame_subsampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ class FrameSubsampler(Subsampler):
# output_format - save as video, or images
"""

def __init__(self, frame_rate, downsample_method="fps", encode_format="mp4"):
def __init__(self, frame_rate, downsample_method="fps", encode_formats=None):
self.frame_rate = frame_rate
self.downsample_method = downsample_method
self.output_modality = "video" if downsample_method == "fps" else "jpg"
self.encode_format = encode_format
self.encode_formats = encode_formats

def __call__(self, streams, metadata=None):
# TODO: you might not want to pop it (f.e. in case of other subsamplers)
video_bytes = streams.pop("video")
video_bytes = streams["video"]
subsampled_bytes, subsampled_metas = [], []
for i, vid_bytes in enumerate(video_bytes):
with tempfile.TemporaryDirectory() as tmpdir:
Expand Down
Loading