Walkthrough, tested

How do you put a QR code in a video so it still scans?

Updated Tested November 22, 2026118 encodes, 3 decodersNo phone or platform upload tested

A black-and-white QR code on a dark video frame, a dashed outline around its white border, and a ruler bar below it.

Short answer

Make the code in the Koldflux QR generator, keep its white border, and set its width on the 1920 by 1080 frame so each square (a module) gets enough pixels: width divided by (modules plus 8). In our test a 34-character link at level M was read in every sampled frame by all three decoders from 120 px wide, a 114-character link needed 240 px, and a light-gray code (1.9 to 1 contrast) was not read by one decoder at 180 px. Phones were not tested, so check your own export with the commands below before you publish.

QR code generator: link, error level, size, colors, PNG or SVG (free, in your browser)

Key takeaways

  • Pixels per module is the number to watch: width in pixels divided by (modules plus 8, the 4-module border on each side). The tool prints the module count under the code.
  • Both the link length and the error level mattered, and neither effect was steady. At level M the 114-character link needed twice the width of the 34-character one (240 against 120 px); on the short link, level H needed three times the width of level M (360 against 120 px).
  • At 360 px wide (a third of the frame height), 7 of 8 codes were read in every sampled frame by all three decoders at both bitrates. The long link at level L missed 2 frames in one.
  • A mid-gray code at 3.5 to 1 contrast still lost 22 of 31 frames in one decoder at 1.5 Mbps. Black on white read in every case where size allowed.
  • Cropping off the white border made 0 of 6 test videos readable. The Koldflux PNG already includes it.

What are the exact steps?

Seven steps, each with a check you can do before moving on. Step 1 to 5 happen in the browser, 6 and 7 in your video editor.

  • Open the QR code generator, keep "Link or text", and paste the shortest link you can. Check: the field shows your link and a code appears. A 34-character link gave a 29 by 29 code at level M; a 114-character link with tracking parameters gave 45 by 45.
  • Choose the error correction. Leave M unless you have a reason; the table below shows what L, Q and H changed. Check: the line under the code names the level and the module count, for example "Version 3, 29 × 29 modules, error correction M, quiet zone 4 modules."
  • Leave the image size at 512 px and the colors black on white. We scaled a 512 px file down in every test. A larger download scaled down was not tested here.
  • Download the PNG. Check: the file is square and has a white border around the code. Do not crop it.
  • Work out pixels per module: your planned width divided by (modules plus 8). For the 29-module code at 180 px that is 180 / 37 = 4.9. Check: the answer is at or above the value your link and level need in the sizing table.
  • In the editor, drop the PNG on the top track, set its width in pixels on a 1920 by 1080 project, and place it clear of the screen edge. Check: the code sits fully inside the frame, and where it sits against the app interface is the safe-zone page's job, not this one's.
  • Export at your usual 1080p settings, then cut a 5-second sample of it and run the decode commands near the end of this page. Check: the counts equal the total, in our run 30 30 30. Then scan a frame from the export with your own phone.
The Koldflux QR code generator on koldflux.com with the link https://koldflux.com/tools/qr-code typed in, error correction M and 512 by 512 px selected, and the code shown with the line Version 3, 29 by 29 modules
The QR generator on koldflux.com during our test run: link entered, error correction M, 512 px, black on white. The PNG it downloads was identical, pixel for pixel, to the one from the qrcode library we used for the video tests.

Which setting fits your situation?

Find your case, then confirm it against the tables further down.

  • You can choose the link: use the shortest one, a redirect you control for example, because the 34-character link needed half the width of the 114-character one at level M.
  • Link with tracking parameters: expect about 45 modules at level M; plan 240 px or more on a 1080p frame (4.5 pixels per module), and test the export.
  • Level M is the default: keep it unless the code will be dirty or damaged on screen. Level L on the long link was the one code where jsQR missed 2 frames at 360 px, at 6 Mbps.
  • Not sure about the room: 360 px wide, a third of the frame height, was the one size where 7 of 8 codes were clean. If that covers too much picture, shorten the link instead of shrinking the code.
  • Colors: our suggestion is 7 to 1 or more. That is a margin we chose, not a measured threshold: 6.7 to 1 read in every frame, and 3.5 to 1 failed in one decoder. Dark on light only.
  • Border: keep the PNG as downloaded, white border included.
  • Where the code sits on the frame, and how long it stays up for a viewer to scan, are separate questions. The safe-zone page covers where the app interface covers the frame.

