mcap/modules/ffmpeg
Musa Mahmood baa188b0e4 [0.0.9] Import: videos and animated GIFs, in .mcap version 4
- Import brings in videos (MP4, MOV, MKV, WebM, AVI, WMV, MPEG, MTS/M2TS, FLV) on Windows, read with
  FFmpeg: the file as it was in the original, a frame a tenth of the way in (at most 3 s), turned
  the right way up, as the rendered image (what the grid, Capture window, OCR and labels see), and
  import.json with Duration, FrameRate, VideoCodec, Rotation, PosterTime, Audio, and the camera,
  date and location from the container. Elsewhere videos are skipped as "video (Windows only)".
- .mcap version 4: the original's size is a u64, so a video can be any size. Versions 1-3 still read.
  mcap_read_without_original and mcap_write_streamed read and rewrite a file with its original left
  on disk; mcap_store, mcap_erase, the import index and the import itself never hold a video in memory.
- Animated GIFs: Frames and Duration in import.json (gif_info).
- Grid: a play mark and duration on video thumbnails, GIF on animations. Capture window: what the
  video is, and Play in the default player (written out to %TEMP%\mcap).
- modules/ffmpeg: FFmpeg 6.0 bindings and the five DLLs used (avformat, avcodec, avutil, swscale,
  swresample), copied beside the executable by the build.
  swscale converts into a buffer of its own allocator with padded rows: an exact-sized one let
  its SIMD write past the end, crashing on frames of odd widths (1916, 1106 ...).
- image-probe shows videos and GIF frame counts; ocr-bench reads a video's frame.
- Tests: new video formats, display-matrix rotation, ISO 6709, video dates, GIF frames, and v4
  serialize/parse, v3 compatibility, streamed writes, store/erase and extraction.

SnagitConverter's copy of Capture_File needs syncing to read version 4 files.
2026-10-09 23:10:55 +01:00
..
windows [0.0.9] Import: videos and animated GIFs, in .mcap version 4 2026-10-09 23:10:55 +01:00
generate.jai [0.0.9] Import: videos and animated GIFs, in .mcap version 4 2026-10-09 23:10:55 +01:00
module.jai [0.0.9] Import: videos and animated GIFs, in .mcap version 4 2026-10-09 23:10:55 +01:00
README.md [0.0.9] Import: videos and animated GIFs, in .mcap version 4 2026-10-09 23:10:55 +01:00
windows.jai [0.0.9] Import: videos and animated GIFs, in .mcap version 4 2026-10-09 23:10:55 +01:00

FFmpeg module for jai

FFmpeg bindings for jai and some examples decoding and play videos.

Setup

The FFmpeg libaries and header files are not included in this repo as I didn't want to have to deal with license things. Unfortunately this means that there is some labour to get things working. The approximate steps are:

  • Download "shared" binaries. I got them from here. Eg "ffmpeg-release-full-shared.7z". At the time of writing the latest release build was version 6.0.
  • Copy all the directories in the Include directory to ffmpeg/src. There will then be, eg, a ffmpeg/src/libavcodec/codec.h file.
  • Copy all the dlls from the bin directory to ffmpeg/windows
  • Copy all the libs from the lib directory to ffmpeg/windows. You may then need to rename the lib files so the names match the versioned dll names. (This may not actually be necessary, but that is how I generated bindings. I'm not worrying about it as probably it makes more sense to some day work out how to compile the libraries myself so they don't include verion names in them).

There may be additional work for platforms other than windows, I only tried on windows!

You may need to add aditional source files in generate.jai if bindings you want are not present.

You will also need to copy the dlls into whatever directory your exe is in.