ホーム

How to use ffmpeg - Let's convert the file format

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/"/]

Pocket
LinkedIn にシェア

エンジニアにおすすめできる本

Card image cap
リーダブルコード

より良いコードを書くためのシンプルで実践的なテクニック

Card image cap
Webを支える技術

HTTP,URI,HTML,そしてREST

Card image cap
誰でもPythonで作れる

儲かるAIとソフトウェアの作り方

Card image cap
プログラマが知るべき97のこと

現場で使える実践哲学のマスターピース

Card image cap
情熱プログラマー

時代を超えて。ソフトウェア開発者の幸せな生き方

Card image cap
アジャイルサムライ

プログラミング達人開発者への道

Card image cap
Rubyを作った男 まつもとゆきひろ

コードの世界 スーパー・プログラマになる14の思考法

ご提供 sponsor
 

Meee!(ミー)は、ビジネスからプライベート利用まで、個人のスキルを気軽に売り買いできるスキルマーケットです。カテゴリや居住地から、検索することが可能です。

 

ランゲージエクスチェンジは、ネイティブスピーカーと気軽にマッチングできる言語交換プラットフォームです。あなたの地元に住む外国人を探したり、留学や海外移住の前に、現地のネイティブスピーカーと繋がることもできます!

宣伝
 

りょすけトークchは、仕事や私生活をより豊にするYouTubeチャンネルです。文献(本、映画、論文)から役に立つ情報をまとめ、生涯にわたり役に立つ哲学をお届けしています。是非、チャンネル登録してみてね

-ホーム

Copyright© offブログ! , 2021 All Rights Reserved Powered by AFFINGER5.