How wide should the code be on a 1080p frame?

We overlaid each code at 60, 90, 120, 180, 240 and 360 px wide, 60 px in from the bottom-right corner, on a 5-second 1920 by 1080 clip, and re-encoded it with x264 at 1.5 and 6 Mbps. Then three decoders (programs that read a QR code from an image) tried every 5th frame, 31 frames per video, and a read counted only if the text matched the link exactly. The decoders were OpenCV 5.1.0's classic QRCodeDetector, its Aruco-based QRCodeDetectorAruco, and the JavaScript library jsQR 1.4.0.

The first table is one code, the 34-character link at level M (29 modules), at 1.5 Mbps. Each cell is frames read out of 31, in the order OpenCV classic, OpenCV Aruco, jsQR.

Short link, level M, 1.5 Mbps
Width on framePixels per moduleFrames read
60 px1.620 / 0 / 31
90 px2.4325 / 19 / 31
120 px3.2431 / 31 / 31
180 px4.8631 / 31 / 31
240 px6.4931 / 31 / 31
360 px9.7331 / 31 / 31

Frames read out of 31 (classic / Aruco / jsQR).

The same pattern held at 6 Mbps for this code, with 29 / 30 / 31 at 90 px. The decoders disagree about the small sizes: jsQR read this code at 1.6 pixels per module and both OpenCV modes did not. A phone camera app is a fourth decoder, and it may be stronger or weaker than these three. For planning we used the strictest result, the size at which all three read every frame.

The second table gives that size for each of the eight codes. It is the smallest tested width where all three decoders read all 31 frames at both bitrates, and at every wider width as well.

Three crops of the same video frame after 1.5 Mbps encoding, each with the QR code in the corner: 60 px wide read by OpenCV in 0 of 31 frames and jsQR in 31, 90 px read by OpenCV in 25 and jsQR in 31, 180 px read in 31 by both
The same 400 px corner of the encoded frame with the code at three widths. The counts are from our script.

Does the error correction level change the size you need?

It changes the module count, and the module count changes the pixels per module. Level L and M gave a 29-module code for the short link; Q and H gave 33. For the long link the count rose with each level: 41, 45, 53 and 57.

LinkLevelModulesWidth on framePixels per module
34 charactersL29120 px3.24
34 charactersM29120 px3.24
34 charactersQ33180 px4.39
34 charactersH33360 px (jsQR missed 1 frame at 240 px, 6 Mbps)8.78
114 charactersL41not reached by 360 pxnot reached
114 charactersM45240 px4.53
114 charactersQ53360 px5.90
114 charactersH57240 px3.69

And every wider width.

Higher level did not mean an easier code. The long link at level H passed at 240 px while level Q needed 360 px, and the short link at level H needed more than level Q. Each cell is one encode of one clip, and the misses near the edge were one or two frames, so read these as a rough band and not as a fixed ladder. What the table does support: the 114-character link needed about twice the width of the 34-character one at level M (240 against 120 px), so a shorter link can save room, but the level mattered too: level H on the short link needed 360 px, more than the long link needed at level M.

How many codes were clean at each width, with all three decoders at both bitrates: 2 of 8 at 120 px, 4 of 8 at 180 px, 5 of 8 at 240 px, 7 of 8 at 360 px. At 360 px, a third of the frame height, only the long link at level L missed: OpenCV read it fully, jsQR read 29 of 31 frames at 6 Mbps.

The Denso Wave pages say of the levels only what they say: "Typically, Level M (15%) is most frequently selected," and that the code can "restore data if the code is dirty or damaged." That is repair of damage. Nothing on them says a higher level is easier to read at a small size, and our table does not show it either.

