[PLUG] question on converting gif files to mp4 video
American Citizen
website.reader3 at gmail.com
Thu Oct 31 21:06:35 UTC 2024
Ed and Nat:
I did some more work here.. the h264 encoder does odd things when
working from the animated gif
The crf -0 option seems to work best.
I hit a new wall, after my linux Mozilla Firefox browser updated.. I can
no longer seem to build the animated gif files for large sizes, say the
CONUS or full disk of GOES-16 or GOES-18. I am not sure how to get
around this hurdle, other than to go to the Firefox discussion group and
bring this issue up.
Thanks for your input
Randall
On 10/31/24 08:52, Nat Taylor wrote:
> This guy did it with imagmagick and avconv:
> https://askubuntu.com/questions/293444/how-can-i-quickly-convert-a-gif-file-to-a-video
> but looks like you'd use gifcicle to make an animated gif first:
> https://www.maketecheasier.com/create-gifs-command-tool-ubuntu/
>
> On Wed, Oct 30, 2024 at 8:49 PM King Beowulf <kingbeowulf at linuxgalaxy.org>
> wrote:
>
>> 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
>>
>>
>>
More information about the PLUG
mailing list