防爆pression恩codeR SDK - 如何在视频中添加音频轨道 [英] Expression Encoder SDK - How to add audio track on a video

查看:214
本文介绍了防爆pression恩codeR SDK - 如何在视频中添加音频轨道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以利用这方面的一些帮助。我想覆盖的audio.mp3文件(或任何其他形式的这个问题)上的视频。

I could use some help on this. I'd like to overlay an audio.mp3 file (or any other format for that matter) onto a video.

我使用的防爆pression恩codeR 4免费的版本,所以我所有的视频​​输出WMV。事情是,我不知道如何将音频文件添加到视频MediaItem。我想这样的事情,但它并没有对结果添加音频:

I'm using the free version of Expression Encoder 4, and so all my video outputs are wmv. Thing is, I don't know how to add an audio file to the video MediaItem. I tried something like this, but it didn't add the audio on the result:

MediaItem videoTrack = new MediaItem(@"path\to\videofile.wmv");
videoTrack.OutputFormat = new WindowsMediaOutputFormat();
videoTrack.OutputFormat.VideoProfile = new AdvancedVC1VideoProfile();
MediaItem audioTrack = new MediaItem(@"path\to\audio.mp3");
videoTrack.OutputFormat.AudioProfile = audioTrack.SourceAudioProfile;
job.MediaItems.Add(videoTrack);
job.Encode();

当没有工作(也许是因为单独一个轮廓就是元数据,而不是音频文件本身),然后我试图覆盖音频I将覆盖图像到视频的方式,通过这样做:

And when that didn't work (perhaps because a profile alone is just metadata, and not the audio file itself), then I tried to overlay the audio the way I would overlay an image onto the video, by doing this:

MediaItem videoTrack = new MediaItem(@"path\to\videofile.wmv");
string overlayFilename = @"path\to\audio.mp3";
videoTrack.OverlayFileName = overlayFilename;
job.MediaItems.Add(videoTrack);
job.Encode();

这也失败,出现错误这个时候说,覆盖项目需要有视频流或东西(我猜的内胚层codeR预计覆盖是一个视频文件)。一些帮助将不胜AP preciated。这真的不应该是这个困难的强大的产品,如内胚层codeR 4。

This failed too, with an error this time saying that the overlay item needs to have video stream or something (I guess ExEncoder expected that overlay to be a video file). Some help would be greatly appreciated. This really shouldn't be this difficult for a powerful product like ExEncoder 4.

推荐答案

MediaItem也有一个属性叫AudioOverlayFileName - !你应该设置一个,如果你想只覆盖音频

MediaItem Also has a property Called AudioOverlayFileName - you should set that one if you want to overlay only audio!

这篇关于防爆pression恩codeR SDK - 如何在视频中添加音频轨道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