rtmp: Add a function for writing AMF strings based on two substrings