This project aims to securely livestream webcam using AES-128 over network and also steam videos on demand over network.

Running the client and server on the local machine

Actual encrypted data transfer of the stream.

Live Streaming of the Webcam on a local machine. The live video stream and the video resolution is encrypted according to the network speed.

For running the project:


  1. OpenCV
  2. Numpy
  3. Pycryptodome
  4. Flask
  5. ffmpeg Install the dependencies using pip.

Running the Webcam livstream:

  1. Run python on terminal
  2. Run python on another terminal
  3. Now open in browser to watch the webcam livestream

Running the video on demand:

  1. Create a folder outputs and run

ffmpeg -i input_video_to stream.mp4 -c copy -map 0 -segment_time 8 -f segment -reset_timestamps 1 outputs/output%03d.mp4

This will split the original video into chunks in the outputs folder. These chunks will be streamed over the network.

  1. Now, run python on terminal. to start the server.

  2. Run python on another terminal to start the client.

  3. Now open in browser to watch the stream.

Edit the Webcam livestream parameters

For switching the network speed, change the "download" variable in the file on line 20. And, for making it perform automatically change the "test" variable's value as True.

This streaming is now working correctly. Only the first chunk gets played.

Note: Currently the livestream is working but the video on demand needs work.

Please help to make it working. Raise issues and make pull requests.

For queries contact me at

Built With

Share this project: