Noita
評價次數不足
Convert GIF to MP4 with script (linux)
由 Ragnaman 發表
How to turn ALL your .gif's in a folder into .mp4's.
Using ffmpeg and shellscript.
(does not remove .gif files)
   
獎勵
加入最愛
已加入最愛
移除最愛
Install ffmpeg
open terminal and use these commands

sudo apt-get update
sudo apt-get install ffmpeg
Create shell script
Create a new shell script file (just a text file that ends with .sh) in the folder where noita is saving the gifs, i named mine "gif-to-mp4.sh"

Here is the script, paste it into the shell script file, save it and run it with .gif files present in the same directory the script is in:


#!/bin/bash
for i in *.gif;
do name=`echo "$i" | cut -d'.' -f1`
echo "$name"
ffmpeg -i "$i" -crf 16 -pix_fmt yuv420p "${name}.mp4"
done




If you also want the terminal to not close after running the script and some pretty things like script outputting where it is being ran from then you can use my variant:



#!/bin/bash
echo "Script executed from: ${PWD}"
echo " "

BASEDIR=$(dirname $0)
echo "Script location: ${BASEDIR}"
echo " "

for i in *.gif;
do name=`echo "$i" | cut -d'.' -f1`
echo "$name"
ffmpeg -i "$i" -crf 16 -pix_fmt yuv420p "${name}.mp4"
done

echo " "
echo "Press ENTER to close terminal"
echo " "
read



(this of course works for any .gif, not just noita gifs)
(you can change -crf value to lower value for higher quality (max 4), or remove -crf parameter entirely and have .mp4 noita vids that each weigh at 500KB, but quality suffers)
2 則留言
Ragnaman  [作者] 2023 年 9 月 12 日 下午 2:47 
:lunar2019piginablanket:
Uratrecom 2023 年 8 月 29 日 上午 12:18 
:successchip: