tFix ffmpeg arguments - sphere - GPU-based 3D discrete element method algorithm… | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 500151199d40152b6de6a8c894a3c268b2f1a047 | |
parent 6478ba3c7f4f23cb7f122e51d963be379d758c27 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Mon, 2 Sep 2019 06:51:18 +0200 | |
Fix ffmpeg arguments | |
Diffstat: | |
M python/sphere.py | 20 ++++++++++++-------- | |
1 file changed, 12 insertions(+), 8 deletions(-) | |
--- | |
diff --git a/python/sphere.py b/python/sphere.py | |
t@@ -4676,8 +4676,8 @@ class sim: | |
:type verbose: bool | |
''' | |
- video(self.sid, out_folder, video_format, graphics_folder, \ | |
- graphics_format, fps, qscale, bitrate, verbose) | |
+ video(self.sid, out_folder, video_format, graphics_folder, | |
+ graphics_format, fps, verbose) | |
def shearDisplacement(self): | |
''' | |
t@@ -7444,15 +7444,17 @@ class sim: | |
plt.show() | |
-def convert(graphics_format='png', folder='../img_out'): | |
+def convert(graphics_format='png', folder='../img_out', remove_ppm=False): | |
''' | |
- Converts all PPM images in img_out to graphics_format using Imagemagick. A… | |
- PPM images are subsequently removed. | |
+ Converts all PPM images in img_out to graphics_format using ImageMagick. A… | |
+ PPM images are subsequently removed if `remove_ppm` is `True`. | |
:param graphics_format: Convert the images to this format | |
:type graphics_format: str | |
:param folder: The folder containing the PPM images to convert | |
:type folder: str | |
+ :param remove_ppm: Remove ALL ppm files in `folder` after conversion | |
+ :type remove_ppm: bool | |
''' | |
#quiet=' > /dev/null' | |
t@@ -7464,7 +7466,8 @@ def convert(graphics_format='png', folder='../img_out'): | |
+ quiet + ' ; done', shell=True) | |
# Remove PPM files | |
- subprocess.call('rm ' + folder + '/*.ppm', shell=True) | |
+ if remove_ppm: | |
+ subprocess.call('rm ' + folder + '/*.ppm', shell=True) | |
def render(binary, method='pres', max_val=1e3, lower_cutoff=0.0, | |
graphics_format='png', verbose=True): | |
t@@ -7510,7 +7513,7 @@ def render(binary, method='pres', max_val=1e3, lower_cut… | |
def video(project, out_folder='./', video_format='mp4', | |
graphics_folder='../img_out/', graphics_format='png', fps=25, | |
- qscale=1, bitrate=1800, verbose=True): | |
+ verbose=True): | |
''' | |
Uses ffmpeg to combine images to animation. All images should be | |
rendered beforehand using :func:`render()`. | |
t@@ -7544,7 +7547,8 @@ def video(project, out_folder='./', video_format='mp4', | |
subprocess.call('ffmpeg -loglevel ' + loglevel + ' ' | |
+ '-i ' + graphics_folder + project + '.output%05d.' | |
+ graphics_format | |
- + ' -qscale {} -r {} -b {} -y '.format(qscale, fps, bitrate) | |
+ + ' -c:v libx264 -profile:v high -pix_fmt yuv420p -g 30' | |
+ + ' -r {} -y '.format(fps) | |
+ outfile, shell=True) | |
if verbose: | |
print('saved to ' + outfile) |