Convert Figma logo to code with AI

ireader logomedia-server

RTSP/RTP/RTMP/FLV/HLS/MPEG-TS/MPEG-PS/MPEG-DASH/MP4/fMP4/MKV/WebM

3,046
1,072
3,046
94

Top Related Projects

25,534

SRS is a simple, high-efficiency, real-time media server supporting RTMP, WebRTC, HLS, HTTP-FLV, HTTP-TS, SRT, MPEG-DASH, and GB28181.

45,445

Mirror of https://git.ffmpeg.org/ffmpeg.git

NGINX-based Media Streaming Server

11,584

Ready-to-use SRT / WebRTC / RTSP / RTMP / LL-HLS media server and media proxy that allows to read, publish, proxy, record and playback video and audio streams.

open source、high performance、industrial rtsp streaming server,a lot of optimization on streaming relay,KeyFrame cache,RESTful,and web management,also EasyDarwin support distributed load balancing,a simple streaming media cloud platform architecture.高性能开源RTSP流媒体服务器,基于go语言研发,维护和优化:RTSP推模式转发、RTSP拉模式转发、录像、检索、回放、关键帧缓存、秒开画面、RESTful接口、WEB后台管理、分布式负载均衡,基于EasyDarwin构建出了一套基础的流媒体云视频平台架构!

13,642

Pure Go implementation of the WebRTC API

Quick Overview

The ireader/media-server is a comprehensive multimedia streaming server implementation in C/C++. It supports various streaming protocols, including RTSP, RTMP, and HLS, and provides functionalities for both live streaming and video-on-demand services. The project aims to offer a high-performance, cross-platform solution for media streaming applications.

Pros

  • Supports multiple streaming protocols (RTSP, RTMP, HLS)
  • Cross-platform compatibility (Windows, Linux, macOS)
  • High-performance and efficient C/C++ implementation
  • Includes both server and client components for complete streaming solutions

Cons

  • Limited documentation and examples for some features
  • Steep learning curve for developers unfamiliar with multimedia streaming concepts
  • Requires additional dependencies for certain functionalities
  • May need fine-tuning for optimal performance in specific use cases

Code Examples

  1. Creating an RTSP server:
#include "rtsp-server.h"

static int rtsp_handler(void* ptr, rtsp_server_t* rtsp, const char* uri, const char* method, const char* headers, void* content, int bytes)
{
    // Handle RTSP requests
    return 0;
}

int main()
{
    rtsp_server_t* rtsp = rtsp_server_create("0.0.0.0", 8554, rtsp_handler, NULL);
    rtsp_server_run(rtsp);
    rtsp_server_destroy(rtsp);
    return 0;
}
  1. Initializing an RTMP client:
#include "rtmp-client.h"

static int rtmp_client_send(void* param, const void* header, size_t len, const void* data, size_t bytes)
{
    // Send RTMP packets
    return 0;
}

int main()
{
    rtmp_client_t* rtmp = rtmp_client_create("rtmp://server/live/stream", rtmp_client_send, NULL);
    rtmp_client_start(rtmp, 0);
    rtmp_client_destroy(rtmp);
    return 0;
}
  1. Setting up an HLS server:
#include "hls-server.h"

static int hls_handler(void* param, const char* path, const char* method, const void* content, size_t bytes, void* reply, size_t *size)
{
    // Handle HLS requests
    return 0;
}

int main()
{
    struct hls_server_t* hls = hls_server_create("0.0.0.0", 8080, hls_handler, NULL);
    hls_server_run(hls);
    hls_server_destroy(hls);
    return 0;
}

Getting Started

  1. Clone the repository:

    git clone https://github.com/ireader/media-server.git
    
  2. Build the project:

    cd media-server
    mkdir build && cd build
    cmake ..
    make
    
  3. Include the necessary headers in your project and link against the built libraries.

  4. Use the provided APIs to create and manage streaming servers or clients based on your requirements.

Competitor Comparisons

25,534

SRS is a simple, high-efficiency, real-time media server supporting RTMP, WebRTC, HLS, HTTP-FLV, HTTP-TS, SRT, MPEG-DASH, and GB28181.

Pros of SRS

  • More active development with frequent updates and releases
  • Extensive documentation and community support
  • Better support for modern streaming protocols like WebRTC

Cons of SRS

  • Higher resource consumption due to its comprehensive feature set
  • Steeper learning curve for beginners due to its complexity

Code Comparison

SRS (C++):

SrsRtmpConn::SrsRtmpConn(SrsServer* svr, srs_netfd_t c)
{
    server = svr;
    stfd = c;
    ip = srs_get_peer_ip(c);
    rbytes = sbytes = 0;
    req = new SrsRequest();
}

media-server (C):

