Error when using the tee pseudo-muxer in FFMPEG
Use

-i input.mov -c:v libx264 -map 0:v -flags +global_header -f tee "output.mkv|[bsfs/v=dump_extra=freq=keyframe]output.264"


The required format of H264 bitstreams can differ based on how it is stored. Containers like MKV and MP4 require that the bitstream parameters be stored globally. Usually the encoder embeds them within the bitstream itself, which is how raw H264 bitstream (.264, .h264) is stored. Now, the encoder normally separates out this metadata or not based on how ffmpeg signals what the output muxer wants. But the tee muxer doesn't represent any container. It is an intermediate layer added to allow reuse of payload packets into multiple outputs. So there is no effective signaling from muxer to encoder.

In your particular use, the added complication is that the two output formats require different bitstream formats. The added global header tells the encoder to generate a MP4/MKV-compatible bitstream and then the bsf filter reinserts the metadata for the .264 output.