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

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python are both high-level programming languages that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

Dreamweaver Mac version
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software