mpeg

Nim wrapper for pl_mpeg single header mpeg library.

Pure Nim score 30/100 · tests present · docs generated

Summary

Latest Version Unknown
License MIT
CI Status Passing
Downloads 0
Last Indexed 2026-07-21 05:24

Installation

nimble install mpeg
choosenim install mpeg
git clone https://github.com/treeform/mpeg

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
mpeg - - - - - - -

Source

Repository https://github.com/treeform/mpeg
Homepage https://github.com/treeform/mpeg
Documentation View Documentation
Registry Source nimble_official

README

Mpeg Logo

Wrapper for PL_MPEG - a single header mpeg library.

nimble install mpeg

Github Actions

API reference

This library has no dependencies other than the Nim standard library.

About

https://github.com/phoboslab/pl_mpeg

  • MPEG1 Video decoder
  • MP2 Audio decoder
  • MPEG-PS demuxer

Encoding

You can encode video in a suitable format using ffmpeg: ffmpeg -i input.mp4 -c:v mpeg1video -c:a mp2 -format mpeg output.mpg

Test file

You can download test mpeg here: https://phoboslab.org/files/bjork-all-is-full-of-love.mpg

Example

# Load mmpeg file (only spesific format is supported)
var plm = plm_create_with_filename("bjork-all-is-full-of-love.mpg")

# Disable audo for now
plm_set_audio_enabled(plm, 0, 0)

# Will use Flippy image library to write images.
# Create an image that will hold 1 frame.
var image = newImage(plm_get_width(plm), plm_get_height(plm), 3)

# For the first 100 frames.
for i in 0..100:
  echo i
  # Deconde a single frame
  var frame = plm_decode_video(plm)
  # Convert a frame to rgb and save it to our image
  plm_frame_to_rgb(frame, addr image.data[0])
  # Save the image.
  image.save(&"tmp/f{i}.png")