FFmpeg合并MP4与WAV:如何保留原音频格式用于YouTube上传?
Ah, I see the issue here! Let's break down what's happening and fix it.
First, your original command isn't explicitly telling FFmpeg which streams to use in the output. By default, FFmpeg will pick the first video stream and first audio stream from the earliest input that has them. So if your video.mp4 already has an AAC audio track (which it looks like it does, given your output's AAC stream), FFmpeg is using that instead of the WAV file's PCM audio. That's why your output has AAC instead of the PCM you wanted.
To fix this, you need to use the -map option to explicitly select the video stream from your MP4 and the audio stream from your WAV file. Here's the corrected command:
ffmpeg -i video.mp4 -i audio.wav -map 0:v -map 1:a -c:v copy -c:a copy output.mov
Let me break down the key parts:
-map 0:v: Selects the video stream from the first input (video.mp4)-map 1:a: Selects the audio stream from the second input (audio.wav)-c:v copyand-c:a copy: Directly copies the streams without re-encoding, preserving the original quality of both video and audio.
If for some edge case the direct copy doesn't work (though MOV fully supports the pcm_s16le format from your WAV), you can explicitly specify the audio encoder to force PCM output:
ffmpeg -i video.mp4 -i audio.wav -map 0:v -map 1:a -c:v copy -c:a pcm_s16le output.mov
After running either command, check the output stream info again—you should see the PCM audio track matching your original WAV file's specs (pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s).
内容的提问来源于stack exchange,提问作者panosl

