fah*_*ahd 3 simulation video mp4 animation gnuplot
我想我们已经使用gnuplot了几十年.但是仍然没有好的方法来获得良好的视频输出gnuplot,对吗?我所做的是制作了大约30,000张图片(我必须使它具有良好的质量,以获得视频清晰度),然后用于ffmpeg制作视频:
ffmpeg -f image2 -r 10.0 -i capture.%d.png -qscale 1 filename.mp4
Run Code Online (Sandbox Code Playgroud)
但有一段时间我陷入其中或者需要很长时间.我们可能总是需要一个高质量和低文件大小的视频输出,为什么没有人试图做任何事情,或者有没有其他方法来制作视频输出gnuplot?我真的很难用高质量的视频制作gnuplot.
您可以gnuplot直接管道输出,而ffmpeg无需将图像存储在硬盘驱动器上.为此你需要告诉ffmpeg管道有什么样的格式和分辨率,因为现在无法从扩展等单独猜测它.这是一个例子:
gnuplot animation.plt | ffmpeg -f png_pipe -s:v 800x600 -i pipe: out.mp4
Run Code Online (Sandbox Code Playgroud)
我使用了这里的代码进行了一些小修改.
animation.plt
#!/usr/bin/gnuplot
#
# Creating an animation gif of the Bessel function
# NOTE: this files creates multiple png images, the gif file is then created
# using GIMP
#
# AUTHOR: Hagen Wierstorf
reset
set terminal pngcairo size 800,600 enhanced font 'Verdana,10'
# color definitions
set palette rgb 3,9,9
unset key; unset colorbox; unset border; unset tics
set lmargin at screen 0.03
set bmargin at screen 0
set rmargin at screen 0.97
set tmargin at screen 1
set parametric
# Bessel function, which is moving in time
bessel(x,t) = besj0(x) * cos(2*pi*t)
# calculate the zeros for the bessel function (see Watson, "A Treatise on the
# Theory of Bessel Functions", 1966, page 505)
n = 6 # number of zeros
k = (n*pi-1.0/4*pi)
u_0 = k + 1/(8*k) - 31/(384*k)**3 + 3779/(15360*k)**5
set urange [0:u_0]
set vrange[0:1.5*pi]
set cbrange [-1:1]
set zrange[-1:1]
set isosamples 200,100
set pm3d depthorder
set view 40,200
# initializing values for the loop and start the loop
t = 0
end_time = 1
#system('mkdir -p animation')
load 'bessel.plt'
Run Code Online (Sandbox Code Playgroud)
bessel.plt
# bessel loop
t = t + 0.02
#outfile = sprintf('animation/bessel%03.0f.png',50*t)
#set output outfile
splot u*sin(v),u*cos(v),bessel(u,t) w pm3d ls 1
if(t<end_time) reread;
Run Code Online (Sandbox Code Playgroud)
给你一个看起来像这样的视频.(这是缩小尺寸和转码的gif,仅用于演示目的)

您还可以使用ffmpeg编码器参数.这里只使用默认视频编码器配置.
| 归档时间: |
|
| 查看次数: |
265 次 |
| 最近记录: |