如何安装旧版本的 ffmpeg?

如何安装旧版本的 ffmpeg?

我在使用当前版本的 ffmpeg 时遇到了问题,它将 .mp3 转码为我的客户端不支持的格式的 .wavs。

如何安装这个版本?

ffmpeg version 0.7.3-4:0.7.3-0ubuntu0.11.10.1, Copyright (c) 2000-2011 the Libav developers
  built on Jan  4 2012 16:08:51 with gcc 4.6.1

编辑

我试图解决的问题是将 .mp3 转码为 .wav。我们的客户有一个识别服务,可以从 .wav 中识别歌曲。当我传递 ffmpeg 生成的 .wav 时

exec ("ffmpeg -ss $start -t $duration -i $shellArgSongPath -f wav -ar 44100 somefile.wav");

我收到“不支持音频格式”

我猜想用于从 .mp3 转码为 .wav 的默认编解码器已经改变。有人知道上一版本中是什么吗?

编辑

(Reading database ... 31284 files and directories currently installed.)
Preparing to replace ffmpeg 4:0.7.3-0ubuntu0.11.10.1 (using ffmpeg_0.7.3-0ubuntu0.11.10.1_amd64.deb) ...
Unpacking replacement ffmpeg ...
Replaced by files in installed package libav-tools ...
dpkg: dependency problems prevent configuration of ffmpeg:
 ffmpeg depends on libavcodec53 (<< 4:0.7.3-99) | libavcodec-extra-53 (<< 4:0.7.3.99); however:
  Version of libavcodec53 on system is 4:0.8.1-0ubuntu1.
  Package libavcodec-extra-53 is not installed.
 ffmpeg depends on libavdevice53 (<< 4:0.7.3-99) | libavdevice-extra-53 (<< 4:0.7.3.99); however:
  Version of libavdevice53 on system is 4:0.8.1-0ubuntu1.
  Package libavdevice-extra-53 is not installed.
 ffmpeg depends on libavfilter2 (<< 4:0.7.3-99) | libavfilter-extra-2 (<< 4:0.7.3.99); however:
  Version of libavfilter2 on system is 4:0.8.1-0ubuntu1.
  Package libavfilter-extra-2 is not installed.
 ffmpeg depends on libavformat53 (<< 4:0.7.3-99) | libavformat-extra-53 (<< 4:0.7.3.99); however:
  Version of libavformat53 on system is 4:0.8.1-0ubuntu1.
  Package libavformat-extra-53 is not installed.
 ffmpeg depends on libavutil51 (<< 4:0.7.3-99) | libavutil-extra-51 (<< 4:0.7.3.99); however:
  Version of libavutil51 on system is 4:0.8.1-0ubuntu1.
  Package libavutil-extra-51 is not installed.
 ffmpeg depends on libpostproc52 (<< 4:0.7.3-99) | libpostproc-extra-52 (<< 4:0.7.3.99); however:
  Version of libpostproc52 on system is 4:0.8.1-0ubuntu1.
  Package libpostproc-extra-52 is not installed.
 ffmpeg depends on libswscale2 (<< 4:0.7.3-99) | libswscale-extra-2 (<< 4:0.7.3.99); however:
  Version of libswscale2 on system is 4:0.8.1-0ubuntu1.
  Package libswscale-extra-2 is not installed.
 libav-tools (4:0.8.1-0ubuntu1) breaks ffmpeg (<< 4:0.8~) and is installed.
  Version of ffmpeg to be configured is 4:0.7.3-0ubuntu0.11.10.1.
dpkg: error processing ffmpeg (--install):
 dependency problems - leaving unconfigured
Processing triggers for man-db ...
Errors were encountered while processing:
 ffmpeg

编辑 当我ffmpeg从服务器运行命令时输出格式正确的 .wav

ffmpeg version 0.7.3-4:0.7.3-0ubuntu0.11.10.1, Copyright (c) 2000-2011 the Libav developers
  built on Jan  4 2012 16:08:51 with gcc 4.6.1
  configuration: --extra-version='4:0.7.3-0ubuntu0.11.10.1' --arch=amd64 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
  libavutil    51.  7. 0 / 51.  7. 0
  libavcodec   53.  6. 0 / 53.  6. 0
  libavformat  53.  3. 0 / 53.  3. 0
  libavdevice  53.  0. 0 / 53.  0. 0
  libavfilter   2.  4. 0 /  2.  4. 0
  libswscale    2.  0. 0 /  2.  0. 0
  libpostproc  52.  0. 0 / 52.  0. 0
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'

当我ffmpeg从服务器运行命令时,输出产生格式错误的 .wav

ffmpeg version 0.8.1-4:0.8.1-0ubuntu1, Copyright (c) 2000-2011 the Libav developers
  built on Mar 22 2012 05:09:06 with gcc 4.6.3
This program is not developed anymore and is only provided for compatibility. Use avconv instead (see Changelog for the list of incompatible changes).
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'

答案1

根据我们的评论风暴,我假设 libav 中存在回归或您的应用程序中存在错误,导致您收到“不支持音频格式”消息。您可以尝试编译 ffmpeg(来自 FFmpeg 项目,而不是 libav)。根据我的经验,失败ffmpeg时通常会起作用avconv。这将创建 ffmpeg 的“本地”版本,因此它不会干扰您从存储库获取的 ffmpeg/avconv:

sudo apt-get install build-essential yasm
cd
wget -O ffmpeg.tar.gz "http://git.videolan.org/?p=ffmpeg.git;a=snapshot;h=HEAD;sf=tgz"
tar xzvf ffmpeg.tar.gz
cd ffmpeg-HEAD-*
./configure
make

现在尝试 ffmpeg。请注意./之前的ffmpeg,此示例假定输入文件位于您的主目录中。输出将放置在您的主目录中:

cd ~/ffmpeg-HEAD-*
./ffmpeg -i ~/input.mp3 ~/output.wav

如果这有效,您可以考虑实际替换 libav 并安装 ffmpeg:如何在 Ubuntu 上编译 FFmpeg 和 x264

答案2

我也有同样的问题,因为我想从 ffmpeg 4.2.2 降级到 3.4.6。以下是我操作的方法:

因为这个答案,我了解了apt policy ffmpeg,所以我运行它并看到:

vagrant@vboxHomestead:~/Code/$ apt policy ffmpeg
ffmpeg:
  Installed: 7:4.2.2-0york0~18.04
  Candidate: 7:4.2.2-0york0~18.04
  Version table:
 *** 7:4.2.2-0york0~18.04 500
        500 http://ppa.launchpad.net/jonathonf/ffmpeg-4/ubuntu bionic/main amd64 Packages
        100 /var/lib/dpkg/status
     7:3.4.6-0ubuntu0.18.04.1 500
        500 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages
        500 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages
     7:3.4.2-2 500
        500 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages

我知道我想降级到7:3.4.6-0ubuntu0.18.04.1

https://www.linuxuprising.com/2019/02/how-to-downgrade-packages-to-specific.html非常有帮助。

于是我就跑了sudo apt install ffmpeg=7:3.4.6-0ubuntu0.18.04.1

答案3

浏览软件包档案http://www.packages.ubuntu.com/
我发现您要求的版本在里面梦境存储库。

只需下载并安装该.deb软件包及其依赖项(如果需要)。

相关内容