# srt_encoder
**Repository Path**: dataup/srt_encoder
## Basic Information
- **Project Name**: srt_encoder
- **Description**: srt encoder
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 1
- **Forks**: 0
- **Created**: 2021-08-20
- **Last Updated**: 2022-04-05
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
English | [中文](https://github.com/runner365/srt_encoder/blob/master/README-Cn.md)
# SRT Encoder
An adaptive encoder based on SRT.
The encoder estimate the output bitrate based on rtt, maxBw, inflight to implement the adaptive bitrate encoder.
- ffmpeg commnand
It only need to replace ffmpeg.c and add srt_header.h in fftools fold. Then compile the ffmpeg which supports the adaptive encoder.
- based on srt protocol
srt is a simple, low latency, high efficient transport protocol.
- based on bbr congestion algorithem
It estimates the bitrate by bbr.
## 1. introduction
The encoder estimate the output bitrate based on rtt, maxBw, inflight and use the bbr algorithem to implement the adaptive bitrate encoder.
## 2. how to compile
The ffmpeg depends on libsrt, libx264, libfdk_aac.
### 2.1 replace ffmpeg.c
The adaptive encoder is developed based on ffmpeg4.1. It need to replace ffmpeg.c and add srt_header.h in fftools fold.
ffmpeg4.1 official download: [ffmpeg-4.1.tar.xz](https://johnvansickle.com/ffmpeg/release-source/ffmpeg-4.1.tar.xz)
### 2.2 compile ffmpeg
go to wiki:[How to compile](https://github.com/runner365/srt_encoder/wiki/How-to-compile-en)
## 3. how to use it
### 3.1 srt in srs
srs is live server which supports rtmp/hls/rtp live service.
Now it supports srt live service in "develop" branch.
srs github:[https://github.com/ossrs/srs](https://github.com/ossrs/srs)
How to use srt service in srs,go to wiki:[v4_CN_SRTWiki](https://github.com/ossrs/srs/wiki/v4_CN_SRTWiki)
### 3.2 srt encoder
run command:
ffmpeg -re -i source.mp4 -c:v libx264 -s 640x360 -b:v 700k -c:a libfdk_aac -ab 64k -ar 44100 -ac 2 -f mpegts 'srt://127.0.0.1:10080?streamid=#!::h=live/livestream,m=publish'
Note:
* can't configure -crf
crf can't be configured because crf mode conflict with the adaptive bitrate mode in ffmpeg.
* can't configure -qp
qp can't be configured because qp mode conflict with the adaptive bitrate mode in ffmpeg.
* the media format must be mpegts in srt