h264-mp4-encoder: H264 and MP4 Encoding for Web and Node.js

This repository profile is provided by osrepos.com, an open source repository discovery platform.

h264-mp4-encoder: H264 and MP4 Encoding for Web and Node.js

Summary

The `h264-mp4-encoder` project provides a powerful solution for encoding H264 video and outputting it as an MP4 file directly within web browsers using WebAssembly or in Node.js environments. It leverages `minih264` and `libmp4v2` to offer efficient video creation, making it ideal for applications requiring dynamic video generation from sources like the HTML5 Canvas. This tool simplifies the process of integrating video encoding capabilities into web-based projects.

Repository Information

Analyzed by OSRepos on May 25, 2026

Topics

Click on any tag to explore related repositories

Use at your own risk

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.

Introduction

The h264-mp4-encoder is an innovative GitHub repository that brings H264 video encoding and MP4 output capabilities directly to the web and Node.js environments. Built with WebAssembly, it allows developers to generate MP4 videos efficiently, even from sources like the HTML5 Canvas. This project is particularly useful for applications requiring on-the-fly video creation without server-side processing.

Installation

To get started with h264-mp4-encoder, you can install it via npm:

npm install h264-mp4-encoder

Examples

The library is designed for ease of use, whether you're working with JavaScript, TypeScript, or directly in the browser.

Basic Usage Example

Here's a fundamental example demonstrating how to initialize the encoder, add a frame, and finalize the video:

import * as HME from "h264-mp4-encoder";

HME.createH264MP4Encoder().then(encoder => {
    // Must be a multiple of 2.
    encoder.width = 100;
    encoder.height = 100;
    encoder.initialize();

    // Add a single gray frame, the alpha is ignored.
    encoder.addFrameRgba(new Uint8Array(encoder.width * encoder.height * 4).fill(128));

    // For canvas:
    // encoder.addFrameRgba(ctx.getImageData(0, 0, encoder.width * encoder.height).data);

    encoder.finalize();
    const uint8Array = encoder.FS.readFile(encoder.outputFilename);
    console.log(uint8Array);
    encoder.delete();
});

For web environments, you can include the script directly:

<script src="https://unpkg.com/h264-mp4-encoder/embuild/dist/h264-mp4-encoder.web.js"></script>

Why Use It

The h264-mp4-encoder stands out by enabling client-side video encoding, reducing the need for server resources and improving user experience. Its use of WebAssembly ensures high performance, making it suitable for real-time applications or scenarios where users generate content directly in their browsers. This capability is particularly powerful for web applications that need to create animations, screen recordings, or dynamic video content from HTML5 Canvas elements. An excellent example of its application is Gifygram, an animation site built using this encoder.

Links

Related repositories

Similar repositories that may be relevant next.

CompetitiveCode: A Repository for Competitive Programming Problems

CompetitiveCode: A Repository for Competitive Programming Problems

July 16, 2026

CompetitiveCode by Vishruth-S is a valuable GitHub repository dedicated to competitive programming. It offers a collection of interesting problems and their solutions, primarily in C++, making it an excellent resource for learning and practicing algorithms. With a strong community and a focus on well-documented solutions, it fosters a collaborative environment for developers.

competitive-codingcompetitive-programmingalgorithm-challenges
Helium: A Privacy-First, Chromium-Based Web Browser

Helium: A Privacy-First, Chromium-Based Web Browser

July 1, 2026

Helium is an open-source, Chromium-based web browser designed with a strong focus on user privacy and an unbiased ad-blocking experience. It aims to provide a fast, honest, and bloat-free browsing environment for users. Built upon ungoogled-chromium, it offers a secure alternative for daily web navigation.

browserchromiumprivacy
XGrammar: Fast, Flexible, and Portable Structured Generation for LLMs

XGrammar: Fast, Flexible, and Portable Structured Generation for LLMs

June 27, 2026

XGrammar is an open-source library for efficient, flexible, and portable structured generation, developed by mlc-ai. It leverages constrained decoding to guarantee 100% structural correctness for outputs like JSON and regex. Optimized for near-zero overhead, XGrammar offers universal deployment across various platforms, hardware, and programming languages, making it a leading solution for structured output from large language models.

large-language-modelsstructured-generationC++
Notes: A Fast and Beautiful Cross-Platform Note-Taking App

Notes: A Fast and Beautiful Cross-Platform Note-Taking App

June 18, 2026

Notes is an open-source, cross-platform note-taking application designed for speed and beauty. Written in C++ with Qt, it offers robust features like Markdown support, Kanban boards for tasks, and comprehensive organization options. This app prioritizes user privacy, ensuring a secure and efficient environment for capturing your thoughts.

note-taking-appcross-platformmarkdown

Source repository

Open the original repository on GitHub.

13 counted GitHub visits

View on GitHub
OS
OSRepos

Analysis and discovery of open source repositories. Find interesting projects and follow their updates.

Monitor your website with YourWebsiteScore

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of third-party repository code is at your own risk. Always review source code, dependencies, licenses, and security implications before running anything.

© 2025 OSRepos. Built with Nuxt 3 and lots of ❤️