반응형
반응형

Create a Video Chat/Video Steaming App using Python

https://medium.com/geekculture/creating-video-chat-app-using-python-9da0a9c386ba

 

Create a Video Chat/Video Steaming App using Python

Due to the pandemic the only way to stay connected through the internet. But due to such a huge activity in Advertisement department, data…

medium.com

Server.py

from pyfiglet import Figlet
os.system("clear")
pyf = Figlet(font='puffy')
a = pyf.renderText("Video Chat App without Multi-Threading")
b = pyf.renderText("Server")
os.system("tput setaf 3")
print(a)
import socket, cv2, pickle,struct
# Socket Create
server_socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
host_name  = socket.gethostname()
host_ip = socket.gethostbyname(host_name)
print('HOST IP:',host_ip)
port = 9999
socket_address = (host_ip,port)
# Socket Bind
server_socket.bind(socket_address)
# Socket Listen
server_socket.listen(1)
print("Listening at:",socket_address)
# Socket Accept
while True:
 client_socket,addr = server_socket.accept()
 print('Connected to:',addr)
 if client_socket:
  vid = cv2.VideoCapture(0)
  
  while(vid.isOpened()):
   ret,image = vid.read()
   img_serialize = pickle.dumps(image)
   message = struct.pack("Q",len(img_serialize))+img_serialize
   client_socket.sendall(message)
   
   cv2.imshow('Video from Server',image)
   key = cv2.waitKey(10) 
   if key ==13:
    client_socket.close()

Client.py

from pyfiglet import Figlet
os.system("clear")
pyf = Figlet(font='puffy')
a = pyf.renderText("Video Chat App without Multi-Threading")
b = pyf.renderText("Client")
os.system("tput setaf 3")
print(a)
import socket,cv2, pickle,struct
# create socket
client_socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
#  server ip address here
host_ip = '<IP>' 
port = 9999
client_socket.connect((host_ip,port)) 
data = b""
metadata_size = struct.calcsize("Q")
while True:
 while len(data) < metadata_size:
  packet = client_socket.recv(4*1024) 
  if not packet: break
  data += packet
 packed_msg_size = data[:metadata_size]
 data = data[metadata_size:]
 msg_size = struct.unpack("Q",packed_msg_size)[0]
 
 while len(data) < msg_size:
  data += client_socket.recv(4*1024)
  frame_data = data[:msg_size]
  data  = data[msg_size:]
  frame = pickle.loads(frame_data)
  cv2.imshow("Receiving Video ",frame)
  key = cv2.waitKey(10) 
  if key  == 13:
   break
client_socket.close()
반응형

'프로그래밍 > Python' 카테고리의 다른 글

[python] Top 10 Python Libraries  (0) 2023.10.26
[python] Stack in Python  (0) 2023.10.24
[python] PyAudio  (0) 2023.10.20
[Python] savefig 0.0.4  (0) 2023.10.17
[python] pdf to png, 해상도 높게 저장하기  (0) 2023.10.04
반응형

PyAudio

https://pypi.org/project/PyAudio/

 

PyAudio

Cross-platform audio I/O with PortAudio

pypi.org

PyAudio는 크로스 플랫폼 오디오 I/O 라이브러리인 PortAudio v19에 대한 Python 바인딩을 제공합니다. PyAudio를 사용하면 Python을 사용하여 GNU/Linux, Microsoft Windows 및 Apple macOS와 같은 다양한 플랫폼에서 오디오를 쉽게 재생하고 녹음할 수 있습니다.

 

pip install PyAudio

반응형
반응형

setInterval()

setInterval(code)
setInterval(code, delay)

setInterval(func)
setInterval(func, delay)
setInterval(func, delay, arg0)
setInterval(func, delay, arg0, arg1)
setInterval(func, delay, arg0, arg1, /* … ,*/ argN)


Window 및 Worker 인터페이스에서 제공되는 setInterval() 메서드는 각 호출 사이에 고정된 시간 지연으로 함수를 반복적으로 호출하거나 코드 스니펫을 실행합니다.

이 메서드는 간격(interval)을 고유하게 식별할 수 있는 interval ID를 반환하므로 나중에 clearInterval() (en-US) 함수를 호출하여 제거할 수 있습니다.

myArray = ["zero", "one", "two"];

myArray.myMethod = function (sProperty) {
  alert(arguments.length > 0 ? this[sProperty] : this);
};

myArray.myMethod(); // "zero,one,two"가 출력됩니다
myArray.myMethod(1); // "one"가 출력됩니다
setTimeout(myArray.myMethod, 1000); // 1초 후 "[object Window]"가 출력됩니다
setTimeout(myArray.myMethod, 1500, "1"); // 1,5초 후에 "undefined"가 출력됩니다

