Frame Extraction and Video Creation - dcomp-leris/CGSynth GitHub Wiki
Two supported pathways exist to extract frames from MP4 and create videos from frames. Both standardize zero-padded filenames for downstream tools.
python tools/rtp_frame_extractor.py \
--video path/to/video.mp4 \
--out-dir output_frames/MyVideo \
--fps 30 \
--skip-corrupted yes
Features:
- Target-FPS sampling
- Sequential zero-padded
frame_000001.jpg
naming - Basic error resilience
python tools/create_video_from_frames.py \
--frames-dir output_frames/MyVideo \
--output output_videos/MyVideo.mp4 \
--fps 30
If you prefer a richer CLI and reporting, use extract_frames.py
(enhanced script):
Features:
- Argparse CLI
- Auto output directory creation
- Progress reporting
- Video info display (original FPS, duration, total frames)
- Robust error handling for invalid files
- Zero-padded frame naming (
frame_000001.jpg
, …)
Example:
python extract_frames.py \
--video path/to/video.mp4 \
--out-dir output_frames/MyVideo \
--fps 30
Example harness:
python example_frame_extraction.py
- Keep frame rate consistent when comparing against references (e.g., 30 FPS).
- Ensure frame dimensions match across sources when computing quality metrics.
- Use SSD storage to accelerate write-heavy extraction steps.