Transferring Files via QRCode & Camera(Video File)
pip3 install pillow pyqt5 opencv-python qrcode numpy pyzbar
If you are on macOS, maybe you have to install the zbar
library by homebrew (It is needed by pyzbar
)
brew install zbar
-
Edit
qrcode_play.py
, and changeFILE_NAME
to your file. -
The parameter (E.g.
QRCODE_SIZE
,QRCODE_NUMBER
,FRAME_RATE
, etc.) works well on my computer (1080p 23inch screen) and my phone(60FPS 1080p video recording). You can adjust these parameters as you need. For example, if you only can record 30FPS video, you can try to reduce the framerate. -
Chunk size must be the power of 2.
-
If the QR Code can not display correctly, try to adjust the QRCode size, QR Code number per row, chunk size (smaller chunk size can make the QR Code smaller, even with the same QRCode size), number of QR Code, etc.
-
Run
qrcode_play.py
. Notice: it will save the QR Code cache toqr_cache.pickle
. Next time it will load QR code from this file to save time, if the parameters have not been changed. If you want to re-generate the QR code, please deleteqr_cache.pickle
. -
Record a video of the QR code. Try to use higher video bitrate as much as possible.
-
Edit
decode_video.py
, and changeVIDEO_FILE
to your video file name. If you changedQRCODE_NUMBER
inqrcode_play.py
, you also have to change it here. -
If the video can be decoded successfully, an
output.bin
will be generated. This should be as same as your input file.