Skip to content

Commit d39d2b3

Browse files
committed
Update Examples and Readme Set up
1 parent 91e0229 commit d39d2b3

8 files changed

+63
-36
lines changed

composite_clips.ipynb

+7-6
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,23 @@
66
"metadata": {},
77
"outputs": [],
88
"source": [
9-
"import moviepy.editor as mpy\n",
109
"import gizeh as gz\n",
10+
"import moviepy.editor as mpy\n",
1111
"\n",
1212
"# Logo de StackBuilders como instancia de Moviepy\n",
1313
"sb_logo = mpy.ImageClip('SB_logo.jpg')\n",
14-
" \n",
14+
"\n",
1515
"# Texto creado con Gizeh y convertido en instancia de Moviepy\n",
1616
"surface = gz.Surface(width=500, height=70, bg_color=(1, 1, 1))\n",
17-
"text_clip = gz.text(\"Let's Build Together!\", \n",
18-
" fontfamily=\"Arial\", fontsize=35, \n",
17+
"text_clip = gz.text(\"Let's Build Together!\",\n",
18+
" fontfamily=\"Arial\", fontsize=35,\n",
1919
" xy=(250, 35), fill=(59/255, 89/255, 152/255))\n",
2020
"text_clip.draw(surface)\n",
2121
"text_instance = mpy.ImageClip(surface.get_npimage())\n",
2222
"\n",
2323
"# Stack Builders logo + text\n",
24-
"logo_text = mpy.CompositeVideoClip([sb_logo, text_instance]).set_duration(3).set_fps(10)\n",
24+
"logo_text = mpy.CompositeVideoClip(\n",
25+
" [sb_logo, text_instance]).set_duration(3).set_fps(10)\n",
2526
"logo_text.ipython_display()"
2627
]
2728
},
@@ -49,7 +50,7 @@
4950
"name": "python",
5051
"nbconvert_exporter": "python",
5152
"pygments_lexer": "ipython3",
52-
"version": "3.6.5"
53+
"version": "3.7.0"
5354
}
5455
},
5556
"nbformat": 4,

fade_in_animation.ipynb

+8-6
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
"(logo_size_x, logo_size_y) = sb_logo.size\n",
1616
"\n",
1717
"sb_logo = sb_logo.set_position((320 - logo_size_x/2, 0))\n",
18-
" \n",
18+
"\n",
1919
"# Texto creado con Gizeh y convertido en instancia de Moviepy\n",
2020
"surface = gz.Surface(width=500, height=70, bg_color=(1, 1, 1))\n",
21-
"text_clip = gz.text(\"Let's Build Together!\", \n",
22-
" fontfamily=\"Arial\", fontsize=35, \n",
21+
"text_clip = gz.text(\"Let's Build Together!\",\n",
22+
" fontfamily=\"Arial\", fontsize=35,\n",
2323
" xy=(250, 35), fill=(59/255, 89/255, 152/255))\n",
2424
"text_clip.draw(surface)\n",
2525
"text_instance = mpy.ImageClip(surface.get_npimage())\n",
@@ -32,11 +32,13 @@
3232
"\n",
3333
"# Fade in text\n",
3434
"\n",
35-
"text_instance = vfx.fadein(text_instance.set_start(1.5), 1, initial_color=(255, 255, 255))\n",
35+
"text_instance = vfx.fadein(text_instance.set_start(\n",
36+
" 1.5), 1, initial_color=(255, 255, 255))\n",
3637
"\n",
3738
"\n",
3839
"# Stack Builders logo + text\n",
39-
"logo_text = mpy.CompositeVideoClip([sb_logo, text_instance], size=(640, 640)).set_duration(3).set_fps(20).on_color(color=(255, 255, 255))\n",
40+
"logo_text = mpy.CompositeVideoClip([sb_logo, text_instance], size=(\n",
41+
" 640, 640)).set_duration(3).set_fps(20).on_color(color=(255, 255, 255))\n",
4042
"logo_text.ipython_display()"
4143
]
4244
},
@@ -64,7 +66,7 @@
6466
"name": "python",
6567
"nbconvert_exporter": "python",
6668
"pygments_lexer": "ipython3",
67-
"version": "3.6.5"
69+
"version": "3.7.0"
6870
}
6971
},
7072
"nbformat": 4,

