為山九仞,功虧一簣

How to Celebrate Your Code's Birthday

Categories: Creation

Recently XRender turned 3 years old. I had played with gource and ffmpeg before, thinking I could use these two libraries to play the journey of her open source as a story.

Best watched fullscreen with headphones. There’s a real sense of watching the clouds part to reveal the moon — for engineers, it feels like watching the story of a project unfold like a movie.

Very simple, you can also try

  1. Preparation work, install gource and ffmpeg. The former is used for visualizing commit logs, and the latter is used for video processing. To make gource support Chinese fonts, Homebrew installation may be very slow. Try this acceleration address for domestic mirroring.
// Install
brew install gource
brew install ffmpeg

// Let gource support Chinese fonts
rm /usr/local/var/homebrew/linked/gource/share/gource/fonts/FreeSans.ttf
ln -s /System/Library/Fonts/Hiragino\ Sans\ GB.ttc /usr/local/var/homebrew/linked/gource/share/gource/fonts/FreeSans.ttf
  1. Find a git-managed project you like the most, enter the root directory of the local folder via command line, copy the following command and press Enter, and you can see the effect and generate the video.
gource \
--title "Title" \
--seconds-per-day 0.1 \
-1200x675 \
--high-dpi \
--multi-sampling \
--background-colour 000000 \
--dir-colour 62C454 \
--file-font-size 12 \
--font-size 24 \
--dir-font-size 14 \
--user-font-size 18 \
--auto-skip-seconds 0.2 \
--stop-at-end \
--highlight-users \
--highlight-dirs \
--file-extension-fallback \
--file-idle-time 0 \
--max-user-speed 200 \
--filename-time 2 \
--highlight-colour F5BE4F \
--date-format "%Y-%m-%d" \
--output-framerate 30 \
--output-ppm-stream - \
| ffmpeg -y -r 30 -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset ultrafast -crf 1 -threads 0 -bf 0 movie.mp4

  1. An engaging video needs a punchy soundtrack, like sound.mp3. Download it to the root directory of your project, and you can use avconv (or ffmpeg) to merge the audio track with the video:
ffmpeg -i movie.mp4 -i sound.mp3 -map 0 -map 1:a -c:v copy -shortest -vcodec libx264 -crf 24 output.mp4
  1. Anything tracked by Git works — not just open source repos. Because it runs purely locally, your proprietary work code works just fine too. Give it a spin.
Read More

How to Survive and Thrive in a Tough Environment

【2022-07-01】Probably a sharing to the team in April this year, archived in the blog. Let's talk about how a domestic development engineer can survive and become stronger when the environment is bad.