linux下怎么使用 JAVE
public static String toMPTree(String sourcePath,String targetPath) throws IllegalArgumentException, InputFormatException, EncoderException{ File source = new File(sourcePath); File target = new File(targetPath); 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(); encoder.encode(source, target, attrs); return targetPath; }
我在windows下可以正常转MP3,可是在linux下转的MP3都是0字节,请问是要怎么弄呢?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
引用来自“得得”的答案
我用命令执行了一下,结果是这样,请帮忙分析一下
[root@im jave]# ./ffmpeg -i /www/html/tomcat/zybupload/temp/20120102101323.3gp -f mp3 -acodec libmp3lame /www/html/tomcat/zybupload/temp/20120102101323.mp3
FFmpeg version SVN-r11179, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --enable-gpl --enable-pp --enable-swscaler --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-memalign-hack --extra-ldflags=-static -lm -lz
libavutil version: 49.5.0
libavcodec version: 51.48.0
libavformat version: 52.1.0
built on Dec 7 2007 15:35:14, gcc: 4.1.2 20070626 (Red Hat 4.1.2-14)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/www/html/tomcat/zybupload/temp/20120102101323.3gp':
Duration: 00:00:17.8, start: 0.000000, bitrate: 6 kb/s
Stream #0.0(eng): Audio: samr / 0x726D6173, 8000 Hz, mono
Output #0, mp3, to '/www/html/tomcat/zybupload/temp/20120102101323.mp3':
Stream #0.0(eng): Audio: libmp3lame, 8000 Hz, mono, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Unsupported codec (id=73728) for input stream #0.0
http://www.oschina.net/p/jave
你们是来搞笑,卖萌的么?
J2ME ? 百度了才知道啊
我用命令执行了一下,结果是这样,请帮忙分析一下
[root@im jave]# ./ffmpeg -i /www/html/tomcat/zybupload/temp/20120102101323.3gp -f mp3 -acodec libmp3lame /www/html/tomcat/zybupload/temp/20120102101323.mp3
FFmpeg version SVN-r11179, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --enable-gpl --enable-pp --enable-swscaler --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-memalign-hack --extra-ldflags=-static -lm -lz
libavutil version: 49.5.0
libavcodec version: 51.48.0
libavformat version: 52.1.0
built on Dec 7 2007 15:35:14, gcc: 4.1.2 20070626 (Red Hat 4.1.2-14)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/www/html/tomcat/zybupload/temp/20120102101323.3gp':
Duration: 00:00:17.8, start: 0.000000, bitrate: 6 kb/s
Stream #0.0(eng): Audio: samr / 0x726D6173, 8000 Hz, mono
Output #0, mp3, to '/www/html/tomcat/zybupload/temp/20120102101323.mp3':
Stream #0.0(eng): Audio: libmp3lame, 8000 Hz, mono, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Unsupported codec (id=73728) for input stream #0.0
linux下注意路径和权限
是不是没有libmp3lame
哎,上面两位大哥,真不想评价你们,还新语言。我真鄙视你们。
新语言?kao,out了,没有用过