The invention discloses a live recording and broadcasting method for synchronously transmitting MIDI based on the RTMP protocol. Firstly, by collecting images, audio and MIDI signals, and encoding and compressing the collected images and audio respectively; secondly, compressing the collected MIDI signals and encoding The audio is mixed, and the encoded and compressed images are pushed to the server together, and the encoded and compressed images, mixed audio and MIDI signals are recorded and broadcasted at the same time; then, based on the RTMP protocol, the mixed audio and MIDI signals are pulled from the server and separated. MIDI data, decode audio data and image data at the same time; then, integrate the decoded image data and audio data into playback audio and video, and send the separated MIDI data to the musical instrument; finally, realize the synchronous linkage between audio and video playback and musical instruments . Based on the RTMP protocol, the invention transmits MIDI, audio, and images synchronously and saves the MIDI data after transferring to M3U8. The live recording and broadcasting of musical instruments can be realized, and users can also choose live broadcasting or recording broadcasting according to needs, which has strong applicability.