Babu
Babu

Reputation: 442

How to combine a .MP4 video with a .WAV audio to create a new .MP4 video using ffmpeg from command line arguments?

I want to merge a .WAV audio file with a .MP4 video file to create a new .MP4 video file.

And i am currently using the following codes to do that :

ffmpeg -i input_vid.mp4 -i input_audio.wav -vcodec copy -acodec copy output.mp4

But it is only creating output.mp4 file but no videos embedded with that means if i am playing that output.mp4 file then nothing is playing. And i don't know where i am doing wrong so that it is creating like this.

I know this type of questions already asked by may persons but that didn't help me much so if anybody can find where i am doing wrong or how to solve this problem please help me to solve my problem.

Upvotes: 4

Views: 6997

Answers (1)

VC.One
VC.One

Reputation: 15881

Remove -acodec copy. That option forces a direct copy of the WAV bytes into MP4's audio track.

A valid audio MP4 must contain an MPEG audio track (mp3 or aac). Once you remove -acodec copy then FFmpeg will still copy the video (picture) part but also automatically encode from WAV to AAC for you. AAC is the standar audio codec inside MP4 files (can add MP3 too since all 3 formats are compatible MPEG files).

Upvotes: 4

Related Questions