无法检索本机文件ffmpeg-amd64.exe [英] Cannot retrieve native file ffmpeg-amd64.exe

查看:4955
本文介绍了无法检索本机文件ffmpeg-amd64.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将视频转换为音频。这就是为什么我使用以下代码:

I am trying to convert video to audio . That is why , I am using the following code :

File source = new File("E:\\Shunno - Khachar Bhitor Ochin Pakhi.mp4");
        File target = new File("E:\\output.mp3");
        AudioAttributes audio = new AudioAttributes();
    audio.setCodec("libmp3lame");
    audio.setBitRate(new Integer(128000));
    audio.setChannels(new Integer(2));
    audio.setSamplingRate(new Integer(44100));
    EncodingAttributes attrs = new EncodingAttributes();
    attrs.setFormat("mp3");
    attrs.setAudioAttributes(audio);
    Encoder encoder = new Encoder();
    try
    {
        encoder.encode(source, target, attrs); 
    }
    catch (IllegalArgumentException | EncoderException e)
    { 
    }

但是我收到以下错误:

Sep 26, 2016 11:28:29 AM it.sauronsoftware.jave.DefaultFFMPEGLocator copyFile
SEVERE: Could not get native library for ffmpeg-amd64.exe
Exception in thread "main" java.lang.RuntimeException: Cannot retrieve native file ffmpeg-amd64.exe
    at it.sauronsoftware.jave.DefaultFFMPEGLocator.copyFile(DefaultFFMPEGLocator.java:139)
    at it.sauronsoftware.jave.DefaultFFMPEGLocator.<init>(DefaultFFMPEGLocator.java:80)
    at it.sauronsoftware.jave.Encoder.<init>(Encoder.java:105)
    at Convert.main(Convert.java:29)

如何解决这个错误?请帮帮我 。

How can I solve this error ? Please help me .

推荐答案

错误很清楚:ffmpeg无法找到。

The error is very clear: ffmpeg cannot been found.

因为你硬编码一些Windows路径这里是ffmpeg的Windows二进制。我建议下载x64静态版本。因为这只是你需要关心的一个文件。

Since you hard coded some windows path here is the windows binary of ffmpeg. I suggest to download the x64 static version. Since that is just one file you need to care about.

如果您需要另一个平台,请检查下载网站

If you need it for another platform check the download site.

在子目录中的zip文件 bin 其中二进制 ffmpeg.exe 位于。现在,您需要将其重命名为 ffmpeg-amd64.exe ,因为库期望该名称。现在,您需要将文件复制到路径变量的目录中。 C:\windows\system32 。我建议不要使用该目录,但这是最简单的方法。更好地把它放在别的地方,修改你的路径变量。有几十个解释,所以只要谷歌他们,如果你想要如何做到这一点。

Within the zip file in the subdirectory bin where the binary ffmpeg.exe is located. Now you need to renamed it to ffmpeg-amd64.exe since the library expects that name. Now you need to copy the file to a directory of your path variable e.g. C:\windows\system32. I suggest not to use that directory, but this is the simplest way. Better put it somewhere else and modify your path variable. There are dozens of explanations so just google them if you want how do achieve that.

这篇关于无法检索本机文件ffmpeg-amd64.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