-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
155 lines (130 loc) · 25 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
words = [{'start': 0.009, 'end': 0.77, 'text': ' Star !', 'words': [{'word': 'Star', 'start': 0.009, 'end': 0.229, 'score': 0.216}, {'word': '!'}]}, {'start': 0.77, 'end': 5.653, 'text': "Il est vraiment pour les gens un peu... Non... C'est Mbappé et tout, vrai star, c'est du haut niveau.", 'words': [{'word': 'Il', 'start': 0.77, 'end': 0.81, 'score': 0.121}, {'word': 'est', 'start': 0.85, 'end': 1.21, 'score': 0.383}, {'word': 'vraiment', 'start': 1.23, 'end': 1.47, 'score': 0.683}, {'word': 'pour', 'start': 1.51, 'end': 1.63, 'score': 0.82}, {'word': 'les', 'start': 1.65, 'end': 1.73, 'score': 0.845}, {'word': 'gens', 'start': 1.75, 'end': 2.231, 'score': 0.662}, {'word': 'un', 'start': 2.291, 'end': 2.871, 'score': 0.702}, {'word': 'peu...', 'start': 2.891, 'end': 2.971, 'score': 0.197}, {'word': 'Non...', 'start': 3.031, 'end': 3.352, 'score': 0.634}, {'word': "C'est", 'start': 3.372, 'end': 3.472, 'score': 0.642}, {'word': 'Mbappé', 'start': 3.552, 'end': 3.912, 'score': 0.695}, {'word': 'et', 'start': 3.952, 'end': 4.032, 'score': 0.608}, {'word': 'tout,', 'start': 4.052, 'end': 4.232, 'score': 0.728}, {'word': 'vrai', 'start': 4.272, 'end': 4.493, 'score': 0.55}, {'word': 'star,', 'start': 4.513, 'end': 4.773, 'score': 0.907}, {'word': "c'est", 'start': 4.813, 'end': 4.933, 'score': 0.534}, {'word': 'du', 'start': 4.953, 'end': 5.213, 'score': 0.503}, {'word': 'haut', 'start': 5.253, 'end': 5.373, 'score': 0.258}, {'word': 'niveau.', 'start': 5.413, 'end': 5.613, 'score': 0.308}]}, {'start': 5.653, 'end': 6.654, 'text': 'Star, star, je te parle.', 'words': [{'word': 'Star,', 'start': 5.653, 'end': 5.934, 'score': 0.782}, {'word': 'star,', 'start': 5.954, 'end': 6.134, 'score': 0.798}, {'word': 'je', 'start': 6.234, 'end': 6.274, 'score': 0.234}, {'word': 'te', 'start': 6.294, 'end': 6.434, 'score': 0.844}, {'word': 'parle.', 'start': 6.454, 'end': 6.614, 'score': 0.841}]}, {'start': 6.654, 'end': 9.276, 'text': "Star pour moi c'est, il arrive, tout le monde craque.", 'words': [{'word': 'Star', 'start': 6.654, 'end': 6.854, 'score': 0.887}, {'word': 'pour', 'start': 6.874, 'end': 7.015, 'score': 0.807}, {'word': 'moi', 'start': 7.035, 'end': 7.175, 'score': 0.912}, {'word': "c'est,", 'start': 7.195, 'end': 7.375, 'score': 0.729}, {'word': 'il', 'start': 7.415, 'end': 7.535, 'score': 0.754}, {'word': 'arrive,', 'start': 7.595, 'end': 8.175, 'score': 0.877}, {'word': 'tout', 'start': 8.195, 'end': 8.476, 'score': 0.708}, {'word': 'le', 'start': 8.536, 'end': 8.596, 'score': 0.88}, {'word': 'monde', 'start': 8.636, 'end': 8.816, 'score': 0.783}, {'word': 'craque.', 'start': 8.836, 'end': 9.236, 'score': 0.544}]}, {'start': 9.276, 'end': 10.217, 'text': 'Genre Omar Sy, tu vois.', 'words': [{'word': 'Genre', 'start': 9.276, 'end': 9.456, 'score': 0.438}, {'word': 'Omar', 'start': 9.496, 'end': 9.757, 'score': 0.704}, {'word': 'Sy,', 'start': 9.797, 'end': 9.897, 'score': 0.459}, {'word': 'tu', 'start': 9.917, 'end': 9.997, 'score': 0.524}, {'word': 'vois.', 'start': 10.017, 'end': 10.177, 'score': 0.306}]}, {'start': 10.217, 'end': 13.56, 'text': 'Pour moi les gars, vous avez le statut de star en vrai.', 'words': [{'word': 'Pour', 'start': 10.217, 'end': 10.337, 'score': 0.879}, {'word': 'moi', 'start': 10.357, 'end': 10.437, 'score': 0.822}, {'word': 'les', 'start': 10.477, 'end': 10.537, 'score': 0.571}, {'word': 'gars,', 'start': 10.557, 'end': 10.637, 'score': 0.042}, {'word': 'vous', 'start': 10.657, 'end': 10.737, 'score': 0.966}, {'word': 'avez', 'start': 10.757, 'end': 10.838, 'score': 0.799}, {'word': 'le', 'start': 10.858, 'end': 10.898, 'score': 0.839}, {'word': 'statut', 'start': 10.918, 'end': 11.158, 'score': 0.843}, {'word': 'de', 'start': 11.178, 'end': 11.238, 'score': 0.758}, {'word': 'star', 'start': 11.258, 'end': 11.438, 'score': 0.691}, {'word': 'en', 'start': 11.498, 'end': 12.599, 'score': 0.658}, {'word': 'vrai.', 'start': 12.619, 'end': 13.5, 'score': 0.343}]}, {'start': 13.56, 'end': 20.285, 'text': "Non, non... Je pense qu'on a des statuts de grosses célébrités, mais pour moi une star, elle arrive et il y a tout le monde qui craque.", 'words': [{'word': 'Non,', 'start': 13.56, 'end': 14.16, 'score': 0.28}, {'word': 'non...', 'start': 14.18, 'end': 14.3, 'score': 0.063}, {'word': 'Je', 'start': 14.52, 'end': 14.601, 'score': 0.711}, {'word': 'pense', 'start': 14.621, 'end': 14.761, 'score': 0.855}, {'word': "qu'on", 'start': 14.781, 'end': 14.921, 'score': 0.461}, {'word': 'a', 'start': 14.981, 'end': 15.021, 'score': 0.756}, {'word': 'des', 'start': 15.041, 'end': 15.101, 'score': 0.569}, {'word': 'statuts', 'start': 15.121, 'end': 15.461, 'score': 0.433}, {'word': 'de', 'start': 15.481, 'end': 15.922, 'score': 0.714}, {'word': 'grosses', 'start': 16.082, 'end': 16.262, 'score': 0.357}, {'word': 'célébrités,', 'start': 16.282, 'end': 16.982, 'score': 0.739}, {'word': 'mais', 'start': 17.002, 'end': 17.443, 'score': 0.943}, {'word': 'pour', 'start': 17.483, 'end': 17.623, 'score': 0.8}, {'word': 'moi', 'start': 17.643, 'end': 17.743, 'score': 0.766}, {'word': 'une', 'start': 17.783, 'end': 17.863, 'score': 0.929}, {'word': 'star,', 'start': 17.903, 'end': 18.143, 'score': 0.788}, {'word': 'elle', 'start': 18.183, 'end': 18.363, 'score': 0.768}, {'word': 'arrive', 'start': 18.383, 'end': 18.764, 'score': 0.937}, {'word': 'et', 'start': 18.804, 'end': 18.844, 'score': 0.222}, {'word': 'il', 'start': 18.864, 'end': 18.904, 'score': 0.189}, {'word': 'y', 'start': 18.924, 'end': 18.944, 'score': 0.723}, {'word': 'a', 'start': 19.004, 'end': 19.224, 'score': 0.902}, {'word': 'tout', 'start': 19.264, 'end': 19.444, 'score': 0.803}, {'word': 'le', 'start': 19.504, 'end': 19.584, 'score': 0.918}, {'word': 'monde', 'start': 19.624, 'end': 19.765, 'score': 0.836}, {'word': 'qui', 'start': 19.785, 'end': 19.885, 'score': 0.955}, {'word': 'craque.', 'start': 19.925, 'end': 20.265, 'score': 0.572}]}, {'start': 20.285, 'end': 22.807, 'text': "C'est parce que vous, vous avez le truc à l'international.", 'words': [{'word': "C'est", 'start': 20.285, 'end': 20.365, 'score': 0.945}, {'word': 'parce', 'start': 20.385, 'end': 20.485, 'score': 0.955}, {'word': 'que', 'start': 20.505, 'end': 20.565, 'score': 0.927}, {'word': 'vous,', 'start': 20.585, 'end': 20.705, 'score': 0.9}, {'word': 'vous', 'start': 20.725, 'end': 20.825, 'score': 0.826}, {'word': 'avez', 'start': 20.885, 'end': 20.986, 'score': 0.76}, {'word': 'le', 'start': 21.006, 'end': 21.926, 'score': 0.554}, {'word': 'truc', 'start': 21.986, 'end': 22.086, 'score': 0.358}, {'word': 'à', 'start': 22.126, 'end': 22.227, 'score': 0.412}, {'word': "l'international.", 'start': 22.247, 'end': 22.787, 'score': 0.851}]}, {'start': 22.807, 'end': 23.668, 'text': "C'est pas ça, non ?", 'words': [{'word': "C'est", 'start': 22.807, 'end': 23.087, 'score': 0.223}, {'word': 'pas', 'start': 23.107, 'end': 23.187, 'score': 0.172}, {'word': 'ça,', 'start': 23.207, 'end': 23.327, 'score': 0.587}, {'word': 'non', 'start': 23.347, 'end': 23.628, 'score': 0.603}, {'word': '?'}]}, {'start': 23.668, 'end': 25.289, 'text': 'Mais non, mais même il y a des stars françaises.', 'words': [{'word': 'Mais', 'start': 23.668, 'end': 23.768, 'score': 0.735}, {'word': 'non,', 'start': 23.808, 'end': 23.908, 'score': 0.718}, {'word': 'mais', 'start': 23.948, 'end': 24.048, 'score': 0.757}, {'word': 'même', 'start': 24.068, 'end': 24.168, 'score': 0.957}, {'word': 'il', 'start': 24.188, 'end': 24.228, 'score': 0.883}, {'word': 'y', 'start': 24.248, 'end': 24.268, 'score': 0.918}, {'word': 'a', 'start': 24.288, 'end': 24.328, 'score': 0.177}, {'word': 'des', 'start': 24.368, 'end': 24.428, 'score': 0.68}, {'word': 'stars', 'start': 24.448, 'end': 24.728, 'score': 0.54}, {'word': 'françaises.', 'start': 24.749, 'end': 25.269, 'score': 0.373}]}, {'start': 25.289, 'end': 29.132, 'text': 'Je sais pas, Booba, il arrive à un endroit, tout le monde va parler, tout le monde va dire', 'words': [{'word': 'Je', 'start': 25.289, 'end': 25.729, 'score': 0.954}, {'word': 'sais', 'start': 25.749, 'end': 25.849, 'score': 0.469}, {'word': 'pas,', 'start': 25.869, 'end': 25.949, 'score': 0.172}, {'word': 'Booba,', 'start': 25.989, 'end': 26.47, 'score': 0.736}, {'word': 'il', 'start': 26.55, 'end': 26.63, 'score': 0.816}, {'word': 'arrive', 'start': 26.67, 'end': 26.89, 'score': 0.856}, {'word': 'à', 'start': 26.91, 'end': 26.93, 'score': 0.916}, {'word': 'un', 'start': 26.97, 'end': 27.01, 'score': 0.971}, {'word': 'endroit,', 'start': 27.07, 'end': 27.371, 'score': 0.812}, {'word': 'tout', 'start': 27.871, 'end': 27.971, 'score': 0.874}, {'word': 'le', 'start': 27.991, 'end': 28.031, 'score': 0.998}, {'word': 'monde', 'start': 28.051, 'end': 28.191, 'score': 0.788}, {'word': 'va', 'start': 28.251, 'end': 28.371, 'score': 0.847}, {'word': 'parler,', 'start': 28.411, 'end': 28.632, 'score': 0.797}, {'word': 'tout', 'start': 28.652, 'end': 28.772, 'score': 0.296}, {'word': 'le', 'start': 28.792, 'end': 28.832, 'score': 0.915}, {'word': 'monde', 'start': 28.852, 'end': 28.952, 'score': 0.957}, {'word': 'va', 'start': 28.972, 'end': 29.032, 'score': 0.25}, {'word': 'dire', 'start': 29.052, 'end': 29.132, 'score': 0.0}]}, {'start': 29.272, 'end': 33.777, 'text': ' il est là tu vois ça va être ça va créer une émulsion totale et radicale dans un endroit.', 'words': [{'word': 'il', 'start': 29.272, 'end': 29.432, 'score': 0.464}, {'word': 'est', 'start': 29.632, 'end': 29.813, 'score': 0.344}, {'word': 'là', 'start': 29.833, 'end': 30.013, 'score': 0.656}, {'word': 'tu', 'start': 30.033, 'end': 30.113, 'score': 0.392}, {'word': 'vois', 'start': 30.133, 'end': 30.253, 'score': 0.606}, {'word': 'ça', 'start': 30.273, 'end': 30.393, 'score': 0.614}, {'word': 'va', 'start': 30.413, 'end': 30.533, 'score': 0.667}, {'word': 'être', 'start': 30.573, 'end': 31.134, 'score': 0.672}, {'word': 'ça', 'start': 31.174, 'end': 31.254, 'score': 0.578}, {'word': 'va', 'start': 31.294, 'end': 31.514, 'score': 0.5}, {'word': 'créer', 'start': 31.534, 'end': 31.715, 'score': 0.715}, {'word': 'une', 'start': 31.755, 'end': 31.855, 'score': 0.779}, {'word': 'émulsion', 'start': 31.895, 'end': 32.435, 'score': 0.816}, {'word': 'totale', 'start': 32.475, 'end': 32.856, 'score': 0.916}, {'word': 'et', 'start': 32.876, 'end': 32.956, 'score': 0.73}, {'word': 'radicale', 'start': 32.996, 'end': 33.356, 'score': 0.901}, {'word': 'dans', 'start': 33.396, 'end': 33.476, 'score': 0.682}, {'word': 'un', 'start': 33.516, 'end': 33.596, 'score': 0.184}, {'word': 'endroit.', 'start': 33.616, 'end': 33.757, 'score': 0.079}]}, {'start': 33.777, 'end': 47.11, 'text': "Et c'est toujours dur d'avoir le recul sur soi même peut-être que Booba se dit que il y a des gens encore plus connus que lui etc je sais pas mais tu vois en tout cas on débat sur vous si vous êtes des stars pas sur moi déjà donc tu vois déjà il y a une différence c'est ça que je constate mais moi à mes yeux en tout cas", 'words': [{'word': 'Et', 'start': 33.777, 'end': 33.817, 'score': 0.002}, {'word': "c'est", 'start': 33.837, 'end': 33.937, 'score': 0.014}, {'word': 'toujours', 'start': 33.957, 'end': 34.117, 'score': 0.527}, {'word': 'dur', 'start': 34.137, 'end': 34.197, 'score': 0.006}, {'word': "d'avoir", 'start': 34.217, 'end': 34.337, 'score': 0.607}, {'word': 'le', 'start': 34.357, 'end': 34.397, 'score': 0.254}, {'word': 'recul', 'start': 34.437, 'end': 34.677, 'score': 0.895}, {'word': 'sur', 'start': 34.718, 'end': 34.798, 'score': 0.806}, {'word': 'soi', 'start': 34.818, 'end': 34.978, 'score': 0.667}, {'word': 'même', 'start': 35.018, 'end': 35.318, 'score': 0.964}, {'word': 'peut-être', 'start': 35.338, 'end': 35.618, 'score': 0.632}, {'word': 'que', 'start': 35.658, 'end': 35.739, 'score': 0.833}, {'word': 'Booba', 'start': 35.759, 'end': 35.999, 'score': 0.701}, {'word': 'se', 'start': 36.019, 'end': 36.139, 'score': 0.646}, {'word': 'dit', 'start': 36.179, 'end': 36.339, 'score': 0.874}, {'word': 'que', 'start': 36.379, 'end': 37.06, 'score': 0.982}, {'word': 'il', 'start': 37.12, 'end': 37.18, 'score': 0.742}, {'word': 'y', 'start': 37.22, 'end': 37.24, 'score': 0.926}, {'word': 'a', 'start': 37.26, 'end': 37.32, 'score': 0.657}, {'word': 'des', 'start': 37.36, 'end': 37.44, 'score': 0.502}, {'word': 'gens', 'start': 37.46, 'end': 37.58, 'score': 0.241}, {'word': 'encore', 'start': 37.62, 'end': 37.861, 'score': 0.907}, {'word': 'plus', 'start': 37.901, 'end': 38.161, 'score': 0.872}, {'word': 'connus', 'start': 38.201, 'end': 38.441, 'score': 0.848}, {'word': 'que', 'start': 38.461, 'end': 38.521, 'score': 0.003}, {'word': 'lui', 'start': 38.541, 'end': 38.722, 'score': 0.596}, {'word': 'etc', 'start': 38.782, 'end': 39.062, 'score': 0.887}, {'word': 'je', 'start': 39.082, 'end': 39.162, 'score': 0.32}, {'word': 'sais', 'start': 39.202, 'end': 39.342, 'score': 0.24}, {'word': 'pas', 'start': 39.382, 'end': 39.482, 'score': 0.565}, {'word': 'mais', 'start': 39.502, 'end': 39.582, 'score': 0.027}, {'word': 'tu', 'start': 39.622, 'end': 39.703, 'score': 0.48}, {'word': 'vois', 'start': 39.723, 'end': 39.843, 'score': 0.179}, {'word': 'en', 'start': 39.863, 'end': 39.923, 'score': 0.693}, {'word': 'tout', 'start': 39.943, 'end': 40.063, 'score': 0.88}, {'word': 'cas', 'start': 40.083, 'end': 40.343, 'score': 0.829}, {'word': 'on', 'start': 40.403, 'end': 40.503, 'score': 0.914}, {'word': 'débat', 'start': 40.543, 'end': 40.784, 'score': 0.849}, {'word': 'sur', 'start': 40.824, 'end': 41.004, 'score': 0.915}, {'word': 'vous', 'start': 41.044, 'end': 41.164, 'score': 0.854}, {'word': 'si', 'start': 41.184, 'end': 41.244, 'score': 0.986}, {'word': 'vous', 'start': 41.264, 'end': 41.384, 'score': 0.76}, {'word': 'êtes', 'start': 41.424, 'end': 41.544, 'score': 0.793}, {'word': 'des', 'start': 41.564, 'end': 41.624, 'score': 0.804}, {'word': 'stars', 'start': 41.644, 'end': 41.865, 'score': 0.713}, {'word': 'pas', 'start': 41.885, 'end': 41.985, 'score': 0.818}, {'word': 'sur', 'start': 42.025, 'end': 42.145, 'score': 0.926}, {'word': 'moi', 'start': 42.165, 'end': 42.445, 'score': 0.776}, {'word': 'déjà', 'start': 42.465, 'end': 43.586, 'score': 0.91}, {'word': 'donc', 'start': 43.626, 'end': 43.767, 'score': 0.282}, {'word': 'tu', 'start': 43.787, 'end': 43.867, 'score': 0.366}, {'word': 'vois', 'start': 43.887, 'end': 43.967, 'score': 0.025}, {'word': 'déjà', 'start': 43.987, 'end': 44.107, 'score': 0.919}, {'word': 'il', 'start': 44.127, 'end': 44.167, 'score': 0.214}, {'word': 'y', 'start': 44.187, 'end': 44.207, 'score': 0.005}, {'word': 'a', 'start': 44.227, 'end': 44.247, 'score': 0.025}, {'word': 'une', 'start': 44.267, 'end': 44.347, 'score': 0.185}, {'word': 'différence', 'start': 44.367, 'end': 44.988, 'score': 0.475}, {'word': "c'est", 'start': 45.028, 'end': 45.128, 'score': 0.717}, {'word': 'ça', 'start': 45.148, 'end': 45.228, 'score': 0.406}, {'word': 'que', 'start': 45.248, 'end': 45.308, 'score': 0.99}, {'word': 'je', 'start': 45.328, 'end': 45.468, 'score': 0.533}, {'word': 'constate', 'start': 45.508, 'end': 45.909, 'score': 0.921}, {'word': 'mais', 'start': 45.929, 'end': 46.049, 'score': 0.286}, {'word': 'moi', 'start': 46.069, 'end': 46.389, 'score': 0.907}, {'word': 'à', 'start': 46.449, 'end': 46.509, 'score': 0.731}, {'word': 'mes', 'start': 46.529, 'end': 46.629, 'score': 0.948}, {'word': 'yeux', 'start': 46.649, 'end': 46.77, 'score': 0.498}, {'word': 'en', 'start': 46.79, 'end': 46.83, 'score': 0.312}, {'word': 'tout', 'start': 46.85, 'end': 46.95, 'score': 0.349}, {'word': 'cas', 'start': 46.97, 'end': 47.11, 'score': 0.255}]}, {'start': 49.061, 'end': 59.929, 'text': " à mes yeux vous êtes vraiment à un autre level quand même je veux dire je sais pas moi simple exemple ma mère elle est pas trop aux réseaux sociaux et tout oui c'est vrai mais elle voit de fou quoi c'est vrai maintenant il ya beaucoup de gens qui nous connaissent ça c'est vrai pour revenir sur ta définition", 'words': [{'word': 'à', 'start': 49.061, 'end': 49.081, 'score': 0.003}, {'word': 'mes', 'start': 49.141, 'end': 49.221, 'score': 0.363}, {'word': 'yeux', 'start': 49.241, 'end': 49.341, 'score': 0.286}, {'word': 'vous', 'start': 49.382, 'end': 49.482, 'score': 0.834}, {'word': 'êtes', 'start': 49.522, 'end': 49.682, 'score': 0.418}, {'word': 'vraiment', 'start': 49.702, 'end': 50.224, 'score': 0.864}, {'word': 'à', 'start': 50.244, 'end': 50.845, 'score': 0.83}, {'word': 'un', 'start': 50.885, 'end': 50.946, 'score': 0.472}, {'word': 'autre', 'start': 51.006, 'end': 51.126, 'score': 0.654}, {'word': 'level', 'start': 51.146, 'end': 51.347, 'score': 0.505}, {'word': 'quand', 'start': 51.367, 'end': 51.487, 'score': 0.869}, {'word': 'même', 'start': 51.507, 'end': 51.748, 'score': 0.901}, {'word': 'je', 'start': 51.788, 'end': 51.848, 'score': 0.554}, {'word': 'veux', 'start': 51.868, 'end': 51.968, 'score': 0.834}, {'word': 'dire', 'start': 51.988, 'end': 52.068, 'score': 0.723}, {'word': 'je', 'start': 52.089, 'end': 52.129, 'score': 0.57}, {'word': 'sais', 'start': 52.169, 'end': 52.249, 'score': 0.608}, {'word': 'pas', 'start': 52.269, 'end': 52.349, 'score': 0.857}, {'word': 'moi', 'start': 52.369, 'end': 52.75, 'score': 0.779}, {'word': 'simple', 'start': 52.79, 'end': 52.991, 'score': 0.744}, {'word': 'exemple', 'start': 53.011, 'end': 53.252, 'score': 0.789}, {'word': 'ma', 'start': 53.292, 'end': 53.372, 'score': 0.726}, {'word': 'mère', 'start': 53.392, 'end': 53.653, 'score': 0.76}, {'word': 'elle', 'start': 53.693, 'end': 53.773, 'score': 0.193}, {'word': 'est', 'start': 53.813, 'end': 53.873, 'score': 0.588}, {'word': 'pas', 'start': 53.893, 'end': 53.953, 'score': 0.665}, {'word': 'trop', 'start': 53.973, 'end': 54.094, 'score': 0.648}, {'word': 'aux', 'start': 54.114, 'end': 54.174, 'score': 0.007}, {'word': 'réseaux', 'start': 54.194, 'end': 54.374, 'score': 0.592}, {'word': 'sociaux', 'start': 54.415, 'end': 54.775, 'score': 0.77}, {'word': 'et', 'start': 54.896, 'end': 54.936, 'score': 0.003}, {'word': 'tout', 'start': 54.956, 'end': 55.076, 'score': 0.169}, {'word': 'oui', 'start': 55.096, 'end': 55.177, 'score': 0.092}, {'word': "c'est", 'start': 55.197, 'end': 55.277, 'score': 0.692}, {'word': 'vrai', 'start': 55.297, 'end': 55.437, 'score': 0.145}, {'word': 'mais', 'start': 55.457, 'end': 55.598, 'score': 0.291}, {'word': 'elle', 'start': 55.618, 'end': 55.718, 'score': 0.378}, {'word': 'voit', 'start': 55.738, 'end': 55.878, 'score': 0.75}, {'word': 'de', 'start': 55.898, 'end': 55.979, 'score': 0.907}, {'word': 'fou', 'start': 55.999, 'end': 56.159, 'score': 0.88}, {'word': 'quoi', 'start': 56.179, 'end': 56.42, 'score': 0.279}, {'word': "c'est", 'start': 56.44, 'end': 56.54, 'score': 0.382}, {'word': 'vrai', 'start': 56.56, 'end': 56.66, 'score': 0.098}, {'word': 'maintenant', 'start': 56.68, 'end': 56.881, 'score': 0.478}, {'word': 'il', 'start': 56.901, 'end': 57.362, 'score': 0.76}, {'word': 'ya', 'start': 57.382, 'end': 57.462, 'score': 0.283}, {'word': 'beaucoup', 'start': 57.503, 'end': 57.723, 'score': 0.812}, {'word': 'de', 'start': 57.763, 'end': 57.803, 'score': 0.995}, {'word': 'gens', 'start': 57.823, 'end': 57.944, 'score': 0.821}, {'word': 'qui', 'start': 57.964, 'end': 58.064, 'score': 0.682}, {'word': 'nous', 'start': 58.084, 'end': 58.164, 'score': 0.995}, {'word': 'connaissent', 'start': 58.184, 'end': 58.485, 'score': 0.835}, {'word': 'ça', 'start': 58.505, 'end': 58.565, 'score': 0.212}, {'word': "c'est", 'start': 58.585, 'end': 58.666, 'score': 0.012}, {'word': 'vrai', 'start': 58.686, 'end': 58.866, 'score': 0.184}, {'word': 'pour', 'start': 58.886, 'end': 59.026, 'score': 0.69}, {'word': 'revenir', 'start': 59.047, 'end': 59.247, 'score': 0.789}, {'word': 'sur', 'start': 59.267, 'end': 59.367, 'score': 0.056}, {'word': 'ta', 'start': 59.468, 'end': 59.668, 'score': 0.464}, {'word': 'définition', 'start': 59.688, 'end': 59.929, 'score': 0.192}]}]
import random
import os
import re
from typing import Iterator, TextIO
import subprocess
from styles import *
from utils import *
from silent import *
from emojis import *
# http://www.looksoftware.com/help/v11/Content/Reference/Language_Reference/Constants/Color_constants.htm
# rouge, jaune, vert
colors = ["\\2c&&H000000FF&","\\2c&H0000FFFF&","\\2c&H0000FF00&"]
colors2 = ["\\1c&H0000FF&","\\1c&H00FFFF&","\\1c&H00FF00&"]
tab = []
new_tab = []
styles = gen_styles()
width = 0
heigh = 0
ass_path = "temp/"
path = "input/mbf.mp4"
width,heigh = get_dimensions(path=path)
def write_ass(file: TextIO,words):
for s in words:
for i in range(len(s['words'])):
word = s['words'][i]['word']
if len(s['words'][i])==1:
break
start = s['words'][i]['start']
end = s['words'][i]['end']
if i == len(s['words']) - 1 :
tab.append([start,end,word,True])
else :
tab.append([start,end,word,False])
ass_path = os.path.join(ass_path, f"{filename(path)}.ass")
with open(ass_path,"w", encoding="utf-8") as ass:
write_ass(file=ass,words=words)
def gen_video(in_path,out_path):
#output_dir = "output/"
#out_path = os.path.join(output_dir, f"{filename(path)}ASS.mp4")
ffmpeg_cmd = [
"ffmpeg",
"-i", in_path,
"-vf", f"ass={ass_path}",
"-c:a", "copy",
"-y",
out_path
]
subprocess.run(ffmpeg_cmd, check=False)
def treat_tab():
moyenne_time = 0
moyenne_lenght = 0
for j in tab:
start = j[0]
end = j[1]
word= j[2]
moyenne_time += (end-start)
moyenne_lenght += len(word)
moyenne_lenght = moyenne_lenght/len(tab)
moyenne_time = moyenne_time/len(tab)
retenue = 0
seuil = 0.05
for j in range(len(tab)):
if retenue > 0:
retenue -= 1
else :
retenue = juxtaposer_mots(tab, new_tab, seuil, j, moyenne_time, moyenne_lenght)
treat_tab()
def write_new_ass(file : TextIO):
file.write("[Script Info]\n")
file.write("ScriptType: v4.00\n")
file.write("Collisions: Normal\n")
file.write("PlayDepth: 0\n")
file.write("\n")
file.write("[V4+ Styles]\n")
file.write("Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColor, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding, WrapStyle\n")
for j in styles:
file.write(j)
file.write("\n")
file.write("[Events]\n")
file.write("Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text\n")
i_color = 0
for s in new_tab:
localtext = ""
globalstart = s[0][0]
globalend = s[-1][1]
color = colors[i_color]
i_color = (i_color+1)%len(colors)
boiler = "{\\k40\\fad(0,0)\\be1\\b\\bord2\\shad1\\1c&&HFFFFFF&\\3c&H000000&\\q1\\an5\\b700"+color+"} "
localtext = boiler
if len(s)==4:
boiler = "{\\fad(0,0)\\be1\\b\\bord2\\shad1\\1c&&HFFFFFF&\\3c&H000000&\\q1\\an5\\b700"+color+"} "
localtext = boiler
first_start = s[0][0]
first_end = s[1][1]
second_start = s[2][0]
second_end = s[3][1]
diff = abs(round(float(first_end-first_start)*100))
#duration = "{\\1c&HFFFFFF&\\t("+str(0)+","+str(diff)+","+colors2[i_color]+")}"
duration = "{"+colors[i_color]+"\\k"+str(diff)+"}"
localtext += duration+s[0][2].upper()+" "+s[1][2].upper()+"\\N "
i_color = (i_color+1)%len(colors)
color=colors[i_color]
diff2 = abs(round(float(second_end-second_start)*100))
diff3 = abs(round(float(second_start-first_start)*100))
diff4 = abs(round(float(second_end-first_start)*100))
duration2 = "{"+colors[i_color]+"\\k"+str(diff2)+"\\t("+str(diff3)+","+str(diff4)+",\\fscx110)"+"\\t("+str(diff3)+","+str(diff4)+",\\fscy110)}"
localtext += duration2+s[2][2].upper()+" "+s[3][2].upper()
else :
for segment in s:
word = segment[2]
start = segment[0]
end = segment[1]
delta = end - start
duration = "{\\k"+str(abs(round(delta*100)))+"}"
#boiler = " {\\be0\\b1\\move(100, 100, 200, 200,["+str(start)+","+str(int(delta))+"])\\blur2}"
#localtext += boiler+word.upper().replace(" "," "+boiler)
localtext += duration+word.upper()+" "
style = "s"+str(random.randint(0,len(styles)-1))
words = localtext.split("{\q1")
if len(words)==5: ## add a line break if there are more than 4 words
localtext = "{\q1"+words[1]+"{\q1"+words[2]+"\\N{\q1"+words[3]+"{\q1"+words[4]
file.write(f"""Dialogue: 0,{time_to_hhmmss(globalstart)},{time_to_hhmmss(globalend)},{style},,50,50,20,fx,{localtext}"""+ "\n")
with open(ass_path,"w", encoding="utf-8") as ass:
write_new_ass(file=ass)
video = "output/test.mp4"
image_list = [("1", 1.523, 5.518), ("2", 10.5, 15.5), ("3", 20.5, 25.5)]
overlay_images_on_video(in_path="input/mbf.mp4",out_path=video,image_list=image_list,width=width,height=heigh,ass=ass_path)
overlay_images_on_video(in_path="input/mbf.mp4",out_path="output/test2.mp4",image_list=None,width=width,height=heigh,ass=ass_path)
#silence(file_in=video)