ubuntu 装配 ffmpeg php-ffmpeg
ubuntu 安装 ffmpeg php-ffmpeg
?? 最近在做一个视频网站安装本地环境费了不少时间。本地是ubuntu 9.10 而服务器是redhat as4 所以到时候本人会把服务器安装过程和大家分享出来。
本人环境如下
- php —- 5.210
- apache 2.2
- ubuntu 9.10
- ffmpeg 功能很强大包括视频抓图,视频信息,视频转换,在线视频录制,而且是免费的。所有一般的视频网站都会采用他。
- 本人首先是采用编译安装,但是一直都没有成功。编译过程中出现了很多问题。安装要使用ffmpeg往往需要编译很多包。感觉很麻烦。这些包又依赖于很多其他包。安装顺序也有要求。所以放弃了。
- 最终采用ubuntu 强大的 apt-get (使用dpkg进行安装) 进行安装(当然cenos,red hat这类使用rpm的系统都可以使用yum进行安装,具体的安装方法可以在本站进行查找).
- apt-get 安装步骤如下:
sudo apt-get update ##更新以下源
sudo apt-get install ffmpeg
sudo apt-get install php5-ffmpeg
sudo apt-get install mencoder
sudo apt-get install flvtool2 ##视频转换flv
sudo apt-get install lame ##音频
sudo apt0get install yasm - 编译安装ffmpeg 如下:
从 http://ffmpeg.mplayerhq.hu 下载
./configure –help ##查看有那些参数
./configure–prefix=/usr–enable-gpl–enable-shared–enable-libmp3lame–enable-libamr_nb–enable-libogg–enable-libvorbis–enable-libxvid–enable-liba52–enable-liba52bin–enable-pp–enable-libfaad–enable-libfaadbin–enable-libfaac–enable-pthreads–disable-ffserver–enable-x11grab
如果报错则安装该包,或者直接去掉该参数,只需要配置自己使用过程中需要使用到的就行了。
make & make install
其他的则一个一个的下载解压在编译就是了。
- 下面是php-ffmpeg 使用的api。功能是很少了。?
$movie = new ffmpeg_movie(String path_to_media, boolean persistent) Open a video or audio file and return it as an object.path_to_media - File path of video or audio file to open.persistent - Whether to open this media as a persistent resource. See the PHP documentation for more info about persistent resources$movie->getDuration() Return the duration of a movie or audio file in seconds.$movie->getFrameCount() Return the number of frames in a movie or audio file.$movie->getFrameRate() Return the frame rate of a movie in fps.$movie->getFilename() Return the path and name of the movie file or audio file.$movie->getComment() Return the comment field from the movie or audio file.$movie->getTitle() Return the title field from the movie or audio file.$movie->getAuthor() alias $movie->getArtist() Return the author field from the movie or the artist ID3 field from an mp3 file.$movie->getCopyright() Return the copyright field from the movie or audio file.$movie->getArtist() Return the artist ID3 field from an mp3 file.$movie->getGenre() Return the genre ID3 field from an mp3 file.$movie->getTrackNumber() Return the track ID3 field from an mp3 file.$movie->getYear() Return the year ID3 field from an mp3 file.$movie->getFrameHeight() Return the height of the movie in pixels.$movie->getFrameWidth() Return the width of the movie in pixels.$movie->getPixelFormat() Return the pixel format of the movie.$movie->getBitRate() Return the bit rate of the movie or audio file in bits per second.$movie->getVideoBitRate() Return the bit rate of the video in bits per second.NOTE: This only works for files with constant bit rate. $movie->getAudioBitRate() Return the audio bit rate of the media file in bits per second.$movie->getAudioSampleRate() Return the audio sample rate of the media file in bits per second.$movie->getFrameNumber() Return the current frame index.$movie->getVideoCodec() Return the name of the video codec used to encode this movie as a string.$movie->getAudioCodec() Return the name of the audio codec used to encode this movie as a string.$movie->getAudioChannels() Return the number of audio channels in this movie as an integer.$movie->hasAudio() Return boolean value indicating whether the movie has an audio stream.$movie->hasVideo() Return boolean value indicating whether the movie has a video stream.$movie->getFrame([Integer framenumber]) Returns a frame from the movie as an ffmpeg_frame object. Returns false if the frame was not found.framenumber - Frame from the movie to return. If no framenumber is specified, returns the next frame of the movie.$movie->getNextKeyFrame() Returns the next key frame from the movie as an ffmpeg_frame object. Returns false if the frame was not found.
登入後複製 - 如果需要给视频抓图择需要使用shell脚本。也就是用到php当中的(system,exec,passthru)这类执行外部命令函数。
往往很多服务器都将种类函数视为危险函数屏蔽掉了。所以想做视频网站对服务器的配置要求比较高。
当然最好是自己的独立服务器。vps 也可以。随便你怎么整都可以。
?
测试用例:ffmpeg-execute.php
本文链接地址: ubuntu 安装 ffmpeg php-ffmpeg

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

php blob轉file的方法:1.建立一個php範例檔;2、透過「function blobToFile(blob) {return new File([blob], 'screenshot.png', { type: 'image/jpeg' })} 」方法實作Blob轉File即可。

使用Java的File.length()函數取得檔案的大小檔案大小是在處理檔案作業時很常見的一個需求,Java提供了一個很方便的方法來取得檔案的大小,即使用File類別的length()方法。本文將介紹如何使用此方法來取得檔案的大小,並給出對應的程式碼範例。首先,我們需要建立一個File物件來表示我們想要取得大小的檔案。以下是建立File物件的方法:Filef

想了解更多關於開源的內容,請造訪:51CTO鴻蒙開發者社群https://ost.51cto.com運行環境DAYU200:4.0.10.16SDK:4.0.10.15IDE:4.0.600一、建立應用程式點擊File- >newFile->CreateProgect。選擇模版:【OpenHarmony】EmptyAbility:填寫項目名,shici,應用包名com.nut.shici,應用儲存位置XXX(不要有中文,特殊字符,空格)。 CompileSDK10,Model:Stage。 Device

機器之能報道編輯:吳昕國內版的人形機器人+大模型組隊,首次完成疊衣服這類複雜柔性材料的操作任務。隨著融合了OpenAI多模態大模型的Figure01揭開神秘面紗,國內同行的相關進展一直備受關注。就在昨天,國內"人形機器人第一股"優必選發布了人形機器人WalkerS深入融合百度文心大模型後的首個Demo,展示了一些有趣的新功能。現在,得到百度文心大模型能力加持的WalkerS是這個樣子的。和Figure01一樣,WalkerS沒有走動,而是站在桌子後面完成一系列任務。它可以聽從人類的命令,折疊衣物

C語言return的用法有:1、對於傳回值類型為void的函數,可以使用return語句來提前結束函數的執行;2、對於傳回值型別不為void的函數,return語句的作用是將函數的執行結果傳回給呼叫者;3、提前結束函數的執行,在函數內部,我們可以使用return語句來提前結束函數的執行,即使函數並沒有回傳值。

使用Java的File.renameTo()函數重命名檔案在Java程式設計中,我們經常需要對檔案進行重命名的操作。 Java提供了File類別來處理檔案操作,其中的renameTo()函數可以方便地重新命名檔案。本文將介紹如何使用Java的File.renameTo()函數來重新命名文件,並提供對應的程式碼範例。 File.renameTo()函數是File類別的一個方法,

使用java的File.getParent()函數取得檔案的父路徑在Java程式設計中,我們經常需要操作檔案和資料夾。有時候,我們需要取得一個檔案的父路徑,也就是該檔案所在資料夾的路徑。 Java的File類別提供了getParent()方法用來取得檔案或資料夾的父路徑。 File類別是Java對檔案和資料夾的抽象表示,它提供了一系列操作檔案和資料夾的方法。其中,get

電腦裡enable是指的是啟用或啟動某個功能或選項的意思,在電腦領域,enable通常用來描述在軟體或硬體中啟用某種功能或選項的過程。詳細介紹:1、在軟體方面,enable通常指的是在應用程式或作業系統中啟用某個功能;2、在硬體方面,enable通常指的是在電腦系統中啟用某個裝置或介面。
