User avatar
HermannSW
Posts: 5180
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany

Light bulb power line flicker observed with 125fps video

Thu Sep 14, 2017 10:04 pm

Thanks to 6by9's help in other thread posting I am able to convert raw video captured by v4l2-ctrl from USB webcam to .avi format. I did capture 3 seconds 320x240@125fps video to test the commands (see below). The video is boring I thought, but it turned out that I get a brightness change pattern repeating every 5 frames by the powerline connected light bulb. I stored 5 frames as .gif and used gifsicle to generate this endless loop, 125 times slowed down, animation:
Image

Repeating every 5 frames at 125fps is every 5*8ms=40ms, or 25 times a second. This is related to German 230V/50Hz powerline, and I cannot explain why half of the 50Hz frequency. But I really like being able to "see this repeating pattern" with 125fps video:
https://en.wikipedia.org/wiki/Power-line_flicker

Hermann.

Code: Select all

$ time v4l2-ctl -p 125 -d /dev/video1 -v width=320,height=240,pixelformat=0,field=none,bytesperline=640 --stream-mmap=3 --stream-count=375 --stream-to file.125.raw
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 125 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 125 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Frame rate set to 125.000 fps

real	0m3.109s
user	0m0.007s
sys	0m0.168s
$ 
$ ffmpeg -f rawvideo -pixel_format yuyv422 -video_size 320x240 -framerate 125 -i file.125.raw -vcodec copy file.125.avi
ffmpeg version 3.3.4 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-18)
  configuration: --disable-yasm
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
[rawvideo @ 0x3a1b4e0] Estimating duration from bitrate, this may be inaccurate
Input #0, rawvideo, from 'file.125.raw':
  Duration: 00:00:03.00, start: 0.000000, bitrate: 153600 kb/s
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 320x240, 153600 kb/s, 125 fps, 125 tbr, 125 tbn, 125 tbc
Output #0, avi, to 'file.125.avi':
  Metadata:
    ISFT            : Lavf57.71.100
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 320x240, q=2-31, 153600 kb/s, 125 fps, 125 tbr, 125 tbn, 125 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=  375 fps=0.0 q=-1.0 Lsize=   56264kB time=00:00:03.00 bitrate=153639.2kbits/s speed=57.2x    
video:56250kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.025497%
$ 
$ totem file.125.avi 
https://hermann-sw.github.io/planar_graph_playground
https://stamm-wilbrandt.de/en#raspcatbt
https://github.com/Hermann-SW/memrun
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/en/Raspberry_camera.html

perrociego
Posts: 14
Joined: Fri Jan 06, 2017 4:21 am

Re: Light bulb power line flicker observed with 125fps video

Sun Sep 17, 2017 5:56 pm

Hi Hermann:

You could record flicker at almost any fps.

Tungsten light bulbs flicker at 100 pulses by second (on 50 Hz AC) (or 120 at 60 Hz). Specially the small ones (25 W - 40W). Most evident is in fluorescent lamps with magnetic ballast (the heavy ones, instead of the electronics). There are other cases but not so common (CRT, electronic dimmers).
It depends on the fps and exposure time. The mathematics of it are not very easy. You could see http://www.davidsatz.com/aboutflicker_en.html

By the way. On Europe the old analog tv was 25 fps because the electricity was 50 Hz. It was a necesary decition at the begining. And while its 25 cps, really it is 50 fields per second.

Marcelo

Return to “Camera board”