mmpeg转码

用例1:设置播放速率
ffmpeg -i input.avi -b:v 64k -bufsize 64k output.avi
To set the video bitrate of the output file to 64kbit/s


用例2:强制文件播放帧速
To force the frame rate of the output file to 24 fps
用例3:amr转MP3
ffmpeg -i a.arm  -f mp3 -ar 11025  b.mp3


用例4:wav转mpg
ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg

用例4:
ffmpeg -i input.flac -id3v2_version 3 out.mp3

一段java的调用代码:

‘-f fmt (input/output)’

    public boolean armToMp3(String soundUrl){
       // ProcessBuilder builder = new ProcessBuilder();
    	String  armName = soundUrl.substring(soundUrl.lastIndexOf("/") + 1);
    	String path = soundUrl.replace(armName, "");
    	String name = armName.substring(0, armName.lastIndexOf(".") + 1); 
    //	String command = binDir + "ffmpeg -i " + soundUrl  +   "  -strict experimental -f wav -ar 11025 " + path + name + FORMAT;
    	String command = binDir + "ffmpeg -i " + soundUrl  +   "  -strict experimental -f mp3 -ar 11025 " + path + name + FORMAT;

    	log.debug("command...." + command);
    	//builder.command(command);
    	try{
	    Runtime.getRuntime().exec(command);
    	}catch(Exception e){
    		
    	}
    	return true;
    }

 linux安装ffmpeg需要安装转码库:第三方库是libmp3lame

安装方法见:

http://bbs.189works.com/thread-44808-1-1.html

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值