How to send video using UDP socket in Python: Socket Programming tutorial

Поділитися
Вставка
  • Опубліковано 17 січ 2025

КОМЕНТАРІ • 88

  • @pyshine_official
    @pyshine_official  2 роки тому

    Recommended:
    How to control robot car using Python and Web browser in mobile devices including Android and iOS pyshine.com/Video-streaming-and-car-control-with-Python/

  • @MaxMax-wy7bi
    @MaxMax-wy7bi 2 роки тому +1

    It only works when I connect the Pi via HDMI to a desktop. There is an error if I am connected via SSH to VS Code, which says that the transmitting window cannot open. What is the problem?

  • @meetpatel3544
    @meetpatel3544 3 роки тому +3

    Pls make video on live video call using opencv pls

  • @kailashg4829
    @kailashg4829 2 роки тому +1

    can you post video streaming using tcp protocal

  • @kailashg8620
    @kailashg8620 2 роки тому

    Will it it possible to stream in another system?

  • @larmaths9790
    @larmaths9790 4 місяці тому

    Thank you for the vidéo,version helpful

  • @roaaeb1894
    @roaaeb1894 3 роки тому +1

    Is this streaming video is based on WebSocket or socket? and what is the difference between them?

    • @pyshine_official
      @pyshine_official  3 роки тому

      This one is using socket. For websocket pyshine.com/Online-Video-Processing-From-Client-Camera/

  • @nuosaviour6362
    @nuosaviour6362 2 роки тому +1

    thank you so much! but when i run the code, i find that the video sent and received is played faster than it should be, the frame rate is higher than normal, too.how can i fix this?

    • @pyshine_official
      @pyshine_official  2 роки тому

      You're welcome! You can either set a constant delay in seconds using time.sleep or use waitKey. For more details visit pyshine.com/How-to-send-audio-video-of-MP4-using-sockets-in-Python/

    • @nuosaviour6362
      @nuosaviour6362 2 роки тому

      @@pyshine_official Much appreciated! I refered to the website provided. Get original FPS and use that to set value of the variable TS to solve the audio-video synchronization problem in cv2.Waitkey() also applies here!

  • @abdullahs.3053
    @abdullahs.3053 3 роки тому +1

    appreciated! how can I use the picamera as input?

    • @pyshine_official
      @pyshine_official  3 роки тому +1

      Thank you! We will surely make a follow-up on it. Besides, you can use the rawCapture = PiRGBArray(camera, size=(640, 480), and accordingly use the frame from it.

    • @abdullahs.3053
      @abdullahs.3053 3 роки тому +1

      @@pyshine_official cool! keep up the good work

    • @pyshine_official
      @pyshine_official  2 роки тому

      pyshine.com/Easy-video-stream-using-picamera-over-wifi-python/

  • @srisurabhi5
    @srisurabhi5 2 роки тому

    Hey.. Great video. But do you know that How to read a udp message from random server in a network without knowing the sender's IP address.

  • @mfatihkoc
    @mfatihkoc 2 роки тому

    I am trying to communicate the one server and 2 clients using UDP protocol to send an audio file but I need to synchronization of it. I mean I want to synchronize 3 virtual machines (2 clients and 1 server) without a cable connection, I also want to implement this under netem emulator. I want to receive the file as much as possible at the same as a client.

  • @wakabbo
    @wakabbo 3 місяці тому

    do i need port forwarding? please answer

  • @mrdakik8357
    @mrdakik8357 3 роки тому +1

    Thank you very much for the video! But how can you do it with screen share instead of camera? (just screenshots)

    • @pyshine_official
      @pyshine_official  3 роки тому

      You're welcome. Sceen sharing tutorial will be added soon on pyshine.com

    • @mrdakik8357
      @mrdakik8357 3 роки тому

      @@pyshine_official oh, ok thanks

  • @melissalouak1902
    @melissalouak1902 2 роки тому +1

    Hi, great video! Is there a way to lower the data consumption of the websocket? Each second, it consumes 78 MB!

    • @pyshine_official
      @pyshine_official  2 роки тому

      Good question. It depends in encoding and decoding scheme used for the package message as well as on the target application. For example using a YUV420 standard format would lower bps. Or sending gray level image would reduce size to about 1/3. Sending only the motion oriented pixels and their locations in an image will help alot as well. Reducing image resolution, or tiling an image and sending tiles would increase data rates

  • @samplayzmc3756
    @samplayzmc3756 3 роки тому +1

    Does this work across different devices within a network?

  • @midnightdishwasher1071
    @midnightdishwasher1071 2 роки тому

    can you make that as a camera?

  • @roaaeb1894
    @roaaeb1894 3 роки тому

    please what is the python editor code that was used in this video?

  • @tesm_jsf
    @tesm_jsf Рік тому

    Hey thanks so much for the video! how can I make the video run a bit quicker it appears to be running a little slowly for me :)

  • @iqmalnaqib8040
    @iqmalnaqib8040 Рік тому +1

    Thank you for the informative and easy to follow tutorial. But I have this error code and I do not know how to handle it.
    .
    [WinError 10040] A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram into was smaller than the datagram itself

    • @pyshine_official
      @pyshine_official  Рік тому

      Probably the buffer size is not larger. First try to run code with some reduced size buffer

  • @kailashg8620
    @kailashg8620 2 роки тому

    how to make this run in gui

  • @edsonferraz1
    @edsonferraz1 3 роки тому +1

    Hello! excelant video, congratulation!! Is possible using a UDP source video by ethernet port of PC?

    • @pyshine_official
      @pyshine_official  3 роки тому +1

      Thank you for appreciating! Yes, absolutely possible. All that required is the access to the peer PC. Normally, OS credentials block the connection. So before starting server client communication, make sure that the two PCs can ping each other successfully.

    • @edsonferraz1
      @edsonferraz1 3 роки тому

      @@pyshine_official Thank you to response.

    • @pyshine_official
      @pyshine_official  3 роки тому

      @@edsonferraz1 You're welcome! Its works perfectly.

    • @edsonferraz1
      @edsonferraz1 3 роки тому

      @@pyshine_official Do you can send me a exemplo how made this? My E-mail is: eng.edsonferraz@gmail.com

  • @NasirandFatima
    @NasirandFatima 3 роки тому +2

    Hello. Thank you so much for this useful tutorial. I have two questions. How can we control the fps? I mean, is there a way to send video at a slower speed? I essentially want to control the sending speed of udp packets. I want to restrict the number of udp packets sent per second. Also, is there a way to restrict the max. data length on each udp packet? For example, I want each udp packet to carry no more than 1400 data bytes. Please let me know how I can do these two things. I would highly appreciate your help. Thanks.
    Nasir

    • @pyshine_official
      @pyshine_official  2 роки тому

      Follow this tutorial for the control of FPS pyshine.com/How-to-send-audio-video-of-MP4-using-sockets-in-Python/, for the UDP packets you can set the Buffer size accordingly

  • @AbdulRahman-vi2dz
    @AbdulRahman-vi2dz 3 роки тому

    Apakah hanya macos yg bisa kak? apakah bisa jg windows kak?

  • @Jon-s4s
    @Jon-s4s 11 місяців тому

    Hi! Create a video where the server captures the screen and streams it to the client.

  • @eitangreenberg6255
    @eitangreenberg6255 3 роки тому

    Thank you for the video!! Can you also make a video about sending the video's audio and synchronizing them?

    • @eitangreenberg6255
      @eitangreenberg6255 3 роки тому

      I also have another question: the shown fps is around 70 (in my program and my video is .mp4) and it is played extremely fast. do i have to change the waitKey value or is there another way?

    • @pyshine_official
      @pyshine_official  3 роки тому

      @@eitangreenberg6255 You're welcome! Yes you can change the frame rate with waitKey( integer miliseconds). UDP is usually use in real-streaming of audio video data, you can experiment the live streaming tutorial over UDP as well.

    • @eitangreenberg6255
      @eitangreenberg6255 3 роки тому

      @@pyshine_official but it's hard for me to synchronize between them. Will you post a tutorial about it?

    • @pyshine_official
      @pyshine_official  3 роки тому +3

      @@eitangreenberg6255 Alright, will surely make one. Cheers!

    • @eitangreenberg6255
      @eitangreenberg6255 3 роки тому

      @@pyshine_official omg you are amazing!! Thank you very much!!! Really appreciate it!!

  • @virajshete432
    @virajshete432 2 роки тому

    plz send code to save video at client side(server send video) by using UDP server

  • @saadyousfi9132
    @saadyousfi9132 2 роки тому

    hi, Thanks for this great video
    Can you please tell me how can I serve multiple clients with a UDP server (with this code I can only serve one client)

  • @bikramkarmakar6482
    @bikramkarmakar6482 3 роки тому

    Hi! Can you please make a tutorial to show video in a HTML page(which transmiter frome Python server
    )

    • @pyshine_official
      @pyshine_official  3 роки тому

      Hi, please check tthese: pyshine.com/Live-streaming-multiple-videos-on-a-webpage/
      and
      pyshine.com/Easy-video-streaming-in-raspberrypi-python/

  • @roaaeb1894
    @roaaeb1894 3 роки тому

    How can I get port address?

    • @pyshine_official
      @pyshine_official  3 роки тому

      Follow this tutorial pyshine.com/Socket-programming-and-openc/

  • @qigao5458
    @qigao5458 3 роки тому +1

    cool~~~

  • @open-ats9990
    @open-ats9990 3 роки тому

    wrote the a similar program for my 3d printable rc car, i rent a server so everything can be used in mobile network

  • @trickkymoodstar1288
    @trickkymoodstar1288 3 роки тому

    Honestly I love your content but very elaborate and understandable but each time I try to access the camera it keeps giving me an error 😭😭 pls I need your help🙏🏾🙏🏾

    • @trickkymoodstar1288
      @trickkymoodstar1288 3 роки тому

      It keeps telling me
      encoded = binascii.b2a_base64(s, newline = False )

    • @pyshine_official
      @pyshine_official  3 роки тому

      @@trickkymoodstar1288 Hi, to debug please use Python 3.6.5 version. Also make sure the camera index id is 0 or other like 1,2,..., change it accordingly