On 10/24/24 12:42, American Citizen wrote: > A follow up here. > > The "-crf 0" setting for ffmpeg has to be used to insure the highest > image quality when converting from one format (animated gif) to another > Mastroka .mkv. > > The video size dropped to about 1/2 the original animated gif size. > > The ffmpeg defaults don't seem to handle the 800x800 animated gif files > very well, much image degradation is visible, when doing the conversion > to mp4 format. > > ffmpeg does a better job on the 1000x1000 pixel animated gif files for > some reason. > > But forcing the video quality with the crf option = 0, is the correct > way to preserve image quality.
With mp4 are you using H.264 codec (libx264)? The defaults for mkv and mp4 may not be optimal. You may also need to adjust the bitrate or do so via crf: -b:v 0 -crf 0 Specify a better pixel format -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" (second option IIRC sets x,y dimension divisible by 2 for H.264 and yuv420p) mkv is also a container, not a codec, so you'll need to specify H.264 or whatever and play with the various codec options, since the defaults chosen for you may not be appropriate for animated gif. https://en.wikipedia.org/wiki/Comparison_of_video_container_formats maybe something like: ffmpeg -i 20242952110-20242960240-ABI-EP122024-GEOCOLOR-1000x1000.gif -c:v libx264 -b:v 0 -crf 0 -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" output.mkv -Ed
