音视频转码合成

1、android上录音AAC/MP3格式,未成功
https://github.com/turkeyzhu/AACEncoder_Android
2、通过mp4parser将AAC、h264、mp4格式合成MP4
https://code.google.com/p/mp4parser/(mp4parser源码)
https://github.com/sannies/mp4parser(使用mp4parser合成、转码MP4例子,该代码添加了其他东西,需要添加很多依赖库(主要是aspectjrt.jar),可以删减。
该isoviewer-1.0-RC-35.jar包将mp4parser和aspectjrt.jar合并在一起,很好用。
isoviewer-1.0-RC-35.jar资源==http://download.csdn.net/detail/smile3670/8174503
aspectjrt.jar == http://download.csdn.net/detail/smile3670/8174509
使用例子
public static void main(String[] args) throws FileNotFoundException, IOException {
		
        /*Movie m = new Movie();
        MP3TrackImpl mp3Track = new MP3TrackImpl(new FileDataSourceImpl("D:/tracks/test__mp3.mp3"));
        m.addTrack(mp3Track);
      	AACTrackImpl aacTrack = new AACTrackImpl(new FileDataSourceImpl("D:/tracks/aac-sample.aac"));
        m.addTrack(aacTrack);
		Container out = new DefaultMp4Builder().build(m);
		FileOutputStream fos = new FileOutputStream(new File(
				"D:/tracks/test__mp3.mp4"));
		FileChannel fc = fos.getChannel();
		out.writeContainer(fc);
		fos.close();*/
        
		// mp4音视频合成
		try {
			Movie countVideo = MovieCreator.build("D:/tracks/test__mp3.mp4");
			Movie countAudioEnglish = MovieCreator
					.build("D:/tracks/test_ount_out.mp4");
			Track audioTrackEnglish = countAudioEnglish.getTracks().get(0);
			countVideo.addTrack(audioTrackEnglish);
			Container out = new DefaultMp4Builder().build(countVideo);
			FileOutputStream fos = new FileOutputStream(new File(
					"D:/tracks/test_out______.mp4"));
			out.writeContainer(fos.getChannel());
			fos.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}


3、通过FFMPEG PCM、WAV转mp4。看代码是通过ffmpeg命令转码,ffmpeg支持转码,应该都可以实现,可先用命令试试资源。
库资源==http://download.csdn.net/detail/smile3670/8174611(里边的ffmpeg支持windows和linux)
File source = new File("D:/audio.wav");
		File target = new File("D:/result.mp4");
		AudioAttributes audio = new AudioAttributes();
		audio.setCodec(null);
		EncodingAttributes attrs = new EncodingAttributes();
		attrs.setFormat("mp4");
		attrs.setAudioAttributes(audio);
		Encoder encoder = new Encoder();
		try {
			encoder.encode(source, target, attrs);
		} catch (IllegalArgumentException e) {
			e.printStackTrace();
		} catch (InputFormatException e) {
			e.printStackTrace();
		} catch (EncoderException e) {
			e.printStackTrace();
		}


android编译的ffmpeg==http://download.csdn.net/detail/smile3670/8174669
WAV转AAC命令==ffmpeg -i aec_out.wav -strict -2 -b:a 32k -y abc.aac(代码实现可以参考ffmpeg支持windows和linux库源码)
4、录音MP3格式
通过lame实现,没有库源码,有android源码
源码==http://download.csdn.net/detail/smile3670/8174821
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 14
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值