目次
environment
- mac
- ffmpeg
- movImageMagick
- mov
- gif
do what
We introduce ffmpeg and movImageMagick to mac. After that, I will actually convert the mov file (if mov file does not exist, it may be good to use QuickTime Player etc) to gif file. In order to use ffmpeg, please introduce Homebrew so that brew command can be used beforehand. *** This article is intended for mac users.
ffmpegとmovImageMagick
Ffmpeg to be used from now on is free software that will convert the image / movie format. There are various options, and it moves still more easily. It is also recommended to install movImageMagick in conjunction with ffmpeg's trial at the same time. movImageMagick compresses movies such as mov to be huge, to a small size. movImageMagick can also be installed easily with the brew command.
Confirm that ffmpeg does not exist
Let's go for the first time. First of all, make sure ffmpeg is not on macOS。
$ ffmpeg -version -bash: ffmpeg: command not found
Install the latest version of ffmpeg
You can install ffmpeg with the following command.
brew install ffmpeg
Install imagemagick
Do not forget to download imagemagick after introducing ffmpeg. You can install imagemagick with the following command. Now you can compress large files and convert them to smaller sizes.
brew install imagemagick
Convert mov to gif
Ready if you come here. Convert mov file to gif file with the following command. In the example below, gif is generated by cutting out the specified range from 0 to 10 seconds. If the playback time is long, the file becomes large, so we recommend converting only the necessary parts.
ffmpeg -ss 00:00:00.000 -i file.mov -pix_fmt rgb24 -r 10 -s 320x240 -t 00:00:10.000 newfile.gif
Confirm file size with la -lh
Let's check the size of the gif file with the following command as a trial. It should surely have been converted with a small size.
Shell for work efficiency
It would be troublesome to hit commands every time on macOS as above. I made a shell to improve work efficiency. Start time, name under the file, end time, newly created file name, a function to be executed by taking these as arguments. Please try using it for alias by all means. Finally, a reference article for that is described below.
ffm() { #$1 start time #$2 file name #$3 end time #$4 new file name and type ffmpeg -ss 00:00:$1.000 -i $2 -pix_fmt rgb24 -r 10 -s 320x240 -t 00:00:$3.000 $4 }
How to use
$ ffm 00 test.mov 10 newfile.gif
Reference
[urlpreviewbox url="https://off.tokyo/blog/2018/04/13/mamp%E3%81%AEdb%E3%81%AB%E3%82%A2%E3%82%AF%E3%82%BB%E3%82%B9%E3%81%99%E3%82%8B%E3%82%B7%E3%82%A7%E3%83%AB%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88/"/]