Quicktimeでキャプチャしたスクリーン動画をgif画像に変換する
動画を上げるの面倒なんだけど
こちらの方法も面倒な気がしている…
インストール
FFmpeg
brew install ffmpeg \ --with-fdk-aac --with-libvo-aacenc \ --with-libvorbis --with-libvpx \ --with-openjpeg --with-theora \ --with-opencore-amr
imagemagick
brew install imagemagick
movファイルをエンコード
ffmpeg -i test1.mov -r 15 frames/%03d.png
↓
atsumotoshigeji-no-MacBook-Air:memo matsumotoshigeharu$ ll total 1192 -rw-r--r--@ 1 matsumotoshigeharu staff 509 5 3 22:05 install_command.txt -rw-r--r--@ 1 matsumotoshigeharu staff 5111 6 8 18:26 phalcon.txt -rw-r--r--@ 1 matsumotoshigeharu staff 586903 10 3 00:34 test1.mov matsumotoshigeji-no-MacBook-Air:memo matsumotoshigeharu$ mkdir frames matsumotoshigeji-no-MacBook-Air:memo matsumotoshigeharu$ ffmpeg -i test1.mov -r 50 frames/%03d.png ffmpeg version 2.2.3 Copyright (c) 2000-2014 the FFmpeg developers built on Oct 3 2014 00:47:25 with Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn) configuration: --prefix=/usr/local/Cellar/ffmpeg/2.2.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-aacenc --enable-libfdk-aac --enable-libopenjpeg --extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.1_1/include/openjpeg-1.5 ' libavutil 52. 66.100 / 52. 66.100 libavcodec 55. 52.102 / 55. 52.102 libavformat 55. 33.100 / 55. 33.100 libavdevice 55. 10.100 / 55. 10.100 libavfilter 4. 2.100 / 4. 2.100 libavresample 1. 2. 0 / 1. 2. 0 libswscale 2. 5.102 / 2. 5.102 libswresample 0. 18.100 / 0. 18.100 libpostproc 52. 3.100 / 52. 3.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test1.mov': Metadata: major_brand : qt minor_version : 0 compatible_brands: qt creation_time : 2014-10-02 15:34:08 Duration: 00:00:10.98, start: 0.000000, bitrate: 427 kb/s Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 384x706, 420 kb/s, SAR 1:1 DAR 192:353, 60 fps, 60 tbr, 6k tbn, 50 tbc (default) Metadata: creation_time : 2014-10-02 15:34:08 handler_name : Core Media Data Handler Output #0, image2, to 'frames/%03d.png': Metadata: major_brand : qt minor_version : 0 compatible_brands: qt encoder : Lavf55.33.100 Stream #0:0(und): Video: png, rgb24, 384x706 [SAR 1:1 DAR 192:353], q=2-31, 200 kb/s, 90k tbn, 50 tbc (default) Metadata: creation_time : 2014-10-02 15:34:08 handler_name : Core Media Data Handler Stream mapping: Stream #0:0 -> #0:0 (h264 -> png) Press [q] to stop, [?] for help frame= 551 fps=283 q=0.0 Lsize=N/A time=00:00:11.02 bitrate=N/A dup=0 drop=108 video:15386kB audio:0kB subtitle:0 data:0 global headers:0kB muxing overhead -100.000137% matsumotoshigeji-no-MacBook-Air:memo matsumotoshigeharu$
gitに結合
convert -delay 2 -layers optimize frames/*.png output.gif
作成したものの確認