Export Animated gif with Image Magick and FFMPEG TOP nodes

   300   1   1
User Avatar
Member
20 posts
Joined: 7月 2015
Offline
Hello from 2020!
in the era of ImageMagick and FFmpeg integrated in Houdini's TOP, generating our beloved gif should be pretty straight forward.

But, there is something I must be missing.
I am not able to export gif correctly neither using FFMpeg Encode Video TOP nor ImageMagick.

Could you please point me in the right direction?
Below some test and results of my research



TEST 1 - IMAGE MAGICK

1A - gif from image sequence (ROP fetch > IM gif)
2A - gif from mp4 ( rop fetch > ffmpeg to mp4 > IM to gif)


1A - gif is created but seems like the frames are overwriting each other rather than appending in sequence
tried with output file tag file/video and file/image
2A - errors: there are no input images






TEST 2 - FFMPEG ENCODE VIDEO

Getting these errors in the log:
Codec AVOption apply_trc (color transfer characteristics to apply to EXR linear input) specified for input file #0 ([i]"path to framelist"[/i]) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some decoder which was not actually used for any stream.

GIF muxer supports only a single video GIF stream.
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 -- 
Conversion failed!









Conversation about animated gif:

https://www.sidefx.com/forum/topic/46690/# [www.sidefx.com]

Mestela's Tokeru on ImageMagick and FFMPEG commands:
http://www.tokeru.com/cgwiki/index.php?title=GeneralUtilties#Gifs [www.tokeru.com]
(I have tried these in the command line of IM / FFMPEG tops, no luck)



https://forums.odforce.net/topic/33138-some-looping-rnd-animations/?do=findComment&comment=191821 [forums.odforce.net]
iFightForTheUser posted this code for FFMPEG:

convert-to-GIF(){
    for ARG in $@; do
        file=$ARG
        file_name=${file%.*}
        palette="/tmp/palette.png"
        ffmpeg -y -i $file -vf fps=10,scale=500:-1:flags=lanczos,palettegen $palette
        ffmpeg    -i $file -i $palette -filter_complex "fps=10,scale=500:-1:flags=lanczos[x];[x][1:v]paletteuse" $file_name.gif
    done
    }

not sure how to implement this correctly in the command line.




I am having trouble sending a hip file atm, will do asap if helpful.
TAGs: export animated gif from houdini using ffmpeg image magick TOP PDG nodes. gif conversion. gif output.

Attachments:
IM1.JPG (49.4 KB)
FFMPEG1_mp4_works.JPG (35.9 KB)
FFMPEG1_gif_NOTwork.JPG (43.4 KB)

User Avatar
スタッフ
361 posts
Joined: 8月 2017
Offline
I've attached a .hip file that demonstrates how to configure the FFmpeg node to create a gif from a series of images. You will need a more recent version of Houdini 18.0 as it uses the updated FFmpeg nodes. I will file an RFE to add a preset to the FFmpeg node for creating a gif.

Let me know if you have any other questions.

Attachments:
gif_example.hip (42.7 KB)

  • Quick Links