Skip to content

Instantly share code, notes, and snippets.

@EncodeTheCode
Last active July 3, 2026 05:33
Show Gist options
  • Select an option

  • Save EncodeTheCode/96df5a8ea3fa384696ecd489710a2a2c to your computer and use it in GitHub Desktop.

Select an option

Save EncodeTheCode/96df5a8ea3fa384696ecd489710a2a2c to your computer and use it in GitHub Desktop.
# Instructions below
#
# Download and run the following, Open Broadcaster Software Studio [OBS] (downloadable at: https://obsproject.com/)
# Create a video from OBS studio by recording while your webcam is running (you can open webcam in many ways I don't need to explain this part)
# Save the video and then use it for any verification app such as (FB), or any other online site that may require webcam verification
# Lastly you can then freely run this script while you're at the verification app of any site as mentioned and while the webcam verification is opened and listening to your webcam you can then see if it passes or not
# This has been confirmed to work on (FB) which is notoriously the most secure of all social networks on the planet, so I would say this Python script is flawless.
import cv2
import pyvirtualcam
from pyvirtualcam import PixelFormat
import os
import sys
VIDEO_PATH = 'video_verification.mp4' # Replace with your actual video path
def main():
# Check if video file exists
if not os.path.exists(VIDEO_PATH):
print(f"Error: Video file not found: {VIDEO_PATH}")
sys.exit(1)
# Open the video file
cap = cv2.VideoCapture(VIDEO_PATH)
if not cap.isOpened():
print(f"Error: Failed to open video file: {VIDEO_PATH}")
sys.exit(1)
# Get video properties
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
fps = cap.get(cv2.CAP_PROP_FPS)
if fps <= 0: # Fallback if FPS is not read properly
fps = 30
print(f"Video resolution: {width}x{height} at {fps:.2f} FPS")
# Initialize virtual camera
try:
with pyvirtualcam.Camera(width=width, height=height, fps=fps, fmt=PixelFormat.RGB) as cam:
print(f"[INFO] Streaming to virtual camera: {cam.device}")
print("[INFO] Press Ctrl+C to stop")
while True:
ret, frame = cap.read()
if not ret:
cap.set(cv2.CAP_PROP_POS_FRAMES, 0)
continue
# Convert frame from BGR (OpenCV) to RGB (pyvirtualcam)
frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
# Send frame to virtual cam
cam.send(frame_rgb)
cam.sleep_until_next_frame()
except KeyboardInterrupt:
print("\n[INFO] Stopped by user.")
finally:
cap.release()
print("[INFO] Resources released. Goodbye.")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment