Simple binary for extracting all frames of a video to image sequence of TIFF files. Uses libav.
Go to file
mattmcw 10af93d77f Converted all logs in main to JSON. Added framerate readout in logs 2026-04-04 13:11:06 -04:00
.gitignore First pass at framerip 2026-04-04 12:33:05 -04:00
CMakeLists.txt Rename binary fr. Add ability to list framerate and throw warning for values not equal to 24. In process converting all output strings to json 2026-04-04 12:52:33 -04:00
README.md Rename binary fr. Add ability to list framerate and throw warning for values not equal to 24. In process converting all output strings to json 2026-04-04 12:52:33 -04:00
frame_extractor.cpp Converted all logs in main to JSON. Added framerate readout in logs 2026-04-04 13:11:06 -04:00
frame_extractor.h Converted all logs in main to JSON. Added framerate readout in logs 2026-04-04 13:11:06 -04:00
main.cpp Converted all logs in main to JSON. Added framerate readout in logs 2026-04-04 13:11:06 -04:00
platform_utils.cpp First pass at framerip 2026-04-04 12:33:05 -04:00
platform_utils.h First pass at framerip 2026-04-04 12:33:05 -04:00
tiff_writer.cpp First pass at framerip 2026-04-04 12:33:05 -04:00
tiff_writer.h First pass at framerip 2026-04-04 12:33:05 -04:00

README.md

framerip

Extracts every frame from a video file and writes them as uncompressed RGB TIFF images into a temporary directory. Compiles on macOS, Linux, and Windows.

Dependencies

Library Purpose
libavformat Container demuxing
libavcodec Video decoding
libavutil FFmpeg utilities
libswscale Pixel-format conversion

All four are part of FFmpeg. No other external libraries are required — TIFF files are written with a hand-rolled encoder.


Building

macOS (Homebrew)

brew install ffmpeg cmake

git clone <this-repo>
cd fr
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build

Linux (apt)

sudo apt update
sudo apt install ffmpeg libavcodec-dev libavformat-dev \
                 libavutil-dev libswscale-dev cmake build-essential

cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build

Linux (dnf / Fedora)

sudo dnf install ffmpeg-devel cmake gcc-c++
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build

Windows (vcpkg + MSVC)

  1. Install vcpkg and integrate it:
git clone https://github.com/microsoft/vcpkg
cd vcpkg
.\bootstrap-vcpkg.bat
.\vcpkg integrate install
.\vcpkg install ffmpeg:x64-windows
  1. Build:
cmake -B build -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake `
               -DVCPKG_TARGET_TRIPLET=x64-windows `
               -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release

Windows (manual FFmpeg build / pre-built binaries)

Download pre-built FFmpeg dev libs from https://github.com/BtbN/FFmpeg-Builds/releases and pass their paths to CMake:

cmake -B build `
  -DFFMPEG_INCLUDE_DIR="C:\ffmpeg\include" `
  -DFFMPEG_LIB_DIR="C:\ffmpeg\lib" `
  -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release

Usage

fr <video_file>

Example:

./build/fr sample.mp4

Output:

Output directory: /tmp/vfe_frames_aBcDeF
Video: sample.mp4
Stream duration: 12.34s  |  Resolution: 1920x1080
Extracting frames...
  Written frame 0    -> /tmp/vfe_frames_aBcDeF/frame_00000000.tif
  Written frame 100  -> /tmp/vfe_frames_aBcDeF/frame_00000100.tif
  ...
Done. Extracted 370 frame(s) to:
  /tmp/vfe_frames_aBcDeF

Frames are named frame_XXXXXXXX.tif (zero-padded to 8 digits).


TIFF format details

Each file is a baseline TIFF 6.0 image:

Property Value
Colour space RGB
Bits per sample 8 per channel (24-bit)
Compression None (1)
Planar config Chunky (interleaved)
Byte order Little-endian
Strip layout Single strip (full image)

These files open correctly in Photoshop, GIMP, Preview, Windows Photo Viewer, ImageMagick, and any other TIFF-capable application.


Project structure

fr/
├── CMakeLists.txt        # Cross-platform build script
├── main.cpp              # Entry point
├── frame_extractor.h/.cpp  # libav decoding + RGB conversion
├── tiff_writer.h/.cpp    # Dependency-free TIFF encoder
└── platform_utils.h/.cpp # Temp-dir + path helpers (Win/POSIX)

License

MIT — do whatever you like with it.