首页 后端开发 php教程 ubuntu 装配 ffmpeg php-ffmpeg

ubuntu 装配 ffmpeg php-ffmpeg

Jun 13, 2016 am 10:31 AM
enable file return the

ubuntu 安装 ffmpeg php-ffmpeg

?? 最近在做一个视频网站安装本地环境费了不少时间。本地是ubuntu 9.10 而服务器是redhat as4 所以到时候本人会把服务器安装过程和大家分享出来。

本人环境如下

  • php —- 5.210
  • apache 2.2
  • ubuntu 9.10
  1. ffmpeg 功能很强大包括视频抓图,视频信息,视频转换,在线视频录制,而且是免费的。所有一般的视频网站都会采用他。
  2. 本人首先是采用编译安装,但是一直都没有成功。编译过程中出现了很多问题。安装要使用ffmpeg往往需要编译很多包。感觉很麻烦。这些包又依赖于很多其他包。安装顺序也有要求。所以放弃了。
  3. 最终采用ubuntu 强大的 apt-get (使用dpkg进行安装) 进行安装(当然cenos,red hat这类使用rpm的系统都可以使用yum进行安装,具体的安装方法可以在本站进行查找).
  4. 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
  5. 编译安装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 也可以。随便你怎么整都可以。
View Code PHP

?

测试用例:ffmpeg-execute.php

本文链接地址: ubuntu 安装 ffmpeg php-ffmpeg

本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

AI Hentai Generator

AI Hentai Generator

免费生成ai无尽的。

热门文章

R.E.P.O.能量晶体解释及其做什么(黄色晶体)
3 周前 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳图形设置
3 周前 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您听不到任何人,如何修复音频
3 周前 By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25:如何解锁Myrise中的所有内容
3 周前 By 尊渡假赌尊渡假赌尊渡假赌

热工具

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

禅工作室 13.0.1

禅工作室 13.0.1

功能强大的PHP集成开发环境

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)

鸿蒙原生应用随机诗词 鸿蒙原生应用随机诗词 Feb 19, 2024 pm 01:36 PM

想了解更多关于开源的内容,请访问: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

使用java的File.length()函数获取文件的大小 使用java的File.length()函数获取文件的大小 Jul 24, 2023 am 08:36 AM

使用Java的File.length()函数获取文件的大小文件大小是在处理文件操作时很常见的一个需求,Java提供了一个很方便的方法来获取文件的大小,即使用File类的length()方法。本文将介绍如何使用该方法来获取文件的大小,并给出相应的代码示例。首先,我们需要创建一个File对象来表示我们想要获取大小的文件。以下是创建File对象的方法:Filef

php blob怎么转file php blob怎么转file Mar 16, 2023 am 10:47 AM

php blob转file的方法:1、创建一个php示例文件;2、通过“function blobToFile(blob) {return new File([blob], 'screenshot.png', { type: 'image/jpeg' })}”方法实现Blob转File即可。

C语言return的用法详解 C语言return的用法详解 Oct 07, 2023 am 10:58 AM

C语言return的用法有:1、对于返回值类型为void的函数,可以使用return语句来提前结束函数的执行;2、对于返回值类型不为void的函数,return语句的作用是将函数的执行结果返回给调用者;3、提前结束函数的执行,在函数内部,我们可以使用return语句来提前结束函数的执行,即使函数并没有返回值。

2 个月不见,人形机器人 Walker S 会叠衣服了 2 个月不见,人形机器人 Walker S 会叠衣服了 Apr 03, 2024 am 08:01 AM

机器之能报道编辑:吴昕国内版的人形机器人+大模型组队,首次完成叠衣服这类复杂柔性材料的操作任务。随着融合了OpenAI多模态大模型的Figure01揭开神秘面纱,国内同行的相关进展一直备受关注。就在昨天,国内"人形机器人第一股"优必选发布了人形机器人WalkerS深入融合百度文心大模型后的首个Demo,展示了一些有趣的新功能。现在,得到百度文心大模型能力加持的WalkerS是这个样子的。和Figure01一样,WalkerS没有走动,而是站在桌子后面完成一系列任务。它可以听从人类的命令,折叠衣物

使用java的File.renameTo()函数重命名文件 使用java的File.renameTo()函数重命名文件 Jul 25, 2023 pm 03:45 PM

使用Java的File.renameTo()函数重命名文件在Java编程中,我们经常需要对文件进行重命名的操作。Java提供了File类来处理文件操作,其中的renameTo()函数可以方便地重命名文件。本文将介绍如何使用Java的File.renameTo()函数来重命名文件,并提供相应的代码示例。File.renameTo()函数是File类的一个方法,

电脑里enable是什么意思 电脑里enable是什么意思 Aug 30, 2023 pm 01:55 PM

电脑里enable是指的是启用或激活某个功能或选项的意思,在计算机领域,enable通常用于描述在软件或硬件中启用某种功能或选项的过程。详细介绍:1、在软件方面,enable通常指的是在应用程序或操作系统中启用某个功能;2、在硬件方面,enable通常指的是在计算机系统中启用某个设备或接口。

Java中return和finally语句的执行顺序是怎样的? Java中return和finally语句的执行顺序是怎样的? Apr 25, 2023 pm 07:55 PM

源码:publicclassReturnFinallyDemo{publicstaticvoidmain(String[]args){System.out.println(case1());}publicstaticintcase1(){intx;try{x=1;returnx;}finally{x=3;}}}#输出上述代码的输出可以简单地得出结论:return在finally之前执行,我们来看下字节码层面上发生了什么事情。下面截取case1方法的部分字节码,并且对照源码,将每个指令的含义注释在

See all articles