Skip to content

Commit

Permalink
added mp4 conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell committed Dec 12, 2024
1 parent 6430e22 commit 33f08cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion examples/spherical_tokamak_from_plasma_animation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import paramak
import cadquery_png_plugin.plugin
import numpy as np
Expand Down Expand Up @@ -166,4 +167,7 @@ def export_reactor_to_png(reactor, file_path):
for modified_triangularity in [0.55, 0.3667, 0.1833, 0.0, -0.1833, -0.3667, -0.55, -0.3667, -0.1833, 0.0, 0.1833, 0.3667, 0.55]:
reactor = create_reactor(triangularity=modified_triangularity)
export_reactor_to_png(reactor, f'spherical_tokamak_frame_{frame:03d}.png')
frame += 1
frame += 1


os.system('ffmpeg -r 10 -i spherical_tokamak_frame_%3d.png -c:v libx264 -r 30 -pix_fmt yuv420p spherical_tokamak_animation.mp4')
4 changes: 3 additions & 1 deletion examples/tokamak_from_plasma_animation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import paramak
import imageio
import io
import cadquery_png_plugin.plugin
import numpy as np
import cadquery as cq
Expand Down Expand Up @@ -174,3 +174,5 @@ def export_reactor_to_png(reactor, file_path):
reactor = create_reactor(triangularity=modified_triangularity)
export_reactor_to_png(reactor, f'tokamak_frame_{frame:03d}.png')
frame += 1

os.system('ffmpeg -r 10 -i tokamak_frame_%3d.png -c:v libx264 -r 30 -pix_fmt yuv420p tokamak_animation.mp4')

0 comments on commit 33f08cc

Please sign in to comment.