闲碎记事本 闲碎记事本
首页
  • JAVA
  • Cloudflare
  • 学完再改一遍UI
友链
  • 分类
  • 标签
  • 归档
GitHub (opens new window)

YAN

我要偷偷记录...
首页
  • JAVA
  • Cloudflare
  • 学完再改一遍UI
友链
  • 分类
  • 标签
  • 归档
GitHub (opens new window)
  • java

    • SpringBoot

    • SpringSecurity

    • MybatisPlus

    • Netty

    • sip

      • SIP使用
      • GB28181
      • GB35114
      • SM2工具类
      • SM3工具类
      • 证书构建
      • 使用注解实现XML构建与解析
      • 流媒体服务器
        • SRS
          • 安装
          • 推流
          • RTMP
          • 播放地址:
        • ZLM
          • 安装
          • 编译
        • 推流
          • 使用rtsp方式推流
          • 使用rtmp方式推流
          • 使用rtp方式推流
          • 桌面录制
        • URL 规则
          • RTSP
          • RTMP
          • HLS(mpegts)
          • HLS(fmp4)
          • .live.ts
          • .live.mp4
      • FFmpeg
    • 其他

  • linux

  • docker

  • redis

  • nginx

  • mysql

  • 其他

  • 环境搭建

  • 知识库
  • java
  • sip
YAN
2024-01-12
目录

流媒体服务器

# SRS

# 安装

version: "2"
services:
  srs:
    restart: "always"
    container_name: srs
    image: registry.cn-hangzhou.aliyuncs.com/ossrs/srs:5
    ports:
      - "1935:1935"
      - "1985:1985"
      - "8080:8080"
      - "8000:8000"
    environment:
      CANDIDATE:  能访问到的地址

# 推流

# RTMP
ffmpeg -re -i zz.mp4   -vcodec libx264 -acodec aac  -f flv "rtmp://192.168.1.100/live/livestream"
# 播放地址:

RTMP: rtmp://192.168.1.100/live/livestream

HLS: http://192.168.1.100:8080/live/livestream.m3u8

FLV: http://localhost:8080/live/livestream.flv

# ZLM

# 安装

version: "2"
services:
  ZLMediaKit:
    restart: "no"
    container_name: ZLMediaKit
    image: zlmediakit/zlmediakit:master
    #  image: zlmediakit/zlmediakit:Release.1.0.2
    ports:
      - "1935:1935"
      - "180:180"
      - "1443:1443"
      - "1554:1554"
      - "1935:1935/udp"
      - "1554:1554/udp"
      - "10000:10000"
      - "10000:10000/udp"
      - "8000:8000/udp"
      - "9000:9000/udp"
      - "35000-35010:35000-35010/tcp"
      - "35000-35010:35000-35010/udp"
    volumes:
      - ./conf:/opt/media/conf
      - ./log:/opt/media/bin/log

# 编译

clone 项目

sh build_docker_images.sh -t build -p x86_64  -m Release -v 1.0.2

# 推流

# 使用rtsp方式推流

# h264推流
ffmpeg -re -i "/path/to/test.mp4" -vcodec h264 -acodec aac -f rtsp -rtsp_transport tcp rtsp://127.0.0.1/live/test
# h265推流
ffmpeg -re -i "/path/to/test.mp4" -vcodec h265 -acodec aac -f rtsp -rtsp_transport tcp rtsp://127.0.0.1/live/test

# 使用rtmp方式推流

# rtmp推流
ffmpeg -re -i "/path/to/test.mp4" -vcodec h264 -acodec aac -f flv rtmp://127.0.0.1/live/test

# 使用rtp方式推流

# h264推流
ffmpeg -re -i "/path/to/test.mp4" -vcodec h264 -acodec aac -f rtp_mpegts rtp://127.0.0.1:10000
# h265推流
ffmpeg -re -i "/path/to/test.mp4" -vcodec h265 -acodec aac -f rtp_mpegts rtp://127.0.0.1:10000

# 桌面录制

ffmpeg -re  -f gdigrab  -i desktop -vcodec h264 -acodec aac -f rtp_mpegts rtp://127.0.0.1:10000

ffmpeg -f gdigrab -framerate 30 -i desktop -fflags nobuffer -probesize 32 -analyzeduration 0 -c:v libx264 -preset ultrafast -tune zerolatency -g 30 -b:v 2M -s 1280x720 -f rtp_mpegts rtp://192.168.1.226:10000

# URL 规则

# RTSP

rtsp://127.0.0.1:554/rtp/test

# RTMP

rtmp://192.168.1.226:1935/rtp/test

http://192.168.1.226/live/test.live.flv

ws://192.168.1.226/live/test.live.flv

# HLS(mpegts)

http://192.168.1.226/live/test/hls.m3u8

# HLS(fmp4)

http://192.168.1.226/live/test/hls.fmp4.m3u8

# .live.ts

http://192.168.1.226/live/test.live.ts

ws://192.168.1.226/live/test.live.ts

# .live.mp4

http://192.168.1.226/live/test.live.mp4

ws://192.168.1.226/live/test.live.mp4
上次更新: 2025/05/14, 01:34:05
使用注解实现XML构建与解析
FFmpeg

← 使用注解实现XML构建与解析 FFmpeg→

最近更新
01
Caddy操作指南
04-25
02
Swap空间
04-22
03
Alist使用
04-21
更多文章>
Theme by Vdoing | Copyright © 2022-2025 YAN | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式