[精讚] [會員登入]
418

[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

你可能感興趣的文章

[MSSQL] 使用linux連接微軟的MS-SQL 職務上需要連接到mssql,這是我第一次試圖在linux連接mssql。

[Centos7] 安裝phpMyAdmin Centos 7有新的方式可以安裝phpmyadmin,不必再採用過去的tarball安裝法。

[Centos6] 安裝VNC連線程式 在Centos6桌上環境安裝VNC 連線程式

[Centos7] SSL自簽憑證+APACHE+Selinux SSL的自簽憑證

[Centos8] linux 上的Base64加解密指令 在linux上很方便的指令可以加解密 base64

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

隨機好文

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

[HP DL380G7] 生效啟動第3,4片網卡/開啟或關閉內建的網卡 HP DL380G7 預設第3,4片網卡裝完系統後找不到,難道是壞了?要怎麼辦?

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

[CodeIgniter3] 解決無法上傳特定檔案(.sb2)的問題 上傳時出現The filetype you are attempting to upload is not allowed,要怎麼解決?

詭異的創業思維 創業的思維中,有多少銀彈,有多少技術,有多少人脈,有多少時間等等,每個都要考慮進去,以熱忱建立的關係脆弱的像蘇打餅乾一樣..