replace audio track in a video file

ffmpeg -i orig_video.wmv -i new_audio.wav -vcodec copy -map 0.0 -map 1.0 new_video.wmv
The "map" may be different depending on the .wmv file. run `ffprobe` to see which is the video-track in the .wmv file usually this is "0.0". Stream #0.0: Video:... Stream #0.1: Audio: .. and "1.0" corresponds to the 2nd input file - your new audio. You may want to add "-acodec wmav2" and "-ar 128k" options for 128kbit/s Windows Media Audio 2 or whatever audio-codec/quality your want. `ffmpeg -codecs | grep "EA"` gives you a list of available codecs for Encoding Audio. Try using '-sameq' instead of '-vcodec copy' (re-encode the video with same quality rather than a bit-exact copy - this often solves muxing issues but will cause a small loss of either video quality or increased bandwidth). and also try a different output format eg. 'new_video.avi' or '' instead of 'new_video.wmv'. you may need both, this should work: ffmpeg -i vid.wmv -i aud.wav -sameq -map 0.0 -map 1.0 output.avi

By: lolssl
2015-10-02 12:56:27

What Others Think

Thanks for sharing this information about the steps to replace audio track in a video file. I have tried the information you have shared here and it was really working. CBD Laws Thanks a lot for the information you are provided here. Looking forward to more such helpful post
Kaitlyn · 24 weeks and 2 days ago
You have been doing a great job by sharing some of the important technical updates here. This will surely make a lot of readers to deal with the various errors and correct them without much help. Keep sharing more of them here. online music collaboration
milnerjames · 7 weeks and 3 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: