'How to pause/resume ongoing ffmpeg rtmp stream via python

I have downloaded an audio file and I am streaming it on my client, What I want is when the user click pause button I want to pause the music and similarly resume it, how can I do so via ffmpeg? I am making commands via python and subprocess module to stream the music on my client. Also I have many users at same time and I want to only pause the music which the user requested, I am streaming the music via:

import subprocess
subprocess.run("""ffmpeg -stream_loop -1 -re -i "video.mp4" -c:v copy -c:a aac -ar 44100 -ac 1 -f flv rtmps://dc1-1.rtmp.t.me/s/10909994:xxxxx""")

I dont know a better approach than running subprocess, is there any good workaround to serve different audios to many users at once?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source