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

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..?

Related

Export GnuRadio datas to create a webSDR

I am an intern and I work on a project to create WebSDR. I need to create a web interface that allows users to observe the activity on the frequency range they want (with a waterfall graph) and also transmit the sound on the chosen frequency.
example of a websdr
For this purpose we have an SDR connected to a local server and running GNURadio. (I show you the block diagram as it is now, it is obviously not final)
global architecture
I then created a server code in python which retrieves the data sent in UDP via the "UDP Sink" block which for the moment simply transmits it in text to the client code in javascript to display it on an html page. (I will send you the codes if needed)
server
client.js and client.html
I'm stuck now, I can't find any resources on the internet for the rest. I would like to process the data on the server in order to create an audio data stream that would be streamed to the web client. But also a way to create a waterfall graphic, which I will convert to an image afterwards and which will be sent to the client every second to give the impression that the waterfall graphic is refreshed regularly.
Please can you give me some answers to create these two features. I am open to other proposals as well if the method I want to apply is not the right one.
Thank you very much,

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.

HLS live stream server

I am planning to write my own live stream server in python using the HLS protocol for a small project.
My idea is to use Amazon S3 for storage and have the python server just output the m3u8 file.
This is all straightforward, now to the problem: I want to stream live video from a camera over an unreliable network and if there is a congestion the player could end up with completing playing of the last file referenced in the m3u8 file. Can i in some way mark the stream as a live stream having the player try again reloading the m3u8 for a specific time looking for a next segment or how should live streaming using HLS be handled?
Maybe live streaming over HLS is not supported?
This is explictly allowed in the HLS spec as a "live Playlist". There are a few things you need to be aware of, but notably, from section 6.2.1:
The server MUST NOT change the Media Playlist file, except to:
o Append lines to it (Section 6.2.1).
And if we take a look at Section 4.3.3.4:
The EXT-X-ENDLIST tag indicates that no more Media Segments will be added to the Media Playlist file. It MAY occur anywhere in the Media Playlist file.
In other words, if a playlist does not include the #EXT-X-ENDLIST tag, it's expected that the player will keep loading the playlist from whatever source it originally loaded it from with some frequency, looking for the server to append segments to the playlist.
Most players will do this taking into account current network conditions so they have a chance to get new segments before the playback is caught up. If the server needs to interrupt the segments, or otherwise introduce a gap, it has the responsibility to introduce a #EXT-X-DISCONTINUITY-SEQUENCE tag.
Apple provides a more concrete example of a Live Playlist on their developer website.

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