[精讚] [會員登入]
219

[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

你可能感興趣的文章

[Centos6] 安裝wordpress Centos 6下安裝wordpress,非常簡單

[CENTOS8] Failed to download metadata for repo 'appstream' 的問題 Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist的解決方法。

[Centos7] 安裝 semanage (selinux工具程式) 安裝selinux的工具程式 semanage

[SELINUX] php 呼叫系統程式(使用exec, system等)執行網路服務 這近想透過PHP呼叫系統的程式來執行網路的服務,怎麼測試都失敗…

[CENTOS7 8] 查看記憶體 linux 中查看記憶體狀態指令整理

dnf 一個即將取代 yum的套件管理程式 centos 系統中老牌的套件管理程式yum,也許未來將被dnf所取代

我有話要說

>>

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

訪客留言

[無留言]

隨機好文

[Freebsd] 使用 ADSL 撥接上網 Freebsd上要使用 ADSL 撥接上網,該如何設定?

外匯課程經驗 有天遇到某個朋友的正妹朋友,說她有個很棒的外匯投資課程,要我們去聽,只收場地費200大洋。她又說續效最差一個月也有1%,誰還在苦哈哈上班?

[MAC] 安裝APACHE+PHP OS Darwin OpenIDMac1deAir 15.6.0 Darwin Kernel Version 15.6.

對物品的感情 這個議題很奇怪,可是大部分的人都會有,物品是死的,壞了就淘汰,出新的就被替換。為何會有情感?

讓radio box 或checkbox 好按 在行動裝置下,radio box及checkbox變得很難按得到