final_composed_clip.ipynb

+18-10
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
"\n",
2020
"sb_logo = sb_logo.set_position((320 - logo_size_x/2, 0))\n",
2121
"\n",
22-
" \n",
22+
"\n",
2323
"# Texto creado con Gizeh y convertido en instancia de Moviepy\n",
2424
"surface = gz.Surface(width=500, height=70, bg_color=(1, 1, 1))\n",
25-
"text_clip = gz.text(\"Let's Build Together!\", \n",
26-
" fontfamily=\"Arial\", fontsize=35, \n",
25+
"text_clip = gz.text(\"Let's Build Together!\",\n",
26+
" fontfamily=\"Arial\", fontsize=35,\n",
2727
" xy=(250, 35), fill=(59/255, 89/255, 152/255))\n",
2828
"text_clip.draw(surface)\n",
2929
"text_instance = mpy.ImageClip(surface.get_npimage())\n",
@@ -36,24 +36,32 @@
3636
"\n",
3737
"\n",
3838
"# Fade in text\n",
39-
"text_instance = vfx.fadein(text_instance.set_start(1.5), 1, initial_color=(255, 255, 255))\n",
39+
"text_instance = vfx.fadein(text_instance.set_start(\n",
40+
" 1.5), 1, initial_color=(255, 255, 255))\n",
4041
"\n",
4142
"\n",
4243
"# Linea dibujada con Gizeh\n",
4344
"linea_pos_y = logo_size_y + text_size_y\n",
4445
"\n",
4546
"surface_linea = gz.Surface(width=640, height=25, bg_color=(1, 1, 1))\n",
46-
"linea_azul = gz.polyline(points=[(-320, 50), (320, 50)], stroke_width=80, \n",
47-
" stroke=(59/255, 89/255, 152/255),\n",
48-
" xy=(320, 0))\n",
47+
"linea_azul = gz.polyline(\n",
48+
" points=[(-320, 50), (320, 50)], stroke_width=80,\n",
49+
" stroke=(59/255, 89/255, 152/255),\n",
50+
" xy=(320, 0))\n",
4951
"linea_azul.draw(surface_linea)\n",
50-
"linea_instancia = mpy.ImageClip(surface_linea.get_npimage()).set_position((0, logo_size_y + text_size_y))\n",
52+
"linea_instancia = mpy.ImageClip(surface_linea.get_npimage()).set_position(\n",
53+
" (0, logo_size_y + text_size_y))\n",
5154
"\n",
5255
"linea_instancia = vfx.fadein(linea_instancia, 1, initial_color=(255, 255, 255))\n",
5356
"\n",
5457
"\n",
5558
"# Stack Builders logo + text + linea azul\n",
56-
"logo_text = mpy.CompositeVideoClip([sb_logo, text_instance, linea_instancia], size=(640, 640)).set_duration(3).set_fps(20).on_color(color=(255, 255, 255))\n",
59+
"logo_text = mpy.CompositeVideoClip(\n",
60+
" [sb_logo, text_instance, linea_instancia],\n",
61+
" size=(640, 640)).\\\n",
62+
" set_duration(3).\\\n",
63+
" set_fps(20).\\\n",
64+
" on_color(color=(255, 255, 255))\n",
5765
"logo_text.ipython_display()"
5866
]
5967
},
@@ -81,7 +89,7 @@
8189
"name": "python",
8290
"nbconvert_exporter": "python",
8391
"pygments_lexer": "ipython3",
84-
"version": "3.6.5"
92+
"version": "3.7.0"
8593
}
8694
},
8795
"nbformat": 4,

image_clip.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"name": "python",
3838
"nbconvert_exporter": "python",
3939
"pygments_lexer": "ipython3",
40-
"version": "3.6.5"
40+
"version": "3.7.0"
4141
}
4242
},
4343
"nbformat": 4,

linea_gizeh.ipynb

