2
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ffmpegでPNG連番画像をMP4動画に変換

Last updated at Posted at 2020-05-12

ffmpegで以下のようなPNG連番画像をMP4動画に変換する方法を説明します。
thumbnails-0.png

PNG連番画像の確認

$ ls *.png
0010.png  0013.png  0016.png  0019.png  0022.png  0025.png  0028.png  0031.png  0034.png  0037.png  0040.png  0043.png  0046.png  0049.png  0052.png  0055.png  0058.png
0011.png  0014.png  0017.png  0020.png  0023.png  0026.png  0029.png  0032.png  0035.png  0038.png  0041.png  0044.png  0047.png  0050.png  0053.png  0056.png  0059.png
0012.png  0015.png  0018.png  0021.png  0024.png  0027.png  0030.png  0033.png  0036.png  0039.png  0042.png  0045.png  0048.png  0051.png  0054.png  0057.png  0060.png

ffmpegでPNG連番画像をMP4動画に変換するコマンド

$ ffmpeg -r 2 -pattern_type glob -i '*.png' -vcodec libx264 -acodec copy -pix_fmt yuv420p -r 2 fluid_simulation_in_blender.mp4

youtubeにアップロードの結果

Fluid simulation in Blender 2.82

PNG連番画像を縮小

$ mogrify -resize 10% *.png

PNG連番画像をモンタージュ

$ montage *.png -tile 10x5 thumbnails.png

Ubuntu18.04にffmpegをインストール

$ sudo apt install ffmpeg

ffmpegのバージョンの確認

$ ffmpeg -version
ffmpeg version n4.1.4 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
configuration: --prefix= --prefix=/usr --disable-debug --disable-doc --disable-static --enable-avisynth --enable-cuda --enable-cuvid --enable-libdrm --enable-ffplay --enable-gnutls --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopus --enable-libpulse --enable-sdl2 --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxvid --enable-nonfree --enable-nvenc --enable-omx --enable-openal --enable-opencl --enable-runtime-cpudetect --enable-shared --enable-vaapi --enable-vdpau --enable-version3 --enable-xlib
libavutil      56. 22.100 / 56. 22.100
libavcodec     58. 35.100 / 58. 35.100
libavformat    58. 20.100 / 58. 20.100
libavdevice    58.  5.100 / 58.  5.100
libavfilter     7. 40.101 /  7. 40.101
libswscale      5.  3.100 /  5.  3.100
libswresample   3.  3.100 /  3.  3.100
libpostproc    55.  3.100 / 55.  3.100

Ubuntuのバージョンの確認

$ uname -a
Linux meme_test 4.15.0-88-generic #88-Ubuntu SMP Tue Feb 11 20:11:34 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.4 LTS
Release:        18.04
Codename:       bionic
2
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?