FFmpeg: Convert video clip to Transport Stream

Ever needed to convert a video clip (MKV, MP4, etc) to a transport stream file? Here's how:

ffmpeg -i INPUT.mkv -c:v libx264 -c:a aac -ar 48k -b:a 192k -pix_fmt yuv420p -streamid 0:100 -streamid 1:101 -mpegts_flags latm OUTPUT.ts

You will need to modify the command above to meet your needs - the PIDs to use along with codecs, bitrates etc. Below explains what each flag is for: