Cool Facepalm Back-and-Forth Infinite-Loop High-Quality Animated GIF

Posted at

I've watched the episode Deja Q of Star Trek The Next Generation (Season 3 Episode 13),

it was the source of this very wild-spread meme, called "facepalm", featuring captain Jean-Luc Picard,
in whatever-whatnot situation (quite funny..)

anyway I've decided to use it as a custom 404 page for a small project I'm doing,
this aside, I've desired a fancy animated-GIF, with caption, to capture the entire thing...


  1. get getting the video source (YouTube is a good source, or any HD deluxe package of Star Trek The Next Generation for a better, higher quality result).

  2. For Video-Processing ::  get VirtualDub (x64) and install it
    here are some configuration (grey ones, are optional).

    1. Options->Preformance

      • set all scales to far right (increase buffer).

    2. Options->Preferences

      • ->Images

        • set value of default frame rate to 0.5000, it means "capture an image every ½ of a second".

      • ->Threading

        • Video compression threads: change from 0 to 1.

        • increase max-threads in combo-box below.

      • ->3D accel

        • check ON the Enable 3D video filter acceleration (VDXA)

  3. For Adding Caption- The Easy Way (As a Subtitle) ::

    1. get K-Lite x86 and x64 mega codec pack, install all ffdshow64 filters.

    2. copy content of C:\\Program Files (x86)\\K-Lite Codec Pack\\Filters\\ffdshow64 into

    3. restart VideoLan


now a little watching through the video shows that Jean-Luc Picard starts the meme stuff at
frame number 9287 (in time this is about 0:06:11.480 into from the very start),
and ends on 9333 (0:06:13.320)

  1. go to the start location, you can jump frames with [RIGHT Arrow] [LEFT Arrow] keys, press the 'Mark In' button.

  2. do the same with the end location (press the 'Mark Out' button.

  3. in the menu:

    1. File->Export->Image Sequence

      1. select a folder (probably best if it will be an empty one)

      2. select 'PNG' and remove the checkbox 'Quick compress'

      3. press 'OK' and wait 'till done,

      4. open command-line (CMD) and change-dir to this folder.

      5. *make sure you have 'imagemagick' (a.k.a Image-Magic) in the PATH so you could write 'convert.exe' anywhere and get the executable running..

      6. run:
        convert -background white -alpha remove -layers OptimizePlus -delay 6 *.png -loop 0 myAnimatedGif.gif

      7. * we are delaying 6/100 since we have a-lot of frames, and it will be reasonably smooth animation (also very high-quality)

      8. this will be now need to be processed again so the animation will be repeated back and forth

      9. run:
        convert myAnimatedGif.gif -coalesce -duplicate 1,-2-1 -layers OptimizePlus -loop 0 backnforthAni.gif

      10. *the command is removing optimizations and applying back after processing, duplication (meaning adding..) frames.

you can apply filters in VideoDub to shrink result before exporting the static-images
the subtitle (there are few) are very useful since you can modify the subtitle file and reload it, and export the result,
which is faster then using another program to image-process text into an image, and put it as an overlay to the video frame,

using subtitle will, naturally, be rendered into the video, but it will be on the higher quality since it will be done once..


very high-quality but huge file, so unless you're serving it from localhost, with the rest of your project files,
make it
- smaller.
- use fewer frames and higher delay.
- use different quality imagemagick-command-line-switch

I'm using 46 frames and 6/100 delay

nice, isn't.. :)