PHPackages                             xiaosongshu/flv2mp4 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. xiaosongshu/flv2mp4

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

xiaosongshu/flv2mp4
===================

A pure PHP media processing toolkit for bidirectional conversion between FLV, MP4, and HLS. Includes live stream relay gateway, file server, and push clients (HTTP-FLV, WebSocket-FLV, RTMP).

v1.3.7(1w ago)169↓33.3%1MITPHPPHP &gt;=8.1.0

Since May 29Pushed 1w agoCompare

[ Source](https://github.com/2723659854/flv2mp4)[ Packagist](https://packagist.org/packages/xiaosongshu/flv2mp4)[ RSS](/packages/xiaosongshu-flv2mp4/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (8)DependenciesVersions (41)Used By (1)

FLV ↔ MP4 / HLS Conversion Tool
===============================

[](#flv--mp4--hls-conversion-tool)

 [**🇨🇳 中文**](./README.cn.md) • [**🇬🇧 English**](./README.md)

A lightweight media processing toolkit implemented in pure PHP 8.1+, with **zero external dependencies (no FFmpeg required)**.
Supports bidirectional conversion between FLV and FMP4 / MP4 / HLS, live stream forwarding, pushing, pulling, and relaying, making it easy to integrate into automated pipelines.

🎯 Core Features
---------------

[](#-core-features)

FeatureDirectionDescriptionTranscoding / MuxingFLV → MP4 / FMP4Generate standard MP4 or separate fMP4 segments (suitable for MSE)Segment DistributionFLV → HLSGenerate M3U8 + TS segments, compatible with hls.js, VLC, etc.Reverse RestorationHLS → FLVMerge HLS segments back into a single FLV fileFormat ConversionMP4 → FLVTranscode an MP4 file into FLV container formatFormat ConversionFMP4 → FLVTranscode an FMP4 file into FLV container formatLive GatewayFLV GatewayHigh-performance multi-level forwarding, supporting high concurrencyFile ServerHTTP File GatewayLightweight static file server with directory listing supportPush ClientFLV / MP4 → RTMPPush static files as pseudo-live streams to an RTMP server (HTTP-FLV / WS-FLV also supported)Pull ClientHTTP-FLV / WS-FLV / RTMP → FLVPull a live stream and save it as a local FLV fileRelay ClientMulti-protocol input → Multi-protocol outputPull a live stream and forward it to multiple target addresses simultaneouslyPrerequisites
-------------

[](#prerequisites)

DependencyDescriptionPHP≥ 8.1 (**CLI command-line mode only**, not for web environments)`sockets` extension**Required**, provides low-level socket communication capabilities> 💡 All features are built with native PHP – no need to install FFmpeg or any third-party binaries.

🚀 Installation
--------------

[](#-installation)

Install via Composer:

```
composer require xiaosongshu/flv2mp4
```

📚 Quick Start
-------------

[](#-quick-start)

```
