[FFmpeg-user] Add delay to stream on twitch/youtube/restream.io, add chat and alerts

KoreanFanOfficial koreanfanofficial at gmail.com
Tue Jun 16 01:49:38 EEST 2020


After some researching i got working code:
## record screen and use delay filters
ffmpeg -y -f x11grab -video_size 1920x1008 -framerate 30 -i :0.0+0,36 -f
pulse -ac 2 -i default \
-vf 'tpad=start_duration=10:color=0xFFFFFF,scale=1280x720' -c:v libx264 -g
60 -preset ultrafast \
-b:v 3M -maxrate 3M -pix_fmt yuv420p -af 'adelay=10000|10000' -c:a aac -b:a
128k -ar 44100 \
-f flv 1.flv
or
##record screen with overlay and delay filters
ffmpeg -y -f x11grab -video_size 1920x1080 -framerate 30 -i :0.0+0,0 \
-f pulse -ac 2 -i default -i logo.png -i screenlogo.png -filter_complex \
"[0:v]tpad=start_duration=10:color=0xFFFFFF,scale=1280:-1,setpts=PTS-STARTPTS[bg];
\
[1:a]adelay=10000|10000[a]; \
[2:v]scale=162:-1,setpts=PTS-STARTPTS[bg2]; \
[3:v]scale=120:-1,setpts=PTS-STARTPTS[bg3]; \
[bg][bg2]overlay=0:H-h[bg4]; \
[bg4][bg3]overlay=W-w:0[v]" \
-map "[v]" -map "[a]" -c:v libx264 -g 60 -preset ultrafast \
-b:v 3M -maxrate 3M -pix_fmt yuv420p -c:a aac -b:a 128k -ar 44100 \
-f flv 1.flv
But if i use this code for streaming there were no delay video and audio,
video and audio start play immediately without 10 sec delay for audio and
video.
About "alerts" and "chat". You can use browser source in obs for playing
chat from twitch/youtube/restream.io and alerts(donations, etc) . How i can
do it with ffmpeg?

пн, 15 июн. 2020 г. в 22:18, Carl Zwanzig <cpz at tuunq.com>:

> On 6/15/2020 10:17 AM, Rob Hallam wrote:
> > Is this still true? In OBS, Settings → Advanced there is a "Stream Delay"
> > section (mentioned onhttps://obsproject.com/wiki/OBS-Studio-Overview).
> >
> > The default setting of 20s estimates mem usage of 11MB; I set the option
> > to 120s which increased the memory usage estimate to 69MB. Even five
> > minutes 'only' uses 174MB.
>
> I'd assume that obs is delaying encoded stream packets, not something that
> an ffmpeg filter can do (they work on uncompressed frames between decode
> and
> encode).
>
> Best thing is for the OP to try it and see if that's what they need.
>
> z!
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-user mailing list