[精讚] [會員登入]
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

你可能感興趣的文章

[Centos7 8] postfix+DKIM 設定 信件總是被退?希望別的mail server相信我寄出的信?那麼你可以設定dkim。

[Oracle9] 查看磁碟檔案類型、掛載和uuid linux 如何查看掛載的磁碟類型?此文做個整理。

TFTP Server 安裝及使用 讓設備的網路設定檔或是韌體經由TFTP拷備出來,操作的方法

[APACHE] PHP<5.5及 PHP>=5.5 安裝APC php5.5版後的apc只能手動安裝,此文包含php<5.5及php>=5.5兩種安裝方法

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

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

我有話要說

>>

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

訪客留言

[無留言]

隨機好文

[jQuery] textarea 的取值和給值 HTML 的 TEXTAREA 標籤若要用 jquery 取值,不能使用 .text() 或 .html() ,使用 .

沒有非誰做不可的事,也沒有不可被取代的人 沒有非誰做不可的事,也沒有不可被取代的人

[Freebsd] 定時測試 ADSL 是否斷線並重連 中華電信 ADSL 雖有固定 ip,可是他卻會不定時「斷線」, 使用以下的 方法可以定時測試是否斷線,以及重新撥接。

安裝SPHINX支援中文 新版本的 sphinx 和舊版不同,網路上很多範例和教學是不能用的。此文是安裝和設定方法分享

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