-
大小: 15.04MB文件類型: .rar金幣: 1下載: 0 次發(fā)布日期: 2023-07-16
- 語言: Java
- 標(biāo)簽: Jave??ffmpeg??wav轉(zhuǎn)mp3??
資源簡介
jave-1.0.2.2.jar完全解決如下問題:
1、報錯:it.sauronsoftware.jave.EncoderException: Metadata:
2、可以轉(zhuǎn)換,可以播放,但是有個異常:it.sauronsoftware.jave.EncoderException: video:0kB audio:1301kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.019516%
通過解讀源碼,在windows下ok,而在linux下解析格式有所不同才導(dǎo)致上面的各種異常,最終修改了源碼包中的Encoder.java,整合ffmpeg-2.7.2-x64版本
參考文獻(xiàn):
1、jave-1.0.2源碼下載地址:http://www.sauronsoftware.it/projects/jave/download.php
2、ffmpeg下載地址:http://johnvansickle.com/ffmpeg/
3、林杰博客說明:http://linjie.org/2015/08/06/amr%E6%A0%BC%E5%BC%8F%E8%BD%ACmp3%E6%A0%BC%E5%BC%8F-%E5%AE%8C%E7%BE%8E%E8%A7%A3%E5%86%B3Linux%E4%B8%8B%E8%BD%AC%E6%8D%A20K%E9%97%AE%E9%A2%98/
代碼片段和文件信息
/*
?*?JAVE?-?A?Java?Audio/Video?Encoder?(based?on?FFMPEG)
?*?
?*?Copyright?(C)?2008-2009?Carlo?Pelliccia?(www.sauronsoftware.it)
?*?
?*?This?program?is?free?software:?you?can?redistribute?it?and/or?modify
?*?it?under?the?terms?of?the?GNU?General?Public?License?as?published?by
?*?the?Free?Software?Foundation?either?version?3?of?the?License?or
?*?(at?your?option)?any?later?version.
?*
?*?This?program?is?distributed?in?the?hope?that?it?will?be?useful
?*?but?WITHOUT?ANY?WARRANTY;?without?even?the?implied?warranty?of
?*?MERCHANTABILITY?or?FITNESS?FOR?A?PARTICULAR?PURPOSE.??See?the
?*?GNU?General?Public?License?for?more?details.
?*
?*?You?should?have?received?a?copy?of?the?GNU?General?Public?License
?*?along?with?this?program.??If?not?see? .
?*/
package?it.sauronsoftware.jave;
import?java.io.File;
import?java.io.IOException;
import?java.io.InputStreamReader;
import?java.util.ArrayList;
import?java.util.Hashtable;
import?java.util.StringTokenizer;
import?java.util.regex.Matcher;
import?java.util.regex.Pattern;
/**
?*?Main?class?of?the?package.?Instances?can?encode?audio?and?video?streams.
?*?
?*?@author?Carlo?Pelliccia
?*/
public?class?Encoder?{
/**
?*?This?regexp?is?used?to?parse?the?ffmpeg?output?about?the?supported
?*?formats.
?*/
private?static?final?Pattern?FORMAT_PATTERN?=?Pattern
.compile(“^\\s*([D?])([E?])\\s+([\\w]+)\\s+.+$“);
/**
?*?This?regexp?is?used?to?parse?the?ffmpeg?output?about?the?included
?*?encoders/decoders.
?*/
private?static?final?Pattern?ENCODER_DECODER_PATTERN?=?Pattern.compile(
“^\\s*([D?])([E?])([AVS]).{3}\\s+(.+)$“?Pattern.CASE_INSENSITIVE);
/**
?*?This?regexp?is?used?to?parse?the?ffmpeg?output?about?the?ongoing?encoding
?*?process.
?*/
private?static?final?Pattern?PROGRESS_INFO_PATTERN?=?Pattern.compile(
“\\s*(\\w+)\\s*=\\s*(\\S+)\\s*“?Pattern.CASE_INSENSITIVE);
/**
?*?This?regexp?is?used?to?parse?the?ffmpeg?output?about?the?size?of?a?video
?*?stream.
?*/
private?static?final?Pattern?SIZE_PATTERN?=?Pattern.compile(
“(\\d+)x(\\d+)“?Pattern.CASE_INSENSITIVE);
/**
?*?This?regexp?is?used?to?parse?the?ffmpeg?output?about?the?frame?rate?value
?*?of?a?video?stream.
?*/
private?static?final?Pattern?frame_RATE_PATTERN?=?Pattern.compile(
“([\\d.]+)\\s+(?:fps|tb\\(r\\))“?Pattern.CASE_INSENSITIVE);
/**
?*?This?regexp?is?used?to?parse?the?ffmpeg?output?about?the?bit?rate?value
?*?of?a?stream.
?*/
private?static?final?Pattern?BIT_RATE_PATTERN?=?Pattern.compile(
“(\\d+)\\s+kb/s“?Pattern.CASE_INSENSITIVE);
/**
?*?This?regexp?is?used?to?parse?the?ffmpeg?output?about?the?sampling?rate?of
?*?an?audio?stream.
?*/
private?static?final?Pattern?SAMPLING_RATE_PATTERN?=?Pattern.compile(
“(\\d+)\\s+Hz“?Pattern.CASE_INSENSITIVE);
/**
?*?This?regexp?is?used?to?parse?the?ffmpeg?output?about?the?channels?number
?*?of?an?audio?stream.
?*/
private?static?final
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????30158??2016-01-06?16:36??Encoder.java
?????文件???15779513??2016-01-06?16:54??jave-1.0.2.2.jar
-----------?---------??----------?-----??----
?????????????15809671????????????????????2
評論
共有 條評論