int rtmp_server_create(struct rtmp_server_t** pp, const char* ip, int port)
{
    struct rtmp_server_t* ctx;
    ctx = (struct rtmp_server_t*)calloc(1, sizeof(*ctx));
    if (NULL == ctx)
        return -1;
    ctx->aio = aio_socket_create(ip, port, RTMP_SERVER_LISTEN_BACKLOG);
    if (NULL == ctx->aio)
    {
        free(ctx);
        return -1;
    }
    *pp = ctx;
    return 0;
}

Both repositories offer robust media server solutions, but SRS provides a more modern and feature-rich approach with better documentation and community support. However, this comes at the cost of higher resource usage and a steeper learning curve. media-server, on the other hand, offers a more lightweight and straightforward implementation, which may be preferable for simpler use cases or resource-constrained environments.

45,445

Mirror of https://git.ffmpeg.org/ffmpeg.git

Pros of FFmpeg

  • Extensive codec support and multimedia processing capabilities
  • Large, active community with frequent updates and contributions
  • Comprehensive documentation and wide range of use cases

Cons of FFmpeg

  • Steep learning curve due to complex command-line interface
  • Large codebase can be challenging to navigate for newcomers
  • Resource-intensive for some operations, especially on low-end devices

Code Comparison

FFmpeg (command-line usage):

ffmpeg -i input.mp4 -c:v libx264 -preset slow -crf 22 -c:a copy output.mp4

media-server (C API usage):

struct avpacket_t pkt;
avpacket_init(&pkt);
avcodec_encode_audio(codec, &pkt, pcm, samples);

Key Differences

  • FFmpeg is a comprehensive multimedia framework, while media-server focuses on streaming protocols and real-time communication
  • media-server provides a more lightweight solution for specific use cases, whereas FFmpeg offers broader functionality
  • FFmpeg has a command-line interface and library, while media-server is primarily used as a C library
  • media-server may be easier to integrate for specific streaming applications, but FFmpeg offers more flexibility for general multimedia tasks

NGINX-based Media Streaming Server

Pros of nginx-rtmp-module

  • Built as an NGINX module, leveraging NGINX's robust and scalable architecture
  • Extensive documentation and community support
  • Simpler setup process for those already familiar with NGINX

Cons of nginx-rtmp-module

  • Limited to RTMP protocol, while media-server supports multiple protocols
  • Less flexibility in terms of customization compared to media-server
  • Dependent on NGINX updates and compatibility

Code Comparison

nginx-rtmp-module configuration:

rtmp {
    server {
        listen 1935;
        application live {
            live on;
        }
    }
}

media-server implementation:

struct rtmp_server_t* rtmp = rtmp_server_create(NULL, 1935);
rtmp_server_set_handler(rtmp, RTMP_HANDLER);
rtmp_server_run(rtmp);

The nginx-rtmp-module uses a declarative configuration approach within NGINX, while media-server employs a programmatic C API for server creation and management. nginx-rtmp-module integrates seamlessly with existing NGINX setups, whereas media-server offers more granular control over the RTMP server implementation.

Both projects have their strengths, with nginx-rtmp-module excelling in ease of use and integration with NGINX, while media-server provides greater flexibility and support for multiple streaming protocols.

11,584

Ready-to-use SRT / WebRTC / RTSP / RTMP / LL-HLS media server and media proxy that allows to read, publish, proxy, record and playback video and audio streams.

Pros of mediamtx

  • Written in Go, offering better performance and concurrency handling
  • Supports more modern protocols like WebRTC and SRT
  • More active development with frequent updates and releases

Cons of mediamtx

  • Less comprehensive documentation compared to media-server
  • Smaller community and fewer contributors
  • Limited support for older streaming protocols

Code Comparison

media-server (C++):

int rtmp_server_listen(struct rtmp_server_t* rtmp, const char* ip, int port)
{
    struct aio_rtmp_server_t* server;
    server = (struct aio_rtmp_server_t*)calloc(1, sizeof(*server));
    if (NULL == server)
        return -ENOMEM;
    
    server->rtmp = rtmp;
    return aio_tcp_transport_listen(ip, port, SOMAXCONN, rtmp_server_onaccept, server);
}

mediamtx (Go):

func (s *Server) Start() error {
    for _, protocol := range s.protocols {
        if err := protocol.Start(); err != nil {
            return err
        }
    }
    s.metrics.start()
    return nil
}

The code snippets show different approaches to server initialization and startup. media-server uses C++ with manual memory management, while mediamtx leverages Go's simplicity and built-in concurrency features.

open source、high performance、industrial rtsp streaming server,a lot of optimization on streaming relay,KeyFrame cache,RESTful,and web management,also EasyDarwin support distributed load balancing,a simple streaming media cloud platform architecture.高性能开源RTSP流媒体服务器,基于go语言研发,维护和优化:RTSP推模式转发、RTSP拉模式转发、录像、检索、回放、关键帧缓存、秒开画面、RESTful接口、WEB后台管理、分布式负载均衡,基于EasyDarwin构建出了一套基础的流媒体云视频平台架构!

