7

I want to stream a video file using RTMP protocol to an rtmp server using Python.

A python script that will stream a single video file to an RTMP Server (in my case nginx), to the link:

rtmp://<ip>/stream/<stream_name>

So, ideally the video file will be streamed with a <Stream_name>. Next i want this stream_name to be generated in a series, for example: stream_1, stream_2,....stream_n. Then i would want the stream link: rtmp://<ip>/stream/<stream_name> being pushed n times, but in each iteration, the stream name is incremented from "stream_1" to "stream_2" and so on.

I am currently struggling to find the right library to do this in Python.

2
  • Hi @NeelDutta are u able to stream video on RTMP server? if yes can you please let me know which python lib u have used ? Commented Feb 24, 2023 at 18:01
  • Not python, but in bash I've been doing this with ffmpeg -stream_loop -1 -i /PATH/TO/VIDEO.MP4 -b:v 50M -f flv rtmp://127.0.0.1/live/ (where you can swap in your own rtmp server url) Commented May 22, 2023 at 20:54

1 Answer 1

3

The key in here is FFMpeg. Use any suitable wrapper of FFMpeg based on your needs. Here is the first one in Google: https://pypi.org/project/python-ffmpeg-video-streaming/

Sign up to request clarification or add additional context in comments.

1 Comment

Yup I realized it after posting it! 😂😂😂 Anyways got my job done by using a python script to simulate multiple ffmpeg instances

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.