Script para compilação: mudanças entre as edições

De Física Computacional
Ir para navegação Ir para pesquisar
Sem resumo de edição
Sem resumo de edição
 
(2 revisões intermediárias por 2 usuários não estão sendo mostradas)
Linha 1: Linha 1:
Script para automatizar a criação dos vídeos.
Script para automatizar a criação dos vídeos. É necessário que os arquivos de código e script estejam nos diretórios indicados no primeiro link dessa página sobre a FPUT para descolamento vertical.


<source lang='bash'>
<source lang='bash'>
Linha 7: Linha 7:
# Compile the C code -> Run the executable -> Run the gnuplot script -> Create the video file from the images on the img folder
# Compile the C code -> Run the executable -> Run the gnuplot script -> Create the video file from the images on the img folder


# Variable to save the current time
name=$(date +%s)
name=$(date +%s)


# Compile the C code
gcc fput.c -lm
gcc fput.c -lm
# Run the executable
./a.out
./a.out
# Create the folder to save the images
mkdir -p ../img/$name
mkdir -p ../img/$name
# Run gnuplot script and save the results in img/$name
gnuplot -e "dir='$name'" graph.plt
gnuplot -e "dir='$name'" graph.plt
mkdir -p video
# Create the video folder if it doesn't exist
ffmpeg -r 120 -i ../img/$name/fput%d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p ../video/output-$name.mp4
mkdir -p ../video
# Create the MP4 video
ffmpeg -r 30 -i ../img/$name/fput%d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p ../video/output-$name.mp4
 
# In onder to create the gif: adapt as needed
ffmpeg -y -i ../video/output-$name.mp4 -vf palettegen ../video/palette.png
ffmpeg -y -ss 0 -t 20 -i ../img/$name/fput%d.png -i ../video/palette.png -filter_complex paletteuse -r 30 ../video/output-$name-part1.gif
ffmpeg -y -ss 20 -t 20 -i ../img/$name/fput%d.png -i ../video/palette.png -filter_complex paletteuse -r 30 ../video/output-$name-part2.gif
</source>
</source>

Edição atual tal como às 19h13min de 3 de maio de 2022

Script para automatizar a criação dos vídeos. É necessário que os arquivos de código e script estejam nos diretórios indicados no primeiro link dessa página sobre a FPUT para descolamento vertical.

#!/bin/bash

# Run all the scripts
# Compile the C code -> Run the executable -> Run the gnuplot script -> Create the video file from the images on the img folder

# Variable to save the current time
name=$(date +%s)

# Compile the C code
gcc fput.c -lm
# Run the executable 
./a.out
# Create the folder to save the images
mkdir -p ../img/$name
# Run gnuplot script and save the results in img/$name
gnuplot -e "dir='$name'" graph.plt
# Create the video folder if it doesn't exist
mkdir -p ../video
# Create the MP4 video
ffmpeg -r 30 -i ../img/$name/fput%d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p ../video/output-$name.mp4

# In onder to create the gif: adapt as needed
ffmpeg -y -i ../video/output-$name.mp4 -vf palettegen ../video/palette.png
ffmpeg -y -ss 0 -t 20 -i ../img/$name/fput%d.png -i ../video/palette.png -filter_complex paletteuse -r 30 ../video/output-$name-part1.gif
ffmpeg -y -ss 20 -t 20 -i ../img/$name/fput%d.png -i ../video/palette.png -filter_complex paletteuse -r 30 ../video/output-$name-part2.gif