亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

在Linux上將視頻轉換成動態gif圖片 (附:ffmpeg

系統 2222 0

雖然曾經被認為是過時的藝術形式,但動態GIF圖片現在復蘇了。如果你還沒有留意到,不少在線分享和社交網絡網站都開始支持動態GIF圖片,例如, Tumblr Flickr Google+ Facebook的部分地方 。由于在消費和共享上的容易,GIF的動畫已經成為主流互聯網文化的一部分了。

?

所以,你們中的一些人會好奇怎樣才能生成這樣的動態GIF圖片。已經有各種各樣專門用來生成動態GIF圖片的在線或離線工具。另一種選擇是創建一副動態GIF圖片時關閉現有的視頻剪輯。在這個教程中,我會描述 在Linux上如何將一段視頻文件轉換成一副動態GIF圖片

?

作為一個更有用的例子,讓我展示如何 將一個YouTube視頻轉換成一副動態GIF圖片

?

第一步:下載YouTube視頻

?

首先,下載一個你想要轉換的YouTube視頻。你可以使用 youtube-dl 這個工具將YouTube視頻保存為MP4文件。假設你把你最愛的YouTube視頻保存為"funny.mp4"。(譯注:對于墻內的同學,請無視YT吧,自行去好人樓主那里尋找一個MP4吧,;-})

?

第二步:從視頻中解壓視頻幀

?

接下來,在Linux系統上 安裝FFmpeg ,我會用這個工具去解壓從視頻中解壓出視頻幀。

?

下面的指令會解壓出獨立的視頻幀,將它們保存為GIF圖片。確保使用諸如("out%04d.gif")的輸出文件格式。這樣,獨立的幀就被合適地命名并保存。

      ffmpeg -t <時長> -ss <hh:mm:ss格式的開始位置> -i <視頻文件> out%04d.gif
    

?

例如,如果你想解壓輸入視頻的視頻幀,從第10秒開始,每5秒一幀,請運行下列命令。

      $ ffmpeg -t 5 -ss 00:00:10 -i funny.mp4 out%04d.gif 
    

?

在完成FFmpeg之后,你會看到一組創建出來的GIF文件,它們被命名為"out[\d+].gif"。

?

第三步:合并視頻幀進一副動態GIF

?

下面這一步要合并單個的GIF文件成一副動態GIF圖片。為此,你可以使用ImageMagick。

?

首先,如果你還沒有的話,在Linux系統上 安裝ImageMagick

      convert -delay <幀數>x<每秒幀數> -loop 0 out*gif <輸出文件>
    

?

在這個命令中,"-delay"是控制動態速度的選項。這個選項表示在顯示下一幀畫面前需要等待的秒數:幀數/每秒幀數 。"-loop 0"選項表示動畫的無限次循環。如果你愿意,你可以指定"-loop N"讓動畫只重復N次。

?

例如,為了生成一副每秒20幀和循環無數次的動態GIF圖片,使用如下命令。

      $ convert -delay 1x20 -loop 0 out*.gif animation.gif 
    

?

第四步(可選):減少動態GIF的大小

?

最后這一步(可選)是通過使用ImageMagick的GIF優化功能來減少生成的GIF文件的大小。

?

使用下列命令去減少GIF大小。

      convert -layers Optimize animation.gif animation_small.gif 
    

?

現在你已經準備好在你的社交網絡上分享制作完成的GIF圖片。下面是一副我從一個可愛的YouTube視頻中生成的GIF樣例圖片。

?

享受技術帶來的樂趣吧!:-)

?


?

via: http://xmodulo.com/2013/11/convert-video-animated-gif-image-linux.html

譯者: KayGuoWhu 校對: wxy

原文由 LCTT 原創翻譯, Linux中國 榮譽推出

原文地址: http://linux.cn/thread/12298/1/1/

?

1. 安裝ffmpeg

?

Install FFmpeg in Ubuntu

?

Either click this link or run this command in the terminal to install FFmpeg.

      sudo apt-get install ffmpeg
    

?

Install FFmpeg in Fedora

?

