我已经xuggle library在我的项目中用来对来自的视频进行转码mp4 to flv.我也用它slf4j libraries来支持日志记录结束.
import com.xuggle.mediatool.IMediaReader;
import com.xuggle.mediatool.IMediaViewer;
import com.xuggle.mediatool.IMediaWriter;
import com.xuggle.mediatool.ToolFactory;
public class TranscodingExample {
private static final String inputFilename = "E:\\VIDEO\\Facebook.mp4";
private static final String outputFilename = "E:\\VIDEO\\Facebook.flv";
public static void main(String[] args) {
// create a media reader
IMediaReader mediaReader =
ToolFactory.makeReader(inputFilename);
// create a media writer
IMediaWriter mediaWriter =
ToolFactory.makeWriter(outputFilename, mediaReader);
// add a writer to the reader, to create the output file
mediaReader.addListener(mediaWriter);
// create a media viewer with stats enabled
IMediaViewer mediaViewer = ToolFactory.makeViewer(true);
// add a viewer to the reader, to see the decoded media
mediaReader.addListener(mediaViewer);
// read and decode packets from the source file and
// and dispatch decoded audio and video to the writer
while (mediaReader.readPacket() == null) ;
}
}
Run Code Online (Sandbox Code Playgroud)
我在这里得到一个错误
"Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError.".
Run Code Online (Sandbox Code Playgroud)
我已将两个jar文件用作库以解决日志记录问题.有没有人遇到同样的问题.如果这样善意写出建议或解决方案来摆脱这个烂摊子.提前致谢.
Tom*_*nus 70
所以你必须排除冲突依赖.试试这个:
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
Run Code Online (Sandbox Code Playgroud)
这解决了slf4j和Dozer的相同问题.
| 归档时间: |
|
| 查看次数: |
91279 次 |
| 最近记录: |