This example uses pipe to chain transcoding and packaging together. Another option is to use socket.
Assuming you have a live iptv stream available at 225.1.1.8:8001 at port 8001 with interface address 172.29.46.122.
Create Pipe
Transcoding Command
Option -speed 4 tells the encoder to encode really fast, sacrificing quality. This is needed otherwise ffmpeg is not fast enough to keep up with the live stream.
Packaging Command
Option -io_block_size 65536 tells packager to use an io_block_size of 65K for threaded io file. This is necessary as reading from pipe blocks until the specified number of bytes, which is specified in io_block_size for threaded io file, thus the value of io_block_size cannot be too large.
This example can be easily extended to support more streams and add encryption.