Pros of EasyDarwin

  • More active development with recent updates and commits
  • Broader support for streaming protocols, including RTSP, RTMP, and HLS
  • Larger community and more extensive documentation

Cons of EasyDarwin

  • Higher complexity and steeper learning curve
  • Potentially heavier resource usage due to more features

Code Comparison

EasyDarwin (C++):

int EasyDarwin::StartStreaming(const char* streamName, const char* rtspUrl)
{
    // Implementation for starting a stream
}

media-server (C):

int media_server_start_stream(const char* stream_name, const char* rtsp_url)
{
    // Implementation for starting a stream
}

Key Differences

  • EasyDarwin is primarily written in C++, while media-server is written in C
  • EasyDarwin offers a more comprehensive streaming solution with additional features
  • media-server has a simpler codebase and may be easier to integrate into existing projects

Use Cases

  • Choose EasyDarwin for complex streaming setups with multiple protocols and advanced features
  • Opt for media-server when a lightweight, simple streaming solution is needed or when working with C-based projects

Community and Support

  • EasyDarwin has a larger user base and more active community support
  • media-server has fewer contributors but may offer more direct support from the main developer
13,642

Pure Go implementation of the WebRTC API

Pros of webrtc

  • Written in Go, offering better performance and concurrency handling
  • More active development with frequent updates and contributions
  • Comprehensive WebRTC implementation, including DTLS, SRTP, and ICE

Cons of webrtc

  • Focused solely on WebRTC, less versatile for other media server use cases
  • Steeper learning curve for developers not familiar with Go

Code Comparison

media-server (C++):

int rtsp_server_listen(void* server, const char* ip, int port)
{
    struct rtsp_server_t* ctx = (struct rtsp_server_t*)server;
    return aio_socket_listen(ctx->aio, ip, port, rtsp_server_onaccept, ctx);
}

webrtc (Go):

func (s *WebRTCServer) Listen(addr string) error {
    l, err := net.Listen("tcp", addr)
    if err != nil {
        return err
    }
    s.listener = l
    return nil
}

Both repositories provide media server functionality, but with different focuses. media-server is a more comprehensive media server solution written in C++, supporting various protocols like RTSP, RTMP, and HLS. webrtc, on the other hand, is a specialized WebRTC implementation in Go, offering a modern and performant solution for real-time communication. The choice between the two depends on specific project requirements and the preferred programming language.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

libflv

  1. FLV video codec: H.264/H.265/H.266/AV1/VP8/VP9/VP10
  2. FLV audio codec: AAC/MP3/G.711/Opus
  3. FLV file read/write
  4. H.264/H.265/H.266/AV1 bitstream filter: annex-b <-> mp4 stream
  5. AAC bitstream filter: ADTS <-> ASC

librtmp

  1. rtmp-client: RTMP publish/play
  2. rtmp-server: RTMP Server live/vod streaming

libmpeg

  1. ITU-T H.222.0 PS/TS read/write
  2. ps/ts codec: H.264/H.265/H.266/AAC/MP3/G.711/Opus

librtp

  1. RFC3550 RTP/RTCP
  2. RTP with H.264/H.265/H.266/MPEG-2/MPEG-4/VP8/VP9/AV1
  3. RTP with G.711/G.726/G.729/MP3/AAC/Opus
  4. RTP with MPEG-2 PS/TS
  5. RTP Header Extension
  6. RTCP PSFB/RTPFB/XR

librtsp

  1. RFC2326 RTSP
  2. RFC4566 SDP
  3. SDP fmtp: H.264/H.265/H.266/AAC/Opus/G.711

libhls

  1. HLS M3U8: generate m3u8 file
  2. HLS Media: TS segmenter
  3. HLS fmp4 segmenter
  4. HLS Master/Playlist m3u8 parser

libdash

  1. ISO/IEC 23009-1 MPEG-DASH static(vod)
  2. ISO/IEC 23009-1 MPEG-DASH dynamic(live)
  3. DASH MPD v3/v4 parser

libmov

  1. ISO/IEC 14496-12 MP4 File reader/writer
  2. MP4 faststart(moov box before mdat)
  3. fMP4(Fragment MP4) writer
  4. MP4 with H.264/H.265/H.266/AV1/VP8/VP9/JPEG/PNG
  5. MP4 with AAC/Opus/MP3/G.711

libmkv

  1. MKV/WebM file read/write
  2. MKV/WebM live streaming

libsip

  1. sip user-agent (UAC/UAS)
  2. sip with ICE

libhttp(https://github.com/ireader/sdk)

  1. HTTP Server(base AIO)
  2. HTTP Client
  3. HTTP Cookie

Make

  1. make clean && make
  2. make RELEASE=1 (make release library, default debug)
  3. make PLATFORM=arm-hisiv100nptl-linux (cross compile)

编译说明