zhangpeihao / gortmp

Implement RTMP protocol by golang
MIT License
525 stars 160 forks source link

Publish-er demo to Twitch #41

Open a67s opened 7 years ago

a67s commented 7 years ago

Thanks for the lovely repo.

I had a go at using the ./publisher to stream to Twitch (https://www.twitch.tv/)

./publisher --FLV file.flv --URL rtmp://live.twitch.tv/app/[key]

this gives a message

to dial                                                                                                                  
a
b
to connect
c
@@@@@@@@@@@@@status: 3, err: <nil>
ReceviedRtmpCommand: &{IsFlex:false Name:_result TransactionID:1 Objects:[map[capabilities:31 mode:1 fmsVer:FMS/3,5,7,7009
] map[description:Connection accepted. data:map[string:3,5,7,7009] objectEncoding:0 level:status code:NetConnection.Connec
t.Success]]}
@@@@@@@@@@@@@status: 5, err: <nil>
Stream created: 1
ReceviedRtmpCommand: &{IsFlex:false Name:_result TransactionID:2 Objects:[<nil> 1]}
Audio size: 0 bytes; Vedio size: 0 bytes
Audio size: 0 bytes; Vedio size: 0 bytes

looks like the OnPublishStart callback does not get called

i have verified the file.flv with ffmpeg ( ffmpeg -re -i file.flv -c copy -f flv rtmp://live.twitch.tv/[...]) and it works correctly

the file was generated with ffmpeg

 ffmpeg -i input.mkv -c:v libx264 -preset medium -maxrate 3000k -bufsize 6000k -vf "scale=1280:-1,format=yuv420p" -g 50 -c:a aac -b:a 128k -ac 2 -ar 44100 file.flv

it feels like a problem with RTMP

best to my knowledge Twitch should be accessible from China

thanks for the great repo and your effort, and would be very cool if this worked with Twitch!