-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
easyvolcap: adding more useful scripts
- Loading branch information
Showing
9 changed files
with
120 additions
and
32 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
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
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
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
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,27 @@ | ||
""" | ||
Compress the video folder to something like libx265 | ||
""" | ||
|
||
from easyvolcap.utils.console_utils import * | ||
from easyvolcap.utils.data_utils import generate_video | ||
|
||
|
||
@catch_throw | ||
def main(): | ||
args = dotdict( | ||
data_root='data/bullet/final', | ||
videos_dir='videos', | ||
output_dir='videos_compressed', | ||
) | ||
|
||
args = dotdict(vars(build_parser(args, description=__doc__).parse_args())) | ||
for video in sorted(os.listdir(join(args.data_root, args.videos_dir))): | ||
if not video.endswith('.mp4'): continue | ||
video_path = join(args.data_root, args.videos_dir, video) | ||
output_path = join(args.data_root, args.output_dir, video) | ||
os.makedirs(dirname(output_path), exist_ok=True) | ||
generate_video(video_path, output_path, fps=-1, verbose=True) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
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,26 @@ | ||
import os | ||
import argparse | ||
from os.path import join | ||
|
||
from easyvolcap.utils.console_utils import * | ||
from easyvolcap.utils.easy_utils import read_camera, write_camera | ||
|
||
|
||
@catch_throw | ||
def main(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('--data_root', default='data/bullet/final') | ||
parser.add_argument('--dirs', default=['images', 'videos', 'masks', 'cameras']) | ||
args = parser.parse_args() | ||
|
||
for dir in args.dirs: | ||
if not exists(join(args.data_root, dir)): continue | ||
for idx, cam in enumerate(sorted(os.listdir(join(args.data_root, dir)))): | ||
_, ext = splitext(cam) | ||
new_name = f"{idx:02d}{ext}" | ||
if new_name != cam: | ||
os.system(f'mv {join(args.data_root, dir, cam)} {join(args.data_root, dir, new_name)}') | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |