Replace audio stream from one file with audio stream from another
I have got two video files: .mp4, with a single (incorrect) audiostream, and an .mkv, with two audio streams (one incorrect, the other correct)
Is there a way to replace the audio of the .mp4 file with the second stream in the .mkv?
Thanks
sound video conversion
add a comment |
I have got two video files: .mp4, with a single (incorrect) audiostream, and an .mkv, with two audio streams (one incorrect, the other correct)
Is there a way to replace the audio of the .mp4 file with the second stream in the .mkv?
Thanks
sound video conversion
add a comment |
I have got two video files: .mp4, with a single (incorrect) audiostream, and an .mkv, with two audio streams (one incorrect, the other correct)
Is there a way to replace the audio of the .mp4 file with the second stream in the .mkv?
Thanks
sound video conversion
I have got two video files: .mp4, with a single (incorrect) audiostream, and an .mkv, with two audio streams (one incorrect, the other correct)
Is there a way to replace the audio of the .mp4 file with the second stream in the .mkv?
Thanks
sound video conversion
sound video conversion
asked Aug 10 '11 at 22:53
CookieMonsterCookieMonster
16025
16025
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You'd need to extract the audio from the MKV first and then combine remux the MP4 with the new track. Something like this should work:
ffmpeg -i vid.mkv -acodec copy -vn audio.ext
ffmpeg -i vid.mp4 -i audio.ext -vcodec copy -acodec copy -map 0:1 -map 1:0 final.mp4
Hey, I extracted the audio properly usingffmpeg -i vid.mkv -map 0:2 -ac 2 aud.wavbut still can't merge it with the mp4 file for some reason...
– CookieMonster
Aug 11 '11 at 11:37
Hi @CookieMonster. How was this resolved?
– frank
Apr 29 '18 at 2:40
add a comment |
Sure, with avconv (same as ffmpeg)
Try:
avconv -i INPUT_FILE_WITH_BROKEN_SOUND.mp4 -i SECOND_INPUT_FILE.mkv -c copy -map 0:v:0 -map 1:a:1 OUTPUT.mp4
-c copy copies tracks instead of re-encoding them
-map 0:v:0 selects track to be copied to output: 1st file -> video tracks -> 1st video track
-map 1:a:1 selects track to be copied to output: 2nd file -> audio tracks -> 2nd audio track
Hope it helps!
Could down-voter tell why it is wrong?
– Mr. P
Oct 20 '15 at 11:46
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f56638%2freplace-audio-stream-from-one-file-with-audio-stream-from-another%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You'd need to extract the audio from the MKV first and then combine remux the MP4 with the new track. Something like this should work:
ffmpeg -i vid.mkv -acodec copy -vn audio.ext
ffmpeg -i vid.mp4 -i audio.ext -vcodec copy -acodec copy -map 0:1 -map 1:0 final.mp4
Hey, I extracted the audio properly usingffmpeg -i vid.mkv -map 0:2 -ac 2 aud.wavbut still can't merge it with the mp4 file for some reason...
– CookieMonster
Aug 11 '11 at 11:37
Hi @CookieMonster. How was this resolved?
– frank
Apr 29 '18 at 2:40
add a comment |
You'd need to extract the audio from the MKV first and then combine remux the MP4 with the new track. Something like this should work:
ffmpeg -i vid.mkv -acodec copy -vn audio.ext
ffmpeg -i vid.mp4 -i audio.ext -vcodec copy -acodec copy -map 0:1 -map 1:0 final.mp4
Hey, I extracted the audio properly usingffmpeg -i vid.mkv -map 0:2 -ac 2 aud.wavbut still can't merge it with the mp4 file for some reason...
– CookieMonster
Aug 11 '11 at 11:37
Hi @CookieMonster. How was this resolved?
– frank
Apr 29 '18 at 2:40
add a comment |
You'd need to extract the audio from the MKV first and then combine remux the MP4 with the new track. Something like this should work:
ffmpeg -i vid.mkv -acodec copy -vn audio.ext
ffmpeg -i vid.mp4 -i audio.ext -vcodec copy -acodec copy -map 0:1 -map 1:0 final.mp4
You'd need to extract the audio from the MKV first and then combine remux the MP4 with the new track. Something like this should work:
ffmpeg -i vid.mkv -acodec copy -vn audio.ext
ffmpeg -i vid.mp4 -i audio.ext -vcodec copy -acodec copy -map 0:1 -map 1:0 final.mp4
answered Aug 10 '11 at 23:02
Oli♦Oli
221k86561763
221k86561763
Hey, I extracted the audio properly usingffmpeg -i vid.mkv -map 0:2 -ac 2 aud.wavbut still can't merge it with the mp4 file for some reason...
– CookieMonster
Aug 11 '11 at 11:37
Hi @CookieMonster. How was this resolved?
– frank
Apr 29 '18 at 2:40
add a comment |
Hey, I extracted the audio properly usingffmpeg -i vid.mkv -map 0:2 -ac 2 aud.wavbut still can't merge it with the mp4 file for some reason...
– CookieMonster
Aug 11 '11 at 11:37
Hi @CookieMonster. How was this resolved?
– frank
Apr 29 '18 at 2:40
Hey, I extracted the audio properly using
ffmpeg -i vid.mkv -map 0:2 -ac 2 aud.wav but still can't merge it with the mp4 file for some reason...– CookieMonster
Aug 11 '11 at 11:37
Hey, I extracted the audio properly using
ffmpeg -i vid.mkv -map 0:2 -ac 2 aud.wav but still can't merge it with the mp4 file for some reason...– CookieMonster
Aug 11 '11 at 11:37
Hi @CookieMonster. How was this resolved?
– frank
Apr 29 '18 at 2:40
Hi @CookieMonster. How was this resolved?
– frank
Apr 29 '18 at 2:40
add a comment |
Sure, with avconv (same as ffmpeg)
Try:
avconv -i INPUT_FILE_WITH_BROKEN_SOUND.mp4 -i SECOND_INPUT_FILE.mkv -c copy -map 0:v:0 -map 1:a:1 OUTPUT.mp4
-c copy copies tracks instead of re-encoding them
-map 0:v:0 selects track to be copied to output: 1st file -> video tracks -> 1st video track
-map 1:a:1 selects track to be copied to output: 2nd file -> audio tracks -> 2nd audio track
Hope it helps!
Could down-voter tell why it is wrong?
– Mr. P
Oct 20 '15 at 11:46
add a comment |
Sure, with avconv (same as ffmpeg)
Try:
avconv -i INPUT_FILE_WITH_BROKEN_SOUND.mp4 -i SECOND_INPUT_FILE.mkv -c copy -map 0:v:0 -map 1:a:1 OUTPUT.mp4
-c copy copies tracks instead of re-encoding them
-map 0:v:0 selects track to be copied to output: 1st file -> video tracks -> 1st video track
-map 1:a:1 selects track to be copied to output: 2nd file -> audio tracks -> 2nd audio track
Hope it helps!
Could down-voter tell why it is wrong?
– Mr. P
Oct 20 '15 at 11:46
add a comment |
Sure, with avconv (same as ffmpeg)
Try:
avconv -i INPUT_FILE_WITH_BROKEN_SOUND.mp4 -i SECOND_INPUT_FILE.mkv -c copy -map 0:v:0 -map 1:a:1 OUTPUT.mp4
-c copy copies tracks instead of re-encoding them
-map 0:v:0 selects track to be copied to output: 1st file -> video tracks -> 1st video track
-map 1:a:1 selects track to be copied to output: 2nd file -> audio tracks -> 2nd audio track
Hope it helps!
Sure, with avconv (same as ffmpeg)
Try:
avconv -i INPUT_FILE_WITH_BROKEN_SOUND.mp4 -i SECOND_INPUT_FILE.mkv -c copy -map 0:v:0 -map 1:a:1 OUTPUT.mp4
-c copy copies tracks instead of re-encoding them
-map 0:v:0 selects track to be copied to output: 1st file -> video tracks -> 1st video track
-map 1:a:1 selects track to be copied to output: 2nd file -> audio tracks -> 2nd audio track
Hope it helps!
edited Jan 12 at 16:31
answered Sep 22 '15 at 11:08
Mr. PMr. P
1305
1305
Could down-voter tell why it is wrong?
– Mr. P
Oct 20 '15 at 11:46
add a comment |
Could down-voter tell why it is wrong?
– Mr. P
Oct 20 '15 at 11:46
Could down-voter tell why it is wrong?
– Mr. P
Oct 20 '15 at 11:46
Could down-voter tell why it is wrong?
– Mr. P
Oct 20 '15 at 11:46
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f56638%2freplace-audio-stream-from-one-file-with-audio-stream-from-another%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown