Previously, we’ve converted an asciinema cast file into a GIF. We can generate a video out of a GIF with ffmpeg.
First, install it.
sudo apt update
sudo apt install ffmpeg -y
Use a similar command below with ffmpeg:
ffmpeg -i demo.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" demo.mp4
ffmpeg version 8.0.1
Input #0, gif, from 'demo.gif':
Duration: 00:00:23.92, start: 0.000000, bitrate: 392 kb/s
Stream #0:0: Video: gif, bgra, 2601x694, 4.17 fps, 100 tbr, 100 tbn
Stream mapping:
Stream #0:0 -> #0:0 (gif (native) -> h264 (libx264))
Output #0, mp4, to 'demo.mp4':
Stream #0:0: Video: h264, yuv420p, 2600x694, 100 fps
[mp4] Starting second pass: moving the moov atom to the beginning of the file
[out#0/mp4] video:894KiB audio:0KiB muxing overhead: 0.308657%
frame=99 Lsize=897KiB time=00:00:20.53 bitrate=358.0kbits/s speed=35.6x