Bar chart of the pixels per module at which two decoders first read every frame, for eight codes: for example the short link at level M needed 3.24 for OpenCV classic and 1.62 for jsQR, and the long link at level L needed 7.35 for OpenCV and none for jsQR up to 7.35
Smallest pixels per module with every frame read at both bitrates, OpenCV classic (dark) and jsQR (light), from our matrix.

Why keep the white border?

The Koldflux PNG has a 4-module white border, the quiet zone, around the code. Denso Wave says "QR Code requires a four-module wide margin at all sides of a symbol." We tested what a video does to that: the same short code at level M with the border cropped to zero, at 120, 180 and 240 px, at both bitrates. That is 6 videos, and none of the three decoders read a single sampled frame in any of them.

In this clip the code sat on dark green foliage. Without its border the code's edge squares touched the picture. A different background might behave differently. If your editor has a "fit" or "crop to content" option, leave it off for this file.

Does bitrate matter?

We encoded each cell twice, at 1.5 and 6 Mbps, and changed nothing else. The clip is a slow macro shot, and the 6 Mbps file was about four times the size of the 1.5 Mbps one (3,598,680 against 847,160 bytes for the 240 px short code at level M).

The higher bitrate did not give a steady gain. At the sizes where a code was clean, both bitrates read all frames. Near the edge it went both ways: short link at level Q, 120 px, OpenCV classic read 0 of 31 at 1.5 Mbps and 23 at 6 Mbps; short link at level H, 90 px, it read 28 at 1.5 and 0 at 6. A busy, fast clip would compress differently, and we tested one slow clip only.

Which colors and contrast survive?

We kept the short link at level M and 180 px wide (4.86 pixels per module, a size that read cleanly in black on white) and changed only the two colors. The contrast ratio is the WCAG formula for the two colors. Frames read are out of 31, in the order classic / Aruco / jsQR.

Colors, short link, level M, 180 px wide
Dark / lightContrast1.5 Mbps6 Mbps
black / white21.00 to 131 / 31 / 3131 / 31 / 31
#444444 / white9.74 to 131 / 31 / 3131 / 31 / 31
blue #1a3cff / white6.70 to 131 / 31 / 3131 / 31 / 31
#888888 / white3.54 to 131 / 31 / 931 / 31 / 31
#bbbbbb / white1.92 to 131 / 31 / 031 / 31 / 0
yellow #ffd400 / white1.43 to 130 / 31 / 031 / 31 / 0
white / black (inverted)21.00 to 10 / 0 / 00 / 0 / 0

Two things stand out. Light colors lost jsQR entirely at both bitrates while both OpenCV modes still read them, so one decoder's success says little about another's. And the mid-gray at 3.54 to 1 is above 3 to 1, yet jsQR read only 9 of 31 frames at 1.5 Mbps. The QR tool shows a contrast alert below 3 to 1, and this gray is above that line, so passing the alert is not enough on its own.

The inverted code, white on black, was read by none of the three as we ran them: jsQR had inversion turned off, and OpenCV's detector does not claim to handle it. Some phone readers do handle inverted codes, but none was in this test. The safe default is dark modules on a light field.

Can you check your own export from the command line?

There are two jobs here, and they have separate commands. The first command puts the code on your whole video and keeps its sound: it overlays a PNG 240 px wide, 60 px in from the bottom-right corner, and encodes the picture at 6 Mbps with ffmpeg 6.1 and libx264. The second cuts a 5-second sample with no sound from the finished file, only for checking. The third decodes that sample. Swap the file names for yours.

On a 9.0-second test file with a sound track the first command exited 0 and wrote a 9.0-second file with video and audio. The sample was 5.0 seconds, and the decoders printed "30 30 30" (OpenCV) and "30 30" (jsQR). On the same cut without any code, as the control, they printed "0 0 30" and "0 30", so a read means a read. The decoder scripts are linked under Sources. They need opencv-python-headless and the jsqr package.

The result tells you about frames of your export, not about a phone. Scan one frame with your own phone too, from a screen at normal viewing distance.

ffmpeg -v error -i input.mp4 -i qr.png -filter_complex "[1:v]scale=240:240:flags=bicubic[q];[0:v][q]overlay=main_w-w-60:main_h-h-60,format=yuv420p" -c:v libx264 -preset medium -b:v 6000k -c:a copy with-qr.mp4
Overlay on the whole video; the sound track is copied as it is, and a video with no sound track works too. A missing input makes ffmpeg stop with exit code 254 and write no video.
ffmpeg -v error -ss 3 -t 5 -i with-qr.mp4 -an -c:v libx264 -preset medium -crf 18 sample.mp4
A 5-second sample from second 3 of the finished file, without sound, for the decoders only. The file must be longer than 3 seconds: a shorter one gives an empty file of 262 bytes with exit code 0.
python3 decode-cv.py sample.mp4 5 "https://koldflux.com/tools/qr-code"
node decode-jsqr.cjs sample.mp4 5 "https://koldflux.com/tools/qr-code"
Decode every 5th frame. The first prints OpenCV classic, OpenCV Aruco and total frames; the second prints jsQR frames and total. Put your own link in quotes. The jsQR script reads the frame size from the file but is meant for a short cut like this 5-second one: on a long export it stops with an error instead of a count.

Limits: what this does not show

Claim | varied | held equal | why, one line each. A wider code is easier to read | the width of the overlay, 60 to 360 px | the clip, link, level, colors and both x264 settings | width is the only change between cells in one row of the first table. Link length changes the width needed | the link, 34 or 114 characters | the clip, level M, colors, decoders and bitrates | the two links differ only in length and the tracking text, and the module counts differ with them. A mid-gray code is less reliable | the two colors | the link, level M, 180 px, the clip | only the colors changed in the colors table, and black on white at the same size was clean. Cropping the border breaks the read | the quiet zone, 4 modules or 0 | the link, level M, the clip | the PNGs differ only in the margin option. The level does not set the size on its own | the level | the link and the clip | the module count moved with it, so the level and the size are not separated, and we do not claim a ladder.

This does not prove that a phone, Instagram, TikTok or YouTube reads these codes. We did not upload anything to a platform, did not scan from a phone, did not film a screen, and did not try vertical video. The test used one 1920 by 1080 clip that is mostly slow and dark green at the corner, our own x264 settings at two bitrates, 31 sampled frames per video, and three software decoders. The tool PNG matched the library PNG at all four levels for the short link only. The decoder results are frames from our encodes, not a promise about your export.

QR Code is a registered trademark of DENSO WAVE INCORPORATED. Koldflux is not affiliated with it.

Do it in your browser

Free Koldflux tool, no account needed.

QR code generator: link, error level, size, colors, PNG or SVG (free, in your browser)

Questions people ask

How big should a QR code be in a 1080p video?

In our test, a 34-character link at level M was read in every sampled frame by all three decoders from 120 px wide, and a 114-character link from 240 px. At 360 px, a third of the frame height, 7 of 8 codes were clean. Work it out for your code as width divided by (modules plus 8) and check your export.

Which error correction level should I use for a QR code on video?

Levels L and M read cleanly at 120 px for the short link; Q and H did not. Denso Wave says M is most frequently selected. A higher level made the code denser and our table did not show it easier to read at a small size.

Does video compression break a QR code?

A small code was not readable after encoding in our test: at 60 px wide the 29-module code was read in 0 of 31 frames by OpenCV at both bitrates, and at 120 px and above in all 31 by all three decoders. The same small code was not decoded before encoding, so the test does not separate the encoder from the small size itself. Platform re-encoding was outside this test.

Can I use a colored QR code in a video?

Dark blue worked in our test, with 6.7 to 1 contrast. Light gray and yellow were not read by jsQR at all, and mid-gray at 3.5 to 1 failed 22 of 31 frames in it at 1.5 Mbps. We did not test a phone.

Why does my QR code not scan from the video even though it looks sharp?

Check the white border first: in our test, cropping it off made 0 of 6 videos readable. Then check pixels per module, the contrast, and whether the link is long. A very long link with tracking parameters has many small squares.

Can I turn the QR code colors around to white on black?

In our test the inverted code was read by none of the three decoders as we ran them. Some phone readers can read inverted codes, but none was in this test, so dark on light is the safer choice.

Related

More guides on this topic

Sources and how we checked

  1. Denso Wave: QR Code error correction (the creator of the code; read November 22, 2026) (checked 2026-11-22)
  2. Denso Wave: How to generate a QR Code (read November 22, 2026) (checked 2026-11-22)
  3. Denso Wave: QR Code symbol, the four-module margin (read November 22, 2026) (checked 2026-11-22)
  4. Wikimedia Commons: Marmalade Hoverfly garden 31 7 2020 1b 4K UHD.webm (CC0, the test clip; read November 22, 2026) (checked 2026-11-22)
  5. OpenCV: QRCodeDetector and QRCodeDetectorAruco (software used, version 5.1.0) (checked 2026-11-22)
  6. jsQR: pure JavaScript QR code reader (software used, version 1.4.0) (checked 2026-11-22)
  7. node-qrcode: the library the Koldflux tool uses (software used, version 1.5.4) (checked 2026-11-22)
  8. FFmpeg filters documentation: overlay (software used, ffmpeg 6.1.1) (checked 2026-11-22)
  9. W3C WCAG 2.1: definition of contrast ratio (the formula used for the colors table) (checked 2026-11-22)
  10. Koldflux QR code generator (our own tool, run November 22, 2026) (checked 2026-11-22)
  11. Koldflux test log: codes, tool run, tool against library, tables (our measurement) (checked 2026-11-22)
  12. commands.log: the published commands run on the test file and on an edge input (Koldflux) (checked 2026-11-22)
  13. results.tsv: every one of the 118 encodes and its decode counts (Koldflux) (checked 2026-11-22)
  14. matrix.log: the matrix run, one line per encode (Koldflux) (checked 2026-11-22)
  15. cmd-run.log: the ffmpeg command of every encode with its exit code (Koldflux) (checked 2026-11-22)
  16. test-run.sh: how to rerun the test (Koldflux, shell script) (checked 2026-11-22)
  17. gen-qr.cjs: makes the QR PNGs with the tool's library and options (Koldflux, Node.js) (checked 2026-11-22)
  18. tool-run.cjs: drives the live QR tool in headless Chromium (Koldflux, Node.js) (checked 2026-11-22)
  19. tool-compare.py: compares the tool PNGs with the library PNGs (Koldflux, Python 3) (checked 2026-11-22)
  20. run-matrix.py: overlay, encode and decode for every cell (Koldflux, Python 3) (checked 2026-11-22)
  21. decode-cv.py: OpenCV decoder command (Koldflux, Python 3) (checked 2026-11-22)
  22. decode-jsqr.cjs: jsQR decoder command (Koldflux, Node.js) (checked 2026-11-22)
  23. analyze.py: builds the tables on this page from results.tsv (Koldflux, Python 3) (checked 2026-11-22)
  24. mkcmd.sh: writes commands.log (Koldflux, shell script) (checked 2026-11-22)
  25. figs.py: draws the two figures from results.tsv (Koldflux, Python 3) (checked 2026-11-22)
  26. figshot.cjs: renders the figures to PNG (Koldflux, Node.js) (checked 2026-11-22)

We made 8 QR codes (a 34-character and a 114-character link, levels L, M, Q and H) with the qrcode library and the Koldflux tool's options, and drove the live QR tool in headless Chromium on November 22, 2026 to confirm its PNGs matched the library's pixel for pixel. Each code was overlaid with ffmpeg at 60, 90, 120, 180, 240 and 360 px on a 5-second 1920 by 1080 CC0 clip, encoded with x264 at 1.5 and 6 Mbps, and decoded on every 5th frame (31 frames) with OpenCV classic, OpenCV Aruco and jsQR, with exact text match. We varied one thing at a time: width, link length and level, bitrate, the two colors, and the border. Controls: a no-code encode at both bitrates, and the tool PNG decoding to its link. The published commands were run on the test file and on an edge input. No phone and no platform upload was used.