I've been experimenting with streaming via FFMpeg. I love how powerful it is! Currently I have it set up so that it streams my screen and adds an overlay for my webcam. Though, there is one thing that I'd like to be able to do that I just can't quite figure out: Throw up an on-demand splash screen.
Perhaps this would be better explained via example. Say you're streaming a game or something via Twitch for a long while. Then, you have to step away. You could
- Just walk away, or
- Throw up a "Be right back!" splash screen or something, perhaps with a little music (I've got that part figured out thanks to the awesomeness of Pulseaudio)
I figured the best way to accomplish this was via a second overlay that overlays the screen/webcam overlay.
I attempted to add a third input akin to this:
ffmpeg -f v4l2 -i /dev/video0 -f xllgrab -i :0.0+738,0 \ -i ~/splashscreen.png -loop 1 \ -filter_complex "[0:1][0:0]overlay=0:0[out];[out][2:0]overlay=0:0[final]" \ -f flv ~/Videos/test.flv
This requires a newer version of ffmpeg than is in the Saucy repos.
And it worked, as the splash screen was transparent. I thought I'd do something clever and swap in a non-transparent image when I needed the splash screen but either ffmpeg caches the looped image or it ignores it when it suddenly can't find the file for a brief instance.
The second way I thought of was perhaps using a named pipe and using another ffmpeg instance to pipe in they overlay splash screen when I need it, but from what I've read, if ffmpeg doesn't find any data in the pipe it will not continue processing the rest of the video, instead it will only put out frames when it can pull from all the input sources.
If there are any ffmpeg gurus out there, I'd love to hear some ideas!