[精讚] [會員登入]
351

[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

你可能感興趣的文章

[Centos8] 利用nmcli 設定ipv4 位址 Centos7之後修改網路設定變得比較麻煩一點,此篇介紹使用nmcli指令的方法

[DNS] 把Named 產生的log放到遠端伺服器 把named的log放到log server以符合資安的需求。

[Centos7] HTTPS/SSL憑證的SELINUX設置 把申請來的憑證檔放到指定的位置後,沒辦法啟動,怎麼辦?

[Rocky9] LetsEncrypt + nginx + docker 使用 certbot container 配合 nginx 來設製HTTPS.

[CENTOS7] 使用 logrotate 來整理mongo日誌檔 解決 mongo 的日誌檔不斷長大的問題

[Rocky9] 負載平衡器Haproxy安裝及設定 負載平衡器Haproxy安裝及設定,這次的範例是透過本機的一個埠背後連到數台資料庫伺服器。

我有話要說

>>

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

訪客留言

[無留言]

隨機好文

[jQuery] 利用load()來達成ajax的寫法 jQuery中利用load()來達成ajax的寫法,也有人稱他是假的ajax,作法就是..

看懂DSUB DVI HDMI USB等各式影音接頭 看懂DSUB DVI HDMI等各式影音接頭

NETCRAFT發現你的網站及作業系統 NETCRAFT可以發現你的網站及作業系統

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

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