FFmpeg can be directly installed from the repos. Just run the following command.

      su -c 'yum install ffmpeg'
    

?

Install FFmpeg in any Linux system from source

?

This howto will be helpful to all the linuxers who either want to have a fully customized installation of FFmpeg or are having some trouble in installing the default package from the distro repos or want to try the latest release.

?

First of all you will have to download the latest source from the main website . Now, untar it.

      tar -xvjf ffmpeg-0.5.tar.bz2
    

?

Install FFmpeg with default options

?

once you are done with this, in order to install FFmpeg with the default config and options run

      ./configure
    

?

from within the FFmpeg source directory. When the configuration script finishes compile it by running make

      make
    

?

If the compile finishes without any errors run 'make install' as root to install FFmpeg

      su -c 'make install'
    

?

Install FFmpeg with customized settings

?

If you want to install FFmpeg by customizing some installation options then you can pass some special parameter while running configure script. Run the following command to find out various options available while running configure script.

      ./configure --help
    

?

This will show you various options to customize the default installation. Most of the time the default installation will work for you but there is one option which most of us might need freqeuntly. It is

?

--enable-libmp3lame: This one is a must if you want to work with mp3. Encoding mp3 won't be possible without it.

?

Although in order to make this option work you will need lame installed. You will get the warning at the time of configuring it. This can be done by installing the library "libmp3lame". You can either install it directly from the repos.

      sudo apt-get install libmp3lame0
    

?

or, you can install libmp3lame directly from the source from their website .

?

Once you are done with 'lame's' installation. this run configure again, if successful run ' make ' and then ' make install ' as root.

?

原文: http://linuxers.org/tutorial/how-install-ffmpeg-linux

?

2. 安裝ImageMagick

?

ImageMagick is a suite of command line utilities for image conversion and editing. As one of the most popular image editing software suite, ImageMagick can support almost all kinds of raster image types including GIF, JPEG, PDF, PNG, Postscript, SVG, and TIFF.

?

Install ImageMagick on Debian, Ubuntu or Linux Mint

?

ImageMagick is included in a base repository of Debian-based systems. So simply use apt-get command.

      sudo apt-get install imagemagick 
    

?

Install ImageMagick on Fedora, CentOS or RHEL

?

ImageMagick is also part of standard RedHat-based systems. Thus installation is straightforward with yum command.

      sudo yum install ImageMagick 
    

?

Install ImageMagick on OpenSUSE

?

Installation of ImageMagick is straightforward on OpenSUSE with the use of zypper command.

      sudo zypper install imagemagick 
    

?

原文: http://xmodulo.com/2013/03/how-to-save-youtube-videos-on-linux.html

?

在Linux上將視頻轉換成動態gif圖片 (附:ffmpeg和ImageMagick安裝方法)


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 国产私拍| 伊人婷| 九九热九九 | 操操干 | 亚洲国产一区二区三区四区 | 天天综合日日噜噜噜 | 男人的天堂免费在线观看 | 久久精品三级 | 四虎在线看| 成人午夜大片免费视频77777 | 一级毛片免费看 | 依人综合网 | 奇米888影视 | 日韩精品一区二三区中文 | 国产偷久久 | 国产精亚洲视频 | 日韩精品一区二区三区在线观看 | 91福利合集 | 四虎成人精品 | 久久精品a | 天天综合网在线 | 伊人免费视频网 | 正在播放亚洲 | 国产69精品久久久久妇女 | 亚洲免费在线 | 九九免费观看全部免费视频 | 深夜福利网站在线 | 在线欧美| 激情在线观看视频 | 国产精品播放 | 亚洲毛片在线免费观看 | 狠狠色伊人亚洲综合第8页 狠狠色综合久久丁香婷婷 狠狠色综合久久婷婷 | 欧美人与动性xxxxbbbb | 久久免费高清 | 免费国产一区二区三区四区 | 99在线精品国产不卡在线观看 | 久久.com| 色综合网站在线 | xxx中国网站xxx | 国产欧美日韩成人 | 亚洲精品久久99久久一 |