이 애플리케이션을 사용하면 요청 시 http mpeg ts를 mpegts/hls로 트랜스코딩하고 브로드캐스트할 수 있습니다.
application.yaml
source :
tvheadendURL : http://user:[email protected]:9981
channels :
type : tvheadend
refresh : 60 # In seconds
사용자 정의 JSON은 다음에서 읽을 수 있습니다.
application.yaml
source :
channels :
type : json
refresh : 60 # In seconds
url : file:///my/disk/channels.json or http://my.server.com/channels.json
application.yaml
source :
channels :
git :
repository : https://github.com/user/repo.git
# optional
user : youruser
# optional
pass : yourpass
branch : master
type : json
refresh : 60 # In seconds
채널.json
[
{
"number" : 1 ,
"name" : " La 1 HD " ,
"id" : " la1hd " ,
"epgID" : " La 1 HD " ,
"logoFile" : " /picons/la1hd.png " ,
"logoURL" : " http://server.com/logo.png " ,
"categories" : [ " Generales " , " TDT " ],
"ffmpegParameters" : " extra ffmpeg parameters only for this channel, this is optional, usable for MTPS extracting " ,
"sources" : [
{
"url" : " http://your/server/stream " ,
"priority" : 1 ,
"type" : " ffmpeg " <- This is used to force ffmpeg usage when raw profile (usefull for MTPS)
},
{
"url" : " udp://225.225.201.1:8008 " ,
"closeHook" : " http://myServer/hook?myChannel={{channel}}&date={{now}} " ,
"priority" : 2
},
{
"url" : " rtp://200.100.1500:1001 " ,
"priority" : 3
},
{
"url" : " hlss://my.server/my/stream.m3u8 " , <- hls or hlss(TLS)
"closeHook" : " pipe://echo " Closed channel {{channel}} when {{now}} " > example.txt " ,
"priority" : 4 ,
},
{
"url" : " dashs://my.server/my/stream.m3u8 " , <- dash or dashs(TLS)
"priority" : 5
},
{
"url" : " rtmp://my.server/rtmp/live " ,
"priority" : 6
},
{
"url" : " pipe://raspivid -o - -t 0 -fps 25 -g 50 -rot 180 -n -a 12 -b 6000000 " , <- process the inputstream of a process
"priority" : 7
}
]
}
]
Picons는 URL 또는 파일(logoFile 또는 logoURL)에서 읽을 수 있으며 logoURL은 Proxylive에 캐시되므로 클라이언트는 정의된 URL 대신 Proxylive에 picon을 요청합니다. git backend를 사용하는 경우 picon은 git 저장소의 루트에 있을 것으로 예상됩니다.
jar이 실행되는 동일한 디렉터리에 application.yml 파일을 작성해야 합니다. (/app/application.yaml에 docker가 있는 경우)
application.yaml
source :
# My Tvheadend source instance
# In case of source connection problem, retry connection in 10 seconds
reconnectTimeout : 10
# #This is optional, only used if tvheadend channel backend
tvheadendURL : http://tvheadend:9981
epg :
url : http://tvheadend:9981/xmltv/channels
refresh : 600 # 10 minutes
channels :
# Check (types of channels sources) for more information of this section
# UserAgent String used to connect backend http(s) type
userAgent : " Proxylive "
streamTimeout : 60
# Client Stream timeout, if no bytes from backend on this timeout range, the client connection will be closed
# Pros:
# -Single connection to tvheadend per channel
# -when 2 clients with HLS and mpegTS with the same transcoding profile only transcoded one time.(so less cpu usage)
# Cons:
# -Slower start when the channel is not yet initialized on HLS/or mpegTs with transcoding.
ffmpeg :
# Path where proxylive can find ffmpeg binary
path : ' /usr/bin/ffmpeg '
# #Profiles definition alias param is used in the view link, see (Url Definition) for more details of use profiles
profiles :
-
alias : " aac "
# transcoder:
# if defined all the transcoding operations will be handled by this remote proxylive server
# in this case is mandatory define the same authentication.secret on both servers.
# endpoint: http://myremoteproxylive.com
# if defined will be use this profile on the remote server, if not the alias value.
# profile: myremoteprofile
# FFmpeg parameters, check ffmpeg documentation for more info
parameters : " -i {input} {channelParameters} -sn -ac 2 -c:a aac -b:a 320k -c:v copy "
-
alias : " 240p "
parameters : " -i {input} {channelParameters} -sn -c:a:0 aac -ac 2 -b:a 64k -c:v libx264 -tune zerolatency -g 10 -vprofile high -level 4.0 -crf 18 -movflags +faststart -bufsize 15000k -maxrate 300k -preset veryslow -vf scale=-1:244,yadif=0 "
-
alias : " 360p "
parameters : " -i {input} {channelParameters} -sn -c:a:0 aac -ac 2 -b:a 96k -c:v libx264 -tune zerolatency -g 10 -vprofile high -level 4.0 -crf 18 -movflags +faststart -bufsize 15000k -maxrate 700k -preset veryslow -vf scale=-1:360,yadif=0 "
-
alias : " 480p "
parameters : " -i {input} {channelParameters} -sn -c:a:0 aac -ac 2 -b:a 196k -c:v libx264 -tune zerolatency -g 10 -vprofile high -level 4.0 -crf 18 -movflags +faststart -bufsize 15000k -maxrate 1500k -preset slow -vf scale=-1:484,yadif=0 "
-
alias : " 720p "
parameters : " -i {input} {channelParameters} -sn -c:a:0 aac -ac 2 -b:a 320k -c:v libx264 -tune zerolatency -g 10 -vprofile high -level 4.0 -crf 18 -movflags +faststart -bufsize 15000k -maxrate 3000k -preset fast -vf scale=-1:720,yadif=0 "
-
alias : " 1080p "
parameters : " -i {input} {channelParameters} -sn -c:a:0 aac -ac 2 -b:a 320k -c:v libx264 -tune zerolatency -g 300 -vprofile high -level 4.0 -movflags +faststart -bufsize 15000k -maxrate 5000k -preset faster -vf yadif=0 "
mpegTS :
parameters : " -threads 0 -f mpegts -mpegts_m2ts_mode 1 -mpegts_copyts 1 -mpegts_flags +resend_headers "
# Specific parameters for mpegTS(only works if a diferent profile than raw is selected, raw send direct data from backend so no transcoded, in this case not applied this parameter.
hls :
# by default HLS is disabled
enabled : false
tempPath : " /tmp "
# Path where HLS will save segment files and playlist
parameters : " -flags -global_header -avoid_negative_ts disabled -map_metadata -1 -start_at_zero -copyts -flags -global_header -vsync cfr -y -nostats -f hls -hls_time 2 -hls_list_size 10 -hls_wrap 20 -hls_allow_cache 0 -hls_flags +append_list -hls_flags +discont_start -hls_flags +delete_segments "
# FFmpeg parameters specific for HLS
timeout : 30
# When user disconnect from stream, we doesnt have any way to be sure the user is totally disconnected so this parameter control how many seconds since last download of a segment of a concret stream, if the timeout is reached, the timeout is canceled.
buffers :
# The max amount of bytes the application can read from a stream, default 1MB in a single action
chunkSize : 1048576
# Buffer size of the broadcast buffer,larger buffer more stable but larger delay than source stream, default 50MB
broadcastBufferSize : 52428800
# ## Authentication
plex 인증 ldap을 사용하거나 application.yaml에 이를 추가하지 않고(기본값) "채널 허용" 옵션이 있는 모든 plex 친구가 프록시 라이브에서 스트리밍할 수 있습니다.
authentication :
secret : xxxxxxxxx # 512 bits Secret, if not defined will generated randomly per each start
# recomended use persistent secret or tokens will be invalid in case of restart
expireInHours : 48 # JWT expire time in hours
# For plex auth
plex :
# every refresh time in seconds we will fetch users that are allowed to login
refresh : 10800
adminUser : " plexOwnerUser "
adminPass : " plexOwnerPass "
serverName : " MyPlexServerName "
# For LDAP auth (not implemented yet)
ldap :
server : " ldap://server:389 "
username : " user "
pass : " pass "
searchBase : " dc=ad,dc=my-domain,dc=com "
클라이언트 사용자는 ?user=user&pass=pass 또는 ?token=xxx URL에 연결하여 연결합니다.
http://localhost:8080/channel/list/mpeg/1080p?user=myplexuser&pass=myplexpass
토큰을 사용하는 경우 다음을 통해 복구할 수 있습니다.
TOKEN=$(curl --location --request POST 'localhost:8080/login'
--header 'Content-Type: application/x-www-form-urlencoded'
--data-urlencode 'username=xxxxxxx'
--data-urlencode 'password=xxxxxx')
http://{server}:8080/view/{profile}/{channelID}에서 방송된 스트림을 얻을 수 있습니다.
http://[서버]:8080/채널/목록/[형식]/[프로필]
인증이 활성화된 경우
http://[서버]:8080/channel/list/[형식]/[프로필]?token=xxx
http://[서버]:8080/epg
애플리케이션이 실행 중인 호스트의 IP 또는 도메인
이는 yaml 구성에 정의된 프로필이며 ffmpeg 비디오 인코딩 구성의 별칭입니다. 기본적으로 1080p, 720p, raw, aac 프로필이 있으며 필요에 따라 추가하거나 수정할 수 있습니다.
소스 스트림 식별. 이 ID는 채널을 식별하는 데 사용됩니다. tvheadend 백엔드를 사용하는 경우 채널 ID는 tvheadend http://tvheadend:9981/stream/channel/{id}에서 streamID와 같습니다.
서버가 라이브 스트리밍을 스트리밍하는 형식입니다.
무엇을 선택해야 할지 모르겠다면 mpeg를 사용하세요
빌드하려면 JDK > 1.9 및 maven 3.5.2가 설치되어 있어야 합니다.
그 다음에...
git clone https://github.com/segator/proxylive
cd proxylive
mvn clean install
# you will have a file called dist/proxylive.jar
docker run --name=proxylive -p 8080:8080 --restart=always -d -v /my/application.yml:/app/application.yml:ro segator/proxylive
먼저 실행하려면 Java jre 1.9 이상이 설치되어 있어야 합니다.
# #Remember to have the application.yml in the working directory before run the app
java -jar proxylive.jar