Problems with the speed of data transfer with RTMPS

I’m facing an issue with the data transfer speed to the RTMPS server. This problem occurs repeatedly. I created a project and wrote the code for streaming to the server, and initially, the streaming worked fine. However, after some time, around 1 hour or even less, the data transfer speed became extremely low, causing the stream to stop due to timeouts. I initially thought that the Replit servers might be overloaded due to other users, but when I created a new project and used the same code, the speed was normal again. However, after a similar amount of time, the same issue occurred once more. What should I do if Replit is limiting the connection speed?
Знімок екрана 2023-08-26 102754

Maybe the problem is related to the ffmpeg settings?

import subprocess
import os

video_path = 'video.mp4'  # Path to your MP4 file
telegram_server = 'rtmps://dc4-1.rtmp.t.me/s/'
telegram_key = 'stream_key'

ffmpeg_folder = 'path_to_ffmpeg_folder'  # Path to the folder containing the "ffmpeg" executable

ffmpeg_path = os.path.join(ffmpeg_folder, 'ffmpeg')

ffmpeg_command = [
    ffmpeg_path,
    '-stream_loop', '-1',  # Add the option for infinite looping
    '-re', '-i', video_path,
    '-c:v', 'copy', '-c:a', 'aac', '-f', 'flv',
    telegram_server + telegram_key
]

ffmpeg_process = subprocess.Popen(ffmpeg_command)
ffmpeg_process.wait()
ffmpeg_process.terminate()

And downloaded, unpacked ffmpeg
https://johnvansickle.com/ffmpeg/

I looked at the transfer rate, and it seems that Replit does not limit, something is wrong with my ffmpeg settings

Hi @KirilDoniets2, welcome to the forums!

Could you share a link to your repl, or enclose the code in triple back quotes?

1 Like