Ffmpeg copy video and audio11/10/2023 ![]() ![]() If you need to swap out audio from an existing file with new audio, check the StackExchange article. ffmpeg -i video.mp4 -i audio.wav -c:v copy -c:a aac -b:a 128k -ar 48000 -ac 2 muxed.mp4 Of course, if you want to specify the bitrate (-b:a 128k), sample rate (-ar 48000), or channels (-ac 2, for stereo), you should specify the AAC codec (-c:a aac) as below. So, FFmpeg seems pretty error-tolerant with this command. ![]() Just for fun, I converted audio.mp3 into a wav file and tried this: ffmpeg -i video.mp4 -i audio.wav -c:v copy -c:a copy muxed.mp4Īs before, FFmpeg converted the WAV file to AAC and produced the muxed file. Interestingly, FFmpeg converted the MP3 audio to AAC and muxed the file without so much as an informational message. Then I tried this: ffmpeg -i video.mp4 -i audio.mp3 -c:v copy -c:a copy muxed.mp4 To explain, after designating the two input files, the script copies the existing video file as-is (c:v copy), converts the MP3 audio to aac (c:a aac), and muxes the two into muxed.mp4. ffmpeg -i video.mp4 -i audio.mp3 -c:v copy -c:a aac muxed.mp4 I tried the following command string which worked the first time.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |