Updates
im still having aac encoder/decoder issues in ffmpeg but it doesnt seem to cause issues when viewing on twitch
I think i solved my issue by not using rtsp/rtmp out of obs, ive swapped to SRT out of OBS and FOR NOW it seems fine, im also reading that SRT stream in FFMPEG when forwarding to twitch (but still outputting in the required flv)
there was still an error for to many out of order frames, setting mediamtx’s udpReadBufferSize higher seems to have maybe fixed it
also trying to disable B frames because of this https://github.com/bluenviron/mediamtx/issues/3091
if you are transcoding and not copying in ffmpeg, make sure ffmpeg encodes to a valid format that wont cause youtube to end the stream. ffmpeg defaulted to encoding to mp3 audio, it would work for awhile but youtube would end the stream. atleast i think this is what was causing the error code -32 (broken pipe) error.
Im still getting the error even after fixing all the wrong encoder settings, this project is just cursed
Notes
Notes on how to self host a restream like service that supports the twitch vod track.
Just use an obs plugin if you have the bandwidth, this shit is so annoying.
the twitch vod track is just using the enhanced rtmp protocol that supports multitrack audio/video so its as simple as having a version of ffmpeg that supports multitrack flv and then forwarding your stream to twitch with ffmpeg. You need a server that can receive your rtmp stream from obs, mediamtx is the easiest ive found to setup.
setup and run mediamtx on a VPS rtmp://vsp_ip/stream-in
ffmpeg -loglevel warning -i rtsp://localhost:8554/stream-in \
-c copy -map 0 \
-f flv rtmp://use10.contribute.live-video.net/app/$TWITCH_STREAM_KEYpaths:
stream-in:
runOnReady: >
ffmpeg -loglevel warning -rtsp_transport tcp -i rtsp://localhost:8554/stream-in -c copy -map 0 -f flv rtmp://use10.contribute.live-video.net/app/$TWITCH_STREAM_KEY
runOnReadyRestart: yes
==make sure the -rtsp_transport tcp comes before the -i ==
https://github.com/bluenviron/mediamtx/issues/3032 This might have saved my life.
then use the script from the above link to allow multiple platforms. Im working on my own custom script for this https://github.com/DerrikCreates/multistream-scripts. eventually i want to have a proper docker-compose file that setup a vpn and mediamtx so that its easy to multistream while being as secure as possible while still being lazy
runOnReady: >
ffmpeg -loglevel warning -rtsp_transport tcp -i rtsp://localhost:8554/stream-in -c copy -map 0 -f flv rtmp://use10.contribute.live-video.net/app/$TWITCH_STREAM_KEYIssues and solutions
I have many errors from ffmpeg when forwarding. I can just copy but for some reason chrome gets error 3000 on twitch when copying
the solution seems to reencode the audio