Really neat project. Small optimization, you can use the RPI’s gpu accelerated h264 decoding and free up a lot of CPU:
Change:
ffmpeg -vcodec libxh264
To: ffmpeg -vcodec h264_mmal
replies(1):