PHP中ffmpeg的使用(amr转mp3方法,视频截取第一帧)

1.安装ffmpeg

(1)下载安装包:

1. lame:https://sourceforge.net/projects/lame/files/lame/
2. amr:https://sourceforge.net/projects/opencore-amr/
3. ffmpeg:http://ffmpeg.org/download.html
4. opencore-amr:https://sourceforge.net/projects/opencore-amr/files/opencore-amr/

(2)安装:

  1. yum install yasm
  2. tar -zxvf lame-3.100.tar.gz
    ./configure
    make
    make install
  3. tar -zxvf fdk-aac-2.0.1.tar.gz
    ./configure
    make
    make install
  4. tar -jxvf ffmpeg-4.2.3.tar.bz2
    ./configure --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-shared(这一步可能出错,那是因为没有安装扩展包,下载对应安装包解压安装即可,./configure && make && make install)
    make
    make install
  5. ldconfig

验证是否安装成功:
(1). 转换amr为mp3:ffmpeg -i test.amr test.mp3
(2). 获取视频第一帧:ffmpeg -i test.mp4 -y -f mjpeg -ss 3 -t 1 test.jpg

你可能感兴趣的:(person,php,ffmpeg)