// myArray.myMethod 내에서 this의 값을 변경하려는 동안
// setTimeout 내부에서 this의 값을 변경하기 때문에
// .call과 함께 'this'객체를 전달하는 것은 동작하지 않습니다
// 사실 setTimeout 코드는 this가 window 객체가 될 것으로 예상하기 때문에 오류가 발생합니다
setTimeout.call(myArray, myArray.myMethod, 2000); // error: "NS_ERROR_XPC_BAD_OP_ON_WN_PROTO: Illegal operation on WrappedNative prototype object"
setTimeout.call(myArray, myArray.myMethod, 2500, 2); // 위와 동일한 에러가 발생합니다
반응형
반응형

2023년 소비자 온라인 쇼핑 비중 89.6%, 멤버십 만족도 ‘쿠팡 로켓와우’ 1위

온라인 쇼핑이 소비생활의 ‘주류’로 자리잡은 가운데 국내 온라인 쇼핑몰 시장에서 쿠팡과 네이버쇼핑이 양강구도를 굳히고 있는 것으로 나타났다.

 

특히 쇼핑도 구독하는 시대, 유통업계는 멤버십 출혈 경쟁 중이다. 로켓와우, 네이버플러스멤버십, 스마일클럽과 같은 주요 멤버십은 배송, OTT와 오프라인 매장 제휴 등 저마다 다양한 혜택을 내놓고 있다.

 

여기에 최근 신세계도 통합 멤버십 ‘신세계 유니버스 클럽’을 출시하면서 쿠팡, 네이버쇼핑 중심의 온라인 쇼핑 시장에 지각 변동이 일어날 수 있을지 주목된다.

 

# 주 쇼핑 방식 자리잡은 온라인 채널, 1개월 내 온라인 쇼핑 90%

 

온라인 채널은 주 쇼핑 방식으로 자리 잡았으며 상위 온라인 쇼핑몰의 강세 또한 지속되고 있다. 오픈서베이 ‘온라인 쇼핑 트렌드 리포트 2023’에 따르면, 평소 개인과 가정에서 사용할 목적으로 물품 구매 시 온라인 채널을 통해 구매하는 비중이 가장 높았다.

https://cosinkorea.com/mobile/article.html?no=48855

반응형
반응형

savefig 0.0.4

 

pip install savefig

 

https://pypi.org/project/savefig/

 

Save matplotlib figures with embedded metadata for reproducibility and profit

 

반응형
반응형

https://javascript.plainenglish.io/17-killer-websites-for-web-developers-13e1e30345b8

1. Random Image via API

Link

The most powerful photo engine in the world. The Unsplash API is a modern JSON API that surfaces all of the info you’ll need to build any experience for your users

Unsplash

2. Embeddable Widget Apps for Notion

Link

Add 3rd party apps embed or create a custom embed for your Notion Document.

3. Carbon

Link

Create and share beautiful images of your source code. Start typing or drop a file into the text area to get started.

Carbon

4. Peppertype

Link

Generate better content copies in seconds with the power of Artificial Intelligence. Expanding your content for writing blogs is easier than ever before. Get AI-Generated tweet ideas in seconds.

Peppertype

5. Poet. so

Link

Capture and share Twitter posts as beautiful images. You could use this as social proof on your website.

Poet

6. Weekly Visitor Report

Link

Get a weekly report of the companies visiting your website.

Clearbit

7. Smart Mockup

Link

  • Create stunning product mockups easily and online
  • The fastest web-based mockup tool
  • No experience or skills needed, super easy-to-use

Smartmokcup

8. Small Dev tools

Link

Handy developer tools with a delightful interface. Provide 20+ tools that help developers with commonly performed tasks like Encoding/Decoding, Minifying, Test Dummy data set, and a lot more.

Small Dev tools

9. Show beautiful message in the console

Link

FIGlet is a program for making large letters out of ordinary text.

FIGlet

10. A Visual Type Scale

Link

Understand and visualize the difference between different font sizes, REM vs. EM Values. Check the preview in real-time to see how it looks

Visual Type Scale

11. Remove Background from Image

Link

Remove backgrounds 100% automatically in 5 seconds with zero clicks.

Remove BG

12. Responsively

Link

Develop responsive web apps 5x faster!

Responsively

13. Metatags

Link

Meta Tags is a tool to debug and generate meta tag codes for any website. Tags you can edit and experiment with your content then preview how your webpage will look on Google, Facebook, Twitter, and more!

Meta Tags

14. ReadMe

Link
The easiest way to create a README file in minutes visually

ReadMe

15. Storytale

Link

High-class illustrations for web and mobile projects. Make your project eye-catching with awesome characters. Use it both for commercial and personal purposes.

Storytale

16. Profile Pic Maker

Link

Make an awesome profile picture from any photo

Profile Picture Maker

17. SigmaOS

Link

Fly through your work. The browser that makes you faster and better at working on the web.

Sigma OS

반응형

+ Recent posts