[精讚] [會員登入]
299

[Centos8][Rocky9] ffmpeg 安裝及使用,用ffmpef製作gif動畫

用ffmpef製作gif動畫,但是他的功能很強大,可以用指令來執行

分享此文連結 //n.sfs.tw/15588

分享連結 [Centos8][Rocky9] ffmpeg 安裝及使用,用ffmpef製作gif動畫@新精讚
(文章歡迎轉載,務必尊重版權註明連結來源)
2023-05-23 14:05:33 最後編修
2022-01-18 23:09:40 By 張○○
 

自動目錄

在centos8下安裝ffmpeg有點麻煩,沒辦法直接安裝完畢。

直接安裝出錯

# dnf install ffmpeg

No match for argument: ffmpeg

安裝步驟

請依順序安裝

[CENTOS8]

# dnf install epel-release dnf-utils

# dnf install gcc

# dnf config-manager --set-enabled powertools

# yum-config-manager --add-repo=https://negativo17.org/repos/epel-multimedia.repo

上式也可以寫成:

# dnf config-manager --add-repo=https://negativo17.org/repos/epel-multimedia.repo

# dnf install ffmpeg

[Rocky9][8]

# dnf install epel-release dnf-utils

# dnf install gcc

# dnf --enablerepo=crb install ladsp

# dnf --enablerepo=crb install ffmpeg

檢查

$ ffmpeg -version

ffmpeg version 4.4.1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 8 (GCC)
configuration: --arch=x86_64 --bindir=/usr/bin --datadir=/usr/share/ffmpeg --disable-debug --disable-static --disable-stripping

  ... 略 ...

--enable-cuvid --enable-ffnvcodec --enable-libmfx --enable-libnpp --enable-libsvtav1 --enable-libsvthevc --enable-libsvtvp9 --enable-libvmaf --enable-nvdec --enable-nvenc --extra-cflags=-I/usr/include/cuda --cpu=x86_64
libavutil      56. 70.100 / 56. 70.100
libavcodec     58.134.100 / 58.134.100
libavformat    58. 76.100 / 58. 76.100
libavdevice    58. 13.100 / 58. 13.100
libavfilter     7.110.100 /  7.110.100
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  9.100 /  5.  9.100
libswresample   3.  9.100 /  3.  9.100 
libpostproc    55.  9.100 / 55.  9.100  <== 這些數字看不懂,可能是版號。

 

執行

執行範例

$ ffmpeg -start_number 100 -stream_loop 0 -r 1.8  \
   -i '/path/to/%d/picture.png' -vf reverse -y  \
   -hide_banner -loglevel error /path/to/output.gif

參數說明

-start_number 100 從編號100開始起算
-stream_loop 0  重覆播放,0表示不重覆
-r 1.8 每秒1.8張圖
-i '/path/to/%d/picture.png' 從路徑 /path/to/[100~最後]/picture.png 取得圖片,如果你是連續編號的圖片可以寫成 /path/to/picture%d.png,也可以使用列清單的方式,請參考[4]的說明。
-vf reverse 反向取號,從數字大的往取到數字小的順序取號。[5]
-y 目的有同名檔案的話直接取代
-hide_banner -loglevel error 採用安靜模式,不顯示非錯誤的資訊[6]
/path/to/output.gif 輸出的目標檔案

結論

ffmpeg 可以做到指令化、快速縮放建立mp4或gif動畫的功能,同時他也有三種圖片的輸入方式:連續編號、萬用字元、清單。

4.4內建可用GPU來加速運算,功能非常的強大。

 

參考資料

[1] https://linuxize.com/post/how-to-install-ffmpeg-on-centos-8/

[2] Cannot enable PowerTools for RHEL 8 https://access.redhat.com/discussions/5417621

[3] https://unix.stackexchange.com/questions/24014/creating-a-gif-animation-from-png-files/489210

[4] 如何用FFmpeg將連續的圖片轉成影片? https://magiclen.org/ffmpeg-image-sequence-encode

[5] reverse order https://stackoverflow.com/questions/40475480/ffmpeg-convert-image-sequence-to-video-with-reversed-order

[6] 安靜模式 https://superuser.com/questions/326629/how-can-i-make-ffmpeg-be-quieter-less-verbose

[7] 加速ffmpeg https://itnext.io/speedup-ffmpeg-without-compiling-from-source-code-c1f34d4ec544

[8] https://centos.pkgs.org/9-stream/centos-crb-x86_64/ladspa-1.13-28.el9.x86_64.rpm.html

END

你可能感興趣的文章

Centos7 安裝 docker-composer 及使用 docker compose 是使用docker的利器,可以讓很多的指令用文檔的方式載入。

[Centos7] 安裝nodejs8+yarn 安裝nodejs 8+ yarn的過程記錄

[Centos] 安裝及使用postfix,設定虛擬帳號及轉寄 使用postfix來設定虛擬帳號及轉寄

[Centos7] 把帳號新增移除具有root權限等級的sudoer 把帳號新增或移除具有root權限等級的sudoer

[Rocky9] codeignitor4+ nginx+ php8.1-fpm + docker compose 這次的目標是把服務裝在docker,裡面放入 nginx 和 php8.1-fpm的 docker container, 並採用codeignitor4。

[CENTOS7/8] 安裝中文字型 如何在Centos7上安裝和移除中文字型?

我有話要說

>>

限制:留言最高字數1000字。 限制:未登入訪客,每則留言間隔需超過10分鐘,每日最多5則留言。

訪客留言

[無留言]

隨機好文

如何在linux下執行java 原生的java應用程式可以使用簡單的方法在console下面寫出來,適合作簡單的應用

[Windows7] 移除IE10及移除IE11 Windows7 不得已的情況要移除IE11或IE10怎麼做?

世紀帝國征服者新版本--被遺忘的帝國 世紀帝國征服者新版本--被遺忘的帝國 世紀二代的征服者是精典遊戲中的精典,aofe更好玩...

魔球中小女孩唱的歌 The show 魔球中小女孩唱的歌 The show

[PHP] 檢查檔案是否是圖檔 使用getimagesize函數檢查檔案是否是圖檔