ffmpeg -- how to improve gif export quality

   606   3   2
User Avatar
Member
20 posts
Joined: Nov. 2013
Offline
Hi! trying to improve the gif quality on my ffmpeg encode video TOPS node. I saw some tips in the ffmpeg encode video fourms, but I'm not sure how to apply this to the ffmpegencode video TOPS node. Would anyone be able to help me out? Here are some of the settings people recommended in their fourms:

https://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality [superuser.com]

If those exact settings aren't gonna work, I think that basically it's trying to apply this palette concept so that it filters the colors the gif is looking for so that the final result looks cleaner. Maybe there's another way to do this in the houdini instead? Here's the original concept link:

http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html [blog.pkh.me]

Or any other tips to improve the quality of the gifs would be much appreciated, attaching my current settings, which I believe are just the defaults. If I can't use those exact settings, then maybe if anyone knows a way to change the dithering settings overall. Thank you!
Edited by mhspadez - May 3, 2022 09:21:12

Attachments:
Capture.PNG (58.6 KB)

User Avatar
Member
111 posts
Joined: Jan. 2013
Offline
You can directly control the options of the ffmeg utility via the FFmpeg Command option at the bottom of the node interface, since PDG simply runs the command line with the utility's arguments.
User Avatar
Member
20 posts
Joined: Nov. 2013
Offline
Right, but how do I use this so it doesn't interfere with any of the filenames or attributes from a wedge node and stuff like that?
tpetrick
Staff
523 posts
Joined: May 2014
Offline
Editing the command line won't have any impact on the attributes on the node -- it'll just change the command line that gets executed for the workitem.

Normally the command updates automatically based on changes to the parm interface, but once you enable explicit editing of the FFMPEG command line that'll no longer be the case. There are two portions of the command that you'll need to keep intact to ensure that it works as expected -- the input file list and the output file path.

Input image files are specified using a frame list file, rather than directly listing the image files in the command. This is technically only required if the list of input images is longer than your platform's shell command length limit, however for consistency the frame list file is used in all cases. That file is specified as the input in the command line string using the following:
-i "$PDG_TEMP/$HIPNAME.$OS.`@pdg_index`_framelist.txt"

PDG writes the frame list file for you, so as long as you include that as your input to the ffmpeg executable it should find the images.

If you're using the "Convert" preset instead, e.g. to convert an existing file from .mp4 to .gif, then the input file is specified directly using an expression instead of a framelist file:
-i "`pdginput(0, file/video, 0)`"

The output movie file is the last argument in the command line:
"$HIP/video/$HIPNAME.$OS.`@pdg_index`.mp4"

Once you enable manual editing of the command, changes to other parms on the node will no longer affect the command line string. You'll need to manually add/remove flags as needed.
Edited by tpetrick - May 4, 2022 14:03:06
  • Quick Links