I am streaming a session using rtmp server(NGINX). I got the stream url as
rtmp://ip:port/live/stream_name
.
How can I read the live stream in my python code(or any other) to do live transcription?
Asked
Active
Viewed 1,050 times
0

Telugu Tracker
- 1
- 1
-
Does this answer your question? [Live Speech to Text Transcription in Python](https://stackoverflow.com/questions/65987662/live-speech-to-text-transcription-in-python) – DialFrost Aug 12 '22 at 07:42
-
Thank you for the reply. But, I would like to do transcription from the rtmp stream directly – Telugu Tracker Aug 23 '22 at 05:25
1 Answers
1
You have to use one of libraries that allow such process, one of the most commonly used is OpenCV.
Install through pip:
python3 -m pip install opencv-python
Code sample
import cv2 # Import OpenCV lib
cap = cv2.VideoCapture('<your RTMP url>') # Open video source as object
while cap.isOpened(): # Untill end of file/error occured
ret, frame = cap.read() # Read frame as object - numpy.ndarray, ret is a confirmation of a successfull retrieval of the frame
if ret:
<your code here>
else:
break
cap.release()

skylighty
- 21
- 3