Click on the video to see the effect
It is suggested to wear headphones to watch the full screen, the open source process has a feeling of “keeping the cloud open to see the moon”, see the end will be a surprise, but also curious who FateRiddle is?
Talk is cheap, Show me the code.
Some time ago, Alibaba/X-Render broke 3K Star and was thinking about how to make a small gift for the students who contribute to the open source community to “celebrate their birthday”. Then it came to the two libraries gource and Avconv that we played before. The former is used to handle commit log visualization and the latter is used for video processing.
1, Prepare to install gource and AVconv libraries, need to make Gource support Chinese fonts, and Homebrew installation may be slow, try this speed up address.
Brew install gource brew install libav //avconv is a similar library to ffmeg, but I prefer avconv to gourcelocal/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
Copy the code
2, find your favorite project with Git management, command line into the local folder root directory, copy the following command enter, you can see the effect and generate a video.
gource \
--title "Write a title."\ --seconds-per-day 0.15 \ -1920x1080 \ -- 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 \ --hide mouse \ --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 60 \
--output-ppm-stream - \
| avconv -y -r 60 -f image2pipe -vcodec ppm -i - -b 65536K movie.mp4
Copy the code
3, trendy videos need to be accompanied by a sense of background music, such as sound. Mp3, download to the root directory of the project, you can use avconv to add audio tracks to the video, to achieve the above effect.
avconv -i movie.mp4 -i sound.mp3 -map 0 -map 1:a -c:v copy -shortest output.mp4
Copy the code
4, as long as the Git logs, so not only open source projects, in fact, your working code folder is also supported, you can try.