문제

I have 2 files. Both are the same length (in seconds):

  1. a video file (H.264, .mov)
  2. an audio file (PCM, .wav)

How do I use the NAudio .NET library in my C# application to overwrite the audio of file #1 with the audio from file #2? I want to write the final result to disk as a new video file.

I believe this is possible using the Media Foundation capabilities of NAudio 1.7, but I can't figure out how to modify the audio stream of a video file and re-save the video.

도움이 되었습니까?

해결책

I'm afraid this is not possible with NAudio 1.7. NAudio has interop wrappers for a large percentage of the Media Foundation API, but the focus of the MediaFoundationReader and MediaFoundationEncoder classes is just on the audio. It should be possible with Media Foundation, so if you can find a C++ sample that does this with the MF API, you could recreate it in C# using the interop wrappers from NAudio. Alternatively you could try using a different managed Media Foundation library, such as Media Foundation .NET

다른 팁

You can use FFMPEG to do that. Call FFMPEG from c# and find the command to merge Video with Audio.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top