Please not an animated gif. These easily end up weighing more than 10MB, while a similar mp4 can be 500KB. You just need to use an encoding all browsers support.
I doubt in this case they'd weigh 10 MB, or have you experienced "terminal movies" growing that large?
In fact, I wonder if in this case the gifs would be smaller, while lossless.
I suppose it depends on how full color the terminal output is, and how well the GIF is encoded.
I think you're probably correct for this case you can get something smaller.
Nevertheless, the movie has sound, which a GIF (AFAIK) can only do if part of a e.g. an html page...and now you have non-standard browsers to deal with vs just using an mp4.