+7-5
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
"\n",
1313
"# Linea dibujada con Gizeh\n",
1414
"surface_linea = gz.Surface(width=640, height=25, bg_color=(1, 1, 1))\n",
15-
"linea_azul = gz.polyline(points=[(-320, 50), (320, 50)], stroke_width=80, \n",
16-
" stroke=(59/255, 89/255, 152/255),\n",
17-
" xy=(320, 0))\n",
15+
"linea_azul = gz.polyline(\n",
16+
" points=[(-320, 50), (320, 50)],\n",
17+
" stroke_width=80,\n",
18+
" stroke=(59/255, 89/255, 152/255),\n",
19+
" xy=(320, 0))\n",
1820
"linea_azul.draw(surface_linea)\n",
1921
"linea_instancia = mpy.ImageClip(surface_linea.get_npimage())\n",
20-
"linea_instancia.ipython_display()"
22+
"linea_instancia.ipython_display()\n"
2123
]
2224
},
2325
{
@@ -44,7 +46,7 @@
4446
"name": "python",
4547
"nbconvert_exporter": "python",
4648
"pygments_lexer": "ipython3",
47-
"version": "3.6.5"
49+
"version": "3.7.0"
4850
}
4951
},
5052
"nbformat": 4,

readme.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@ Video Generation with Python
33

44
Setting up environment:
55

6-
**[Pipenv](https://docs.pipenv.org/en/latest/) is required**
6+
- **[Pipenv](https://docs.pipenv.org/en/latest/) is required**
7+
- **[Pyenv](https://github.com/pyenv/pyenv) is optional but recomended to
8+
prevent conflicts with Python versions intalled in your local environment**
9+
10+
To set up Python version with Pyenv use:
11+
12+
``` bash
13+
$ pyenv install
14+
```
715

816
Once pipenv is installed, from the root of this project run:
917

segment_position.ipynb

+12-6
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,25 @@
1414
"(logo_size_x, logo_size_y) = sb_logo.size\n",
1515
"\n",
1616
"sb_logo = sb_logo.set_position((320 - logo_size_x/2, 0))\n",
17-
" \n",
17+
"\n",
1818
"# Texto creado con Gizeh y convertido en instancia de Moviepy\n",
1919
"surface = gz.Surface(width=500, height=70, bg_color=(1, 1, 1))\n",
20-
"text_clip = gz.text(\"Let's Build Together!\", \n",
21-
" fontfamily=\"Arial\", fontsize=35, \n",
22-
" xy=(250, 35), fill=(59/255, 89/255, 152/255))\n",
20+
"text_clip = gz.text(\n",
21+
" \"Let's Build Together!\",\n",
22+
" fontfamily=\"Arial\", fontsize=35,\n",
23+
" xy=(250, 35), fill=(59/255, 89/255, 152/255))\n",
2324
"text_clip.draw(surface)\n",
2425
"text_instance = mpy.ImageClip(surface.get_npimage())\n",
2526
"(text_size_x, text_size_y) = text_instance.size\n",
2627
"text_instance = text_instance.set_position((320 - text_size_x/2, logo_size_y))\n",
2728
"\n",
2829
"# Stack Builders logo + text\n",
29-
"logo_text = mpy.CompositeVideoClip([sb_logo, text_instance], size=(640, 640)).set_duration(3).set_fps(10).on_color(color=(255, 255, 255))\n",
30+
"logo_text = mpy.CompositeVideoClip(\n",
31+
" [sb_logo, text_instance],\n",
32+
" size=(640, 640)).\\\n",
33+
" set_duration(3).\\\n",
34+
" set_fps(10).\\\n",
35+
" on_color(color=(255, 255, 255))\n",
3036
"logo_text.ipython_display()"
3137
]
3238
},
@@ -56,7 +62,7 @@
5662
"name": "python",
5763
"nbconvert_exporter": "python",
5864
"pygments_lexer": "ipython3",
59-
"version": "3.6.5"
65+
"version": "3.7.0"
6066
}
6167
},
6268
"nbformat": 4,

text_clip.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"name": "python",
4343
"nbconvert_exporter": "python",
4444
"pygments_lexer": "ipython3",
45-
"version": "3.6.5"
45+
"version": "3.7.0"
4646
}
4747
},
4848
"nbformat": 4,

0 commit comments

Comments
 (0)