đŹ E2py
June 5, 2026 · View on GitHub
E2py â Analyseur de risques Ă©pileptiques pour vidĂ©os Outil open-source basĂ© sur les normes WCAG 2.3 / ITU-R BT.1702 / Harding PSE
đ Langue / Language
đ«đ· Version française
Table des matiĂšres
- Ă propos
- Normes appliquées
- RÚgles de détection
- Prérequis systÚme
- Installation
- Lancement
- Utilisation pas Ă pas
- Comprendre les résultats
- Format du rapport JSON
- Compiler un exécutable
- Limites et avertissements
- FAQ
1. Ă propos
E2py est une application de bureau GTK4 qui analyse une vidéo frame par frame pour détecter les séquences susceptibles de provoquer des crises d'épilepsie photosensible chez des personnes à risque.
Elle détecte :
- Les flashs lumineux dépassant la fréquence critique de 3 Hz
- Les transitions vers du rouge saturé à fort contraste
- Les zones clignotantes couvrant â„ 25 % de l'image
L'interface est disponible en français et en anglais, commutable en temps réel.
â ïž Cet outil est indicatif. Pour une certification officielle (diffusion tĂ©lĂ©visĂ©e, cinĂ©ma, publicitĂ©), utilisez le Harding PSE Analyser accrĂ©ditĂ© : hardingfpa.tv
2. Normes appliquées
| Norme | Description | Lien |
|---|---|---|
| WCAG 2.1 SC 2.3.1 | CritĂšre "Trois flashs ou sous le seuil" | w3.org |
| ITU-R BT.1702 | Réduction des crises photosensibles (broadcast) | itu.int |
| Harding PSE Criteria | Standard industrie (BBC, ITV, Ofcom) â seuil rouge rĂ©duit de moitiĂ© | hardingfpa.tv |
3. RÚgles de détection
RĂšgle 1 â Flash gĂ©nĂ©ral (WCAG 2.3.1 + ITU-R BT.1702)
- Un flash = transition darkâlight ou lightâdark avec une variation de luminance relative â„ 10 %
- La luminance est calculée en espace sRGB linéarisé :
L = 0.2126·R + 0.7152·G + 0.0722·B - > 3 flashs par seconde sur une fenĂȘtre glissante d'1 seconde = RISQUE
- La zone clignotante doit couvrir â„ 25 % de l'image pour ĂȘtre prise en compte
RĂšgle 2 â Flash rouge saturĂ© (Harding)
- DĂ©tection en espace HSV : teinte H â [0°â10°] ou [160°â180°], saturation S â„ 100/255, valeur V â„ 100/255
- Une transition vers du rouge couvrant â„ 25 % de l'image = RISQUE ACCRU
- Le rouge est considéré deux fois plus dangereux que les autres couleurs selon le standard Harding
RĂšgle 3 â FenĂȘtre temporelle
- Comptage sur une fenĂȘtre glissante stricte d'1 seconde, purgĂ©e frame par frame
- Conforme aux spécifications Harding et WCAG
4. Prérequis systÚme
Linux (Ubuntu 22.04+ / Debian 12+ / Fedora 38+)
# Ubuntu / Debian
sudo apt install python3 python3-pip python3-gi python3-gi-cairo gir1.2-gtk-4.0 gir1.2-adw-1
# Fedora
sudo dnf install python3 python3-pip python3-gobject gtk4 libadwaita
Windows
GTK4 n'est pas natif sous Windows. Installer MSYS2 (msys2.org), puis dans le terminal MSYS2 :
pacman -S mingw-w64-x86_64-python mingw-w64-x86_64-python-pip mingw-w64-x86_64-python-gobject mingw-w64-x86_64-gtk4 mingw-w64-x86_64-libadwaita mingw-w64-x86_64-opencv mingw-w64-x86_64-python-numpy
Dépendances Python (auto-installées)
Les packages Python suivants sont installés automatiquement au premier lancement si absents :
| Package | Version minimale | RĂŽle |
|---|---|---|
opencv-python | 4.x | Décodage vidéo, traitement HSV |
numpy | 1.21+ | Calculs matriciels (luminance) |
5. Installation
Aucune installation requise. Il suffit de télécharger le fichier :
e2py.py
Et de le lancer directement (voir section suivante).
6. Lancement
python3 e2py.py
Au premier lancement, si opencv-python ou numpy sont absents, le script les installe automatiquement via pip. Un message s'affiche dans le terminal :
[auto-install] Packages manquants : opencv-python
[auto-install] â
opencv-python installé.
Si l'installation automatique échoue (environnement Python géré par le systÚme) :
pip3 install opencv-python numpy --break-system-packages
7. Utilisation pas Ă pas
Ătape 1 â SĂ©lectionner la vidĂ©o
Cliquez sur "Parcourir" ou sur l'icĂŽne đ dans la barre de titre pour ouvrir le sĂ©lecteur de fichiers.
Formats supportés : MP4, MKV, AVI, MOV, WEBM, FLV, WMV, TS, M4V
Le nom du fichier et son chemin s'affichent dans la zone de sélection.
Ătape 2 â Choisir la langue (optionnel)
Utilisez les boutons đ«đ· FR / đŹđ§ EN en haut Ă droite pour basculer la langue de l'interface.
Ătape 3 â Lancer l'analyse
Cliquez sur le bouton "Lancer l'analyse" (bleu).
La barre de progression affiche l'avancement en temps réel :
Frame 1500/3600 â 41%
Pour interrompre Ă tout moment, cliquez sur "Annuler" (rouge).
Ătape 4 â Lire les rĂ©sultats
Une fois l'analyse terminée, trois zones s'affichent :
- BanniÚre colorée : résultat global (vert / orange / rouge)
- Informations vidéo : durée, FPS, frames, fréquence max
- Liste des événements : timestamp précis de chaque séquence problématique
Ătape 5 â Exporter le rapport (optionnel)
Cliquez sur l'icĂŽne đŸ dans la barre de titre pour sauvegarder un rapport JSON complet.
8. Comprendre les résultats
Niveaux de risque
| Résultat | Couleur | Signification |
|---|---|---|
| â PASS | Vert | Aucun flash problĂ©matique. Conforme WCAG 2.3 / Harding |
| â ïž WARNING | Orange | FrĂ©quence proche du seuil (> 2,4 Hz). VĂ©rification manuelle conseillĂ©e |
| â FAIL | Rouge | SĂ©quences dangereuses dĂ©tectĂ©es. Modification de la vidĂ©o recommandĂ©e |
Informations affichées
| Champ | Description |
|---|---|
| Durée | Durée totale de la vidéo en secondes |
| FPS | Nombre d'images par seconde |
| Frames totales | Nombre total de frames analysées |
| Fréq. flash maximale | Fréquence de flash la plus élevée observée (Hz). En rouge si > 3 Hz |
Liste des flashs généraux
Chaque ligne correspond à une séquence dépassant 3 flashs/seconde :
â± 12.34 s â 4 flashs/seconde
â± 45.10 s â 5 flashs/seconde
Liste des flashs rouges
Chaque ligne correspond à une apparition soudaine de rouge saturé sur ℠25 % de l'image :
â± 8.20 s â Rouge saturĂ© â„ 25 % de l'image
Le rouge est traité séparément car il est deux fois plus dangereux selon le critÚre Harding.
9. Format du rapport JSON
Le rapport exporté contient :
{
"risk_level": "FAIL",
"fps": 25.0,
"total_frames": 3750,
"duration_s": 150.0,
"max_flash_freq": 5.0,
"flash_events": [
{
"time_s": 12.34,
"freq_hz": 4,
"delta_luma": 0.1842
}
],
"red_flash_events": [8.2, 34.56]
}
| Champ | Type | Description |
|---|---|---|
risk_level | string | "PASS", "WARNING" ou "FAIL" |
fps | float | FPS de la vidéo source |
total_frames | int | Nombre de frames analysées |
duration_s | float | Durée en secondes |
max_flash_freq | float | Fréquence de flash maximale observée (Hz) |
flash_events | array | Liste des séquences dépassant 3 Hz |
flash_events[].time_s | float | Timestamp en secondes |
flash_events[].freq_hz | int | Fréquence en flashs/seconde à ce moment |
flash_events[].delta_luma | float | Variation de luminance relative déclenchante |
red_flash_events | array | Timestamps des flashs rouges (secondes) |
10. Compiler un exécutable
Linux â PyInstaller
pip install pyinstaller --break-system-packages
pyinstaller --onefile --name "E2py" e2py.py
# Résultat : dist/E2py
La machine cible doit avoir GTK4 installé :
sudo apt install libgtk-4-1 libadwaita-1-0
Windows â PyInstaller via MSYS2
Dans le terminal MSYS2 :
pip install pyinstaller
pyinstaller --onefile --windowed --name "E2py" e2py.py
# Résultat : dist/E2py.exe
11. Limites et avertissements
- Cet outil est indicatif, pas certifié. Il ne remplace pas le Harding PSE Analyser officiel.
- La détection repose sur la luminance moyenne de la frame entiÚre. Les flashs localisés sur une petite zone (< 25 % de l'écran) ne sont pas signalés, conformément à WCAG 2.3.1.
- Les vidéos à trÚs bas FPS (< 10 fps) peuvent produire des résultats moins précis.
- Les codecs rares ou fichiers corrompus peuvent échouer à l'ouverture.
- Pour une certification officielle (diffusion TV, plateformes, cinéma) : hardingfpa.tv
12. FAQ
| Question | Réponse |
|---|---|
| Ăa marche pas, câest normal ? | Oui. Câest probablement la faute Ă ton PC. Ou Ă toi. Ou aux deux. |
| Pourquoi câest lent ? | Parce que ta vidĂ©o est en 4K, ou que ton CPU a 10 ans. Ou les deux. |
| Je peux vendre ce code ? | Bien sûr ! Mais si tu deviens riche, invite-moi un café. (Ou pas.) |
| Câest sĂ»r Ă 100% ? | Non. Rien ne lâest. MĂȘme pas la mort. (DĂ©solĂ© pour le spoil.) |
| Je peux lâutiliser pour pirater ? | Techniquement oui, mais zeima te regarde avec dĂ©ception. (Et le FBI aussi.) |
| Je peux modifier le code ? | DO WHAT THE FUCK YOU WANT TO. (Mais assume les conséquences.) |
| Câest compatible Mac ? | Peut-ĂȘtre. Essaye et dis-moi. (Ou pas.) |
| Pourquoi ce nom, "E2py" ? | Parce que "EpilepsyDetector3000" était déjà pris. (Et trop long à taper.) |
| Je peux en faire un chapeau ? | Oui. Mais envoye une photo. (Pour la science.) |
đŹđ§ English version
Table of contents
- About
- Standards applied
- Detection rules
- System requirements
- Installation
- Running the app
- Step-by-step usage
- Understanding results
- JSON report format
- Building an executable
- Limitations and disclaimer
- Q/A
1. About
E2py is a GTK4 desktop application that analyses a video frame by frame to detect sequences likely to trigger photosensitive epileptic seizures.
It detects:
- Luminance flashes exceeding the critical frequency of 3 Hz
- Transitions to saturated red at high contrast
- Flashing areas covering â„ 25 % of the image
The interface supports French and English, switchable at any time.
â ïž This tool is indicative. For official certification (broadcast TV, cinema, advertising), use the accredited Harding PSE Analyser: hardingfpa.tv
2. Standards applied
| Standard | Description | Link |
|---|---|---|
| WCAG 2.1 SC 2.3.1 | "Three Flashes or Below Threshold" criterion | w3.org |
| ITU-R BT.1702 | Guidance for reduction of photosensitive epileptic seizures | itu.int |
| Harding PSE Criteria | Industry standard (BBC, ITV, Ofcom) â red threshold halved | hardingfpa.tv |
3. Detection rules
Rule 1 â General flash (WCAG 2.3.1 + ITU-R BT.1702)
- A flash = darkâlight or lightâdark transition with relative luminance change â„ 10 %
- Luminance computed in linearised sRGB:
L = 0.2126·R + 0.7152·G + 0.0722·B - > 3 flashes per second over a rolling 1-second window = RISK
- The flashing area must cover â„ 25 % of the image to be counted
Rule 2 â Saturated red flash (Harding)
- Detection in HSV space: hue H â [0°â10°] or [160°â180°], saturation S â„ 100/255, value V â„ 100/255
- A transition to red covering â„ 25 % of the frame = HIGH RISK
- Red is considered twice as dangerous as other colours under the Harding standard
Rule 3 â Time window
- Counting uses a strict rolling 1-second window, purged frame by frame
- Fully compliant with Harding and WCAG specifications
4. System requirements
Linux (Ubuntu 22.04+ / Debian 12+ / Fedora 38+)
# Ubuntu / Debian
sudo apt install python3 python3-pip python3-gi python3-gi-cairo gir1.2-gtk-4.0 gir1.2-adw-1
# Fedora
sudo dnf install python3 python3-pip python3-gobject gtk4 libadwaita
Windows
GTK4 is not native on Windows. Install MSYS2 (msys2.org), then in the MSYS2 terminal:
pacman -S mingw-w64-x86_64-python mingw-w64-x86_64-python-pip mingw-w64-x86_64-python-gobject mingw-w64-x86_64-gtk4 mingw-w64-x86_64-libadwaita mingw-w64-x86_64-opencv mingw-w64-x86_64-python-numpy
Python dependencies (auto-installed)
The following Python packages are installed automatically on first launch if missing:
| Package | Min version | Role |
|---|---|---|
opencv-python | 4.x | Video decoding, HSV processing |
numpy | 1.21+ | Matrix calculations (luminance) |
5. Installation
No installation needed. Just download the single file:
e2py.py
Then run it directly (see next section).
6. Running the app
python3 e2py.py
On first launch, if opencv-python or numpy are missing, the script installs them automatically via pip. A message is shown in the terminal:
[auto-install] Missing packages: opencv-python
[auto-install] â
opencv-python installed.
If automatic installation fails (system-managed Python environment):
pip3 install opencv-python numpy --break-system-packages
7. Step-by-step usage
Step 1 â Select the video
Click "Browse" or the đ icon in the title bar to open the file picker.
Supported formats: MP4, MKV, AVI, MOV, WEBM, FLV, WMV, TS, M4V
The filename and path appear in the selection area.
Step 2 â Choose language (optional)
Use the đ«đ· FR / đŹđ§ EN buttons in the top-right corner to switch the interface language.
Step 3 â Start the analysis
Click the "Start analysis" button (blue).
The progress bar updates in real time:
Frame 1500/3600 â 41%
To stop at any time, click "Cancel" (red).
Step 4 â Read the results
Once analysis is complete, three sections appear:
- Coloured banner: overall result (green / orange / red)
- Video information: duration, FPS, frames, max frequency
- Event list: precise timestamp of each problematic sequence
Step 5 â Export the report (optional)
Click the đŸ icon in the title bar to save a complete JSON report.
8. Understanding results
Risk levels
| Result | Colour | Meaning |
|---|---|---|
| â PASS | Green | No problematic flashes. Compliant with WCAG 2.3 / Harding |
| â ïž WARNING | Orange | Frequency near threshold (> 2.4 Hz). Manual review recommended |
| â FAIL | Red | Dangerous sequences detected. Video modification recommended |
Displayed information
| Field | Description |
|---|---|
| Duration | Total video duration in seconds |
| FPS | Frames per second |
| Total frames | Total number of frames analysed |
| Max flash frequency | Highest observed flash frequency (Hz). Shown in red if > 3 Hz |
General flash list
Each row represents a sequence exceeding 3 flashes/second:
â± 12.34 s â 4 flashes/second
â± 45.10 s â 5 flashes/second
Red flash list
Each row represents a sudden appearance of saturated red covering â„ 25 % of the frame:
â± 8.20 s â Saturated red â„ 25 % of frame
Red is handled separately because it is twice as dangerous under the Harding criterion.
9. JSON report format
The exported report contains:
{
"risk_level": "FAIL",
"fps": 25.0,
"total_frames": 3750,
"duration_s": 150.0,
"max_flash_freq": 5.0,
"flash_events": [
{
"time_s": 12.34,
"freq_hz": 4,
"delta_luma": 0.1842
}
],
"red_flash_events": [8.2, 34.56]
}
| Field | Type | Description |
|---|---|---|
risk_level | string | "PASS", "WARNING" or "FAIL" |
fps | float | Source video FPS |
total_frames | int | Number of frames analysed |
duration_s | float | Duration in seconds |
max_flash_freq | float | Maximum observed flash frequency (Hz) |
flash_events | array | List of sequences exceeding 3 Hz |
flash_events[].time_s | float | Timestamp in seconds |
flash_events[].freq_hz | int | Flash frequency at that moment |
flash_events[].delta_luma | float | Triggering relative luminance variation |
red_flash_events | array | Red flash timestamps (seconds) |
10. Building an executable
Linux â PyInstaller
pip install pyinstaller --break-system-packages
pyinstaller --onefile --name "E2py" e2py.py
# Output: dist/E2py
Target machine must have GTK4:
sudo apt install libgtk-4-1 libadwaita-1-0
Windows â PyInstaller via MSYS2
In the MSYS2 terminal:
pip install pyinstaller
pyinstaller --onefile --windowed --name "E2py" e2py.py
# Output: dist/E2py.exe
11. Limitations and disclaimer
- This tool is indicative, not certified. It does not replace the official Harding PSE Analyser.
- Detection is based on the average luminance of the full frame. Flashes localised to a small area (< 25 % of screen) are not flagged, in accordance with WCAG 2.3.1.
- Videos with very low FPS (< 10 fps) may produce less accurate results.
- Unusual codecs or corrupted files may fail to open.
- For official certification (broadcast TV, streaming platforms, cinema): hardingfpa.tv
12.Q/A
| Question | Answer |
|---|---|
| Is it not working? Is that normal? | Yes. Itâs probably your PCâs fault. Or yours. Or both. |
| Why is it so slow? | Because your video is in 4K, or your CPU is 10 years old. Or both. |
| Can I sell this code? | Of course! But if you get rich, buy me a coffee. (Or donât.) |
| Is it 100% reliable? | No. Nothing is. Not even death. (Sorry for the spoiler.) |
| Can I use it for hacking? | Technically yes, but zeima is judging you. (And so is the FBI.) |
| Can I modify the code? | DO WHAT THE FUCK YOU WANT TO. (But own the consequences.) |
| Is it Mac-compatible? | Maybe. Try it and let me know. (Or donât.) |
| Why the name "E2py"? | Because "EpilepsyDetector3000" was already taken. (And too long to type.) |
| Can I turn it into a hat? | Yes. But send a photo. (For science.) |
| Whatâs the answer to everything? | 42, but Iâm not Mistral, let alone Claude. |
Licence / License
Ce projet est distribué sous licence WTFPL. This project is distributed under the WTFPL licence. Read the license thank you
RĂ©fĂ©rences / References : WCAG 2.1 â https://www.w3.org/TR/WCAG21/#three-flashes-or-below-threshold ITU-R BT.1702 â https://www.itu.int/rec/R-REC-BT.1702/en Harding PSE Analyser â https://www.hardingfpa.tv