Telethon| Send video with streaming support - python

How do I send a video with streaming support?
I tried it like this:
client.send_file(userentity, 'video.mp4', attributes=(DocumentAttributeVideo(duration,w,h),), supports_streaming=True, force_document = False, progress_callback=handle_progress)
And I got a video without streaming support:
how do I get such a video? (with streaming):

Related

Python socket video transfer along with other data ( like list[] )

I was making an tkinter application which can share the video frame from one device to another..
I did that video streaming code from github..
https://github.com/AmimaShifa/Live-Video-Streaming-Application.git
But, it only transfer video.. I need to transfer a list of data along with that video in both way.. like, the server will send gps cords and clint will send button status...
like that..
is it possible..?

Streaming video file from flask server to react js client

I am creating a "Youtube Clone" using Python Flask on the backend and React JS on the server side, and I currently need to stream the video from a file on the server.
This is what I currently have:
#app.route('/api/video/<string:video_id>')
def ShowVideo(video_id):
video = Video.query.filter_by(id = video_id).first() #"Video" is the video database (using SQLAlchemy)
if video is None:
return {"return":"401"} #video doesn't exist in database
#return ??
now I have the video id and path in the database, and I need to stream it over http to a React JS website
I've seen people using OpenCV to stream, and put an image in the JS client, but from what I've seen it does not work with a video file already on the computer (I can be mistaken, I'm not sure).
Another thing I've seen is using JS to send the video directly to the browser (like in this video, but I don't think this will work for my circumstances)
Does anyone have any idea?

How to upload instant playable video to telegram

I am making a telegram bot to upload videos in my local PC. But when I sent the video, that message is very dumb. like this
Image 1
But I need videos like this
Image 2
Image 3
my code is
from pyrogram import Client
app = Client(
"session",
api_id=329,
api_hash="7943a36fdcf9"
)
with app:
app.send_video(chat_id = channel, video = 'vid.mp4',supports_streaming = True)
is there any specific specific methods for sending a proper video? How can I send a video properly
Your video file is too big. Telegram will handle videos < 10 MB and automatically create a thumbnail for you. For videos larger than that you'll have to supply the information about the video yourself. Resolution (width and height), length, thumbnail, etc..
Additionally, you can omit the supports_streaming argument, as Pyrogram defaults this to True anyway.
To get information about your video you could use something like ffprobe.
The docs show that you can add arguments caption and thumb to your call to send_video.

Azure Speech SDK Speech to text from stream using python

I am trying to send the stream from UI to python API as stream. I need python Azure Speech logic to convert the speech to text. I am not sure about how to use pull/pusha audio input stream for speech to text
In my case I receive an audio stream from some other source. When the connection with my application is made (upon reception of the first package), a PushAudioInputStream is started. This stream pushes the data to SDK for each package that is received. The speech recognition with push stream is thus used in this case. See snippet of code below. This has worked for my case.
if newConnection:
stream = speechsdk.audio.PushAudioInputStream()
speech_recognition_with_push_stream(stream)
stream_data = base64.b64decode(data)
stream.write(stream_data)
There is a sample for using cognitive services speech sdk.
Specifically, for using it with pull stream, you may refer to: speech_recognition_with_pull_stream() , and for using it with push stream, you may refer to: speech_recognition_with_push_stream().
Hope it helps.

python lossless audio recording+http streaming library

I am working on a simple service to remotely record line input from an audio interface attached to a server, via REST API request.
My current solution, using PyAudio to manage the audio interface:
1) send HTTP request to start recording to a file on server filesystem.
2) send HTTP request to stop recording and pull the recorded audio file from the server filesystem
Instead, I would like to be able to just "stream" the line input to any http client who wants to download the audio stream.
Is there any simple python library solution to lossless http audio streaming directly from any audio interface's input?
More importantly, does this make sense or should I use RTSP instead? (More than efficiency I would like to focus on being able to download the audio stream by a simple http link on a browser or even via curl or simple programmatic request, and I'll usually not have more than one connected client at a time, that's why I'd prefer to avoid RTSP.)
I have done this using Python flask to provide the REST endpoint to stream audio, and the pyfaac module to pack PCM frames into the AAC format (this format is needed for streaming). Then, for example, you use the standard HTML5 audio tag with src set to your streaming endpoint.

Categories

Resources