Remove part of video only using command line (probably FFMPEG)
I have a 4 hour long .mp4 file and when I upload it to Youtube the entire audio track gets muted because of 30 seconds of some song between 01:21:47 and 01:22:24, how can I remove JUST this part of the video, or even better - just THIS part of the audio from the video?
ffmpeg
add a comment |
I have a 4 hour long .mp4 file and when I upload it to Youtube the entire audio track gets muted because of 30 seconds of some song between 01:21:47 and 01:22:24, how can I remove JUST this part of the video, or even better - just THIS part of the audio from the video?
ffmpeg
add a comment |
I have a 4 hour long .mp4 file and when I upload it to Youtube the entire audio track gets muted because of 30 seconds of some song between 01:21:47 and 01:22:24, how can I remove JUST this part of the video, or even better - just THIS part of the audio from the video?
ffmpeg
I have a 4 hour long .mp4 file and when I upload it to Youtube the entire audio track gets muted because of 30 seconds of some song between 01:21:47 and 01:22:24, how can I remove JUST this part of the video, or even better - just THIS part of the audio from the video?
ffmpeg
ffmpeg
edited Dec 19 '18 at 10:59
crmpicco
2003415
2003415
asked Sep 11 '16 at 5:15
CheronaCherona
2015
2015
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
If you are sure it's just that portion of the audio, then you can just mute it:
ffmpeg -i input.mp4 -af volume=0:enable='between(t,01:21:47,01:22:24)' -c:v copy output.mp4
Depending on your shell, you may have to escape the colons in the timecodes, or maybe switch to seconds representation (01:21:47 = 4907, 01:22:24 = 4944).
Hey thanks but here's what I came up with ffmpeg -i 88595331.mp4 -af volume=0:enable='between(t,4907,4944)' -c:v copy 88595331_v2.mp4 and the error i.imgur.com/aUogYcQ.png
– Cherona
Sep 11 '16 at 11:06
Try'between(t,4907,4944)'
– Gyan
Sep 11 '16 at 11:10
seems to be working, thanks!
– Cherona
Sep 11 '16 at 11:13
Instead of doing this right now, first I suggest uploading just a trimmed portion and testing:ffmpeg -ss 01:21:47 -t 38 input.mp4 test.mp4
– Gyan
Sep 11 '16 at 11:19
add a comment |
You can do this with an FFmpeg filtergraph.
Try something along these lines:
ffmpeg -i input.mp4 -filter_complex '[0:v] trim=end=01:21:47 [v1], [0:a] atrim=end=01:21:47 [a1], [0:v] trim=start=01:22:24 [v2], [0:a] atrim=start=01:22:24 [a2], [v1][a1][v2][a2] concat=n=2:v=1:a=1 [v][a]' -map '[v]' -map '[a]' output.mp4
This particular filtergraph slices the input into four pieces: the initial video segment, the initial audio segment, the final video segment, and the final audio segment. Then it concatenates the video and audio segments together.
See https://ffmpeg.org/ffmpeg-filters.html for more details on filtering.
1
Apart from the merits of re-encoding 4 hours of video just to mute a 30 second audio segment, this won't give the desired result because the concat filter requires all segments to have starting timestamps be0
. But the trim filters don't reset timestamps, sov2
anda2
will have non-zero timestamps and the concat filter won't behave predictably.
– Gyan
Sep 11 '16 at 7:16
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
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%2fsuperuser.com%2fquestions%2f1123160%2fremove-part-of-video-only-using-command-line-probably-ffmpeg%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
If you are sure it's just that portion of the audio, then you can just mute it:
ffmpeg -i input.mp4 -af volume=0:enable='between(t,01:21:47,01:22:24)' -c:v copy output.mp4
Depending on your shell, you may have to escape the colons in the timecodes, or maybe switch to seconds representation (01:21:47 = 4907, 01:22:24 = 4944).
Hey thanks but here's what I came up with ffmpeg -i 88595331.mp4 -af volume=0:enable='between(t,4907,4944)' -c:v copy 88595331_v2.mp4 and the error i.imgur.com/aUogYcQ.png
– Cherona
Sep 11 '16 at 11:06
Try'between(t,4907,4944)'
– Gyan
Sep 11 '16 at 11:10
seems to be working, thanks!
– Cherona
Sep 11 '16 at 11:13
Instead of doing this right now, first I suggest uploading just a trimmed portion and testing:ffmpeg -ss 01:21:47 -t 38 input.mp4 test.mp4
– Gyan
Sep 11 '16 at 11:19
add a comment |
If you are sure it's just that portion of the audio, then you can just mute it:
ffmpeg -i input.mp4 -af volume=0:enable='between(t,01:21:47,01:22:24)' -c:v copy output.mp4
Depending on your shell, you may have to escape the colons in the timecodes, or maybe switch to seconds representation (01:21:47 = 4907, 01:22:24 = 4944).
Hey thanks but here's what I came up with ffmpeg -i 88595331.mp4 -af volume=0:enable='between(t,4907,4944)' -c:v copy 88595331_v2.mp4 and the error i.imgur.com/aUogYcQ.png
– Cherona
Sep 11 '16 at 11:06
Try'between(t,4907,4944)'
– Gyan
Sep 11 '16 at 11:10
seems to be working, thanks!
– Cherona
Sep 11 '16 at 11:13
Instead of doing this right now, first I suggest uploading just a trimmed portion and testing:ffmpeg -ss 01:21:47 -t 38 input.mp4 test.mp4
– Gyan
Sep 11 '16 at 11:19
add a comment |
If you are sure it's just that portion of the audio, then you can just mute it:
ffmpeg -i input.mp4 -af volume=0:enable='between(t,01:21:47,01:22:24)' -c:v copy output.mp4
Depending on your shell, you may have to escape the colons in the timecodes, or maybe switch to seconds representation (01:21:47 = 4907, 01:22:24 = 4944).
If you are sure it's just that portion of the audio, then you can just mute it:
ffmpeg -i input.mp4 -af volume=0:enable='between(t,01:21:47,01:22:24)' -c:v copy output.mp4
Depending on your shell, you may have to escape the colons in the timecodes, or maybe switch to seconds representation (01:21:47 = 4907, 01:22:24 = 4944).
answered Sep 11 '16 at 7:04
GyanGyan
14.7k21845
14.7k21845
Hey thanks but here's what I came up with ffmpeg -i 88595331.mp4 -af volume=0:enable='between(t,4907,4944)' -c:v copy 88595331_v2.mp4 and the error i.imgur.com/aUogYcQ.png
– Cherona
Sep 11 '16 at 11:06
Try'between(t,4907,4944)'
– Gyan
Sep 11 '16 at 11:10
seems to be working, thanks!
– Cherona
Sep 11 '16 at 11:13
Instead of doing this right now, first I suggest uploading just a trimmed portion and testing:ffmpeg -ss 01:21:47 -t 38 input.mp4 test.mp4
– Gyan
Sep 11 '16 at 11:19
add a comment |
Hey thanks but here's what I came up with ffmpeg -i 88595331.mp4 -af volume=0:enable='between(t,4907,4944)' -c:v copy 88595331_v2.mp4 and the error i.imgur.com/aUogYcQ.png
– Cherona
Sep 11 '16 at 11:06
Try'between(t,4907,4944)'
– Gyan
Sep 11 '16 at 11:10
seems to be working, thanks!
– Cherona
Sep 11 '16 at 11:13
Instead of doing this right now, first I suggest uploading just a trimmed portion and testing:ffmpeg -ss 01:21:47 -t 38 input.mp4 test.mp4
– Gyan
Sep 11 '16 at 11:19
Hey thanks but here's what I came up with ffmpeg -i 88595331.mp4 -af volume=0:enable='between(t,4907,4944)' -c:v copy 88595331_v2.mp4 and the error i.imgur.com/aUogYcQ.png
– Cherona
Sep 11 '16 at 11:06
Hey thanks but here's what I came up with ffmpeg -i 88595331.mp4 -af volume=0:enable='between(t,4907,4944)' -c:v copy 88595331_v2.mp4 and the error i.imgur.com/aUogYcQ.png
– Cherona
Sep 11 '16 at 11:06
Try
'between(t,4907,4944)'
– Gyan
Sep 11 '16 at 11:10
Try
'between(t,4907,4944)'
– Gyan
Sep 11 '16 at 11:10
seems to be working, thanks!
– Cherona
Sep 11 '16 at 11:13
seems to be working, thanks!
– Cherona
Sep 11 '16 at 11:13
Instead of doing this right now, first I suggest uploading just a trimmed portion and testing:
ffmpeg -ss 01:21:47 -t 38 input.mp4 test.mp4
– Gyan
Sep 11 '16 at 11:19
Instead of doing this right now, first I suggest uploading just a trimmed portion and testing:
ffmpeg -ss 01:21:47 -t 38 input.mp4 test.mp4
– Gyan
Sep 11 '16 at 11:19
add a comment |
You can do this with an FFmpeg filtergraph.
Try something along these lines:
ffmpeg -i input.mp4 -filter_complex '[0:v] trim=end=01:21:47 [v1], [0:a] atrim=end=01:21:47 [a1], [0:v] trim=start=01:22:24 [v2], [0:a] atrim=start=01:22:24 [a2], [v1][a1][v2][a2] concat=n=2:v=1:a=1 [v][a]' -map '[v]' -map '[a]' output.mp4
This particular filtergraph slices the input into four pieces: the initial video segment, the initial audio segment, the final video segment, and the final audio segment. Then it concatenates the video and audio segments together.
See https://ffmpeg.org/ffmpeg-filters.html for more details on filtering.
1
Apart from the merits of re-encoding 4 hours of video just to mute a 30 second audio segment, this won't give the desired result because the concat filter requires all segments to have starting timestamps be0
. But the trim filters don't reset timestamps, sov2
anda2
will have non-zero timestamps and the concat filter won't behave predictably.
– Gyan
Sep 11 '16 at 7:16
add a comment |
You can do this with an FFmpeg filtergraph.
Try something along these lines:
ffmpeg -i input.mp4 -filter_complex '[0:v] trim=end=01:21:47 [v1], [0:a] atrim=end=01:21:47 [a1], [0:v] trim=start=01:22:24 [v2], [0:a] atrim=start=01:22:24 [a2], [v1][a1][v2][a2] concat=n=2:v=1:a=1 [v][a]' -map '[v]' -map '[a]' output.mp4
This particular filtergraph slices the input into four pieces: the initial video segment, the initial audio segment, the final video segment, and the final audio segment. Then it concatenates the video and audio segments together.
See https://ffmpeg.org/ffmpeg-filters.html for more details on filtering.
1
Apart from the merits of re-encoding 4 hours of video just to mute a 30 second audio segment, this won't give the desired result because the concat filter requires all segments to have starting timestamps be0
. But the trim filters don't reset timestamps, sov2
anda2
will have non-zero timestamps and the concat filter won't behave predictably.
– Gyan
Sep 11 '16 at 7:16
add a comment |
You can do this with an FFmpeg filtergraph.
Try something along these lines:
ffmpeg -i input.mp4 -filter_complex '[0:v] trim=end=01:21:47 [v1], [0:a] atrim=end=01:21:47 [a1], [0:v] trim=start=01:22:24 [v2], [0:a] atrim=start=01:22:24 [a2], [v1][a1][v2][a2] concat=n=2:v=1:a=1 [v][a]' -map '[v]' -map '[a]' output.mp4
This particular filtergraph slices the input into four pieces: the initial video segment, the initial audio segment, the final video segment, and the final audio segment. Then it concatenates the video and audio segments together.
See https://ffmpeg.org/ffmpeg-filters.html for more details on filtering.
You can do this with an FFmpeg filtergraph.
Try something along these lines:
ffmpeg -i input.mp4 -filter_complex '[0:v] trim=end=01:21:47 [v1], [0:a] atrim=end=01:21:47 [a1], [0:v] trim=start=01:22:24 [v2], [0:a] atrim=start=01:22:24 [a2], [v1][a1][v2][a2] concat=n=2:v=1:a=1 [v][a]' -map '[v]' -map '[a]' output.mp4
This particular filtergraph slices the input into four pieces: the initial video segment, the initial audio segment, the final video segment, and the final audio segment. Then it concatenates the video and audio segments together.
See https://ffmpeg.org/ffmpeg-filters.html for more details on filtering.
answered Sep 11 '16 at 5:23
Leo IzenLeo Izen
12918
12918
1
Apart from the merits of re-encoding 4 hours of video just to mute a 30 second audio segment, this won't give the desired result because the concat filter requires all segments to have starting timestamps be0
. But the trim filters don't reset timestamps, sov2
anda2
will have non-zero timestamps and the concat filter won't behave predictably.
– Gyan
Sep 11 '16 at 7:16
add a comment |
1
Apart from the merits of re-encoding 4 hours of video just to mute a 30 second audio segment, this won't give the desired result because the concat filter requires all segments to have starting timestamps be0
. But the trim filters don't reset timestamps, sov2
anda2
will have non-zero timestamps and the concat filter won't behave predictably.
– Gyan
Sep 11 '16 at 7:16
1
1
Apart from the merits of re-encoding 4 hours of video just to mute a 30 second audio segment, this won't give the desired result because the concat filter requires all segments to have starting timestamps be
0
. But the trim filters don't reset timestamps, so v2
and a2
will have non-zero timestamps and the concat filter won't behave predictably.– Gyan
Sep 11 '16 at 7:16
Apart from the merits of re-encoding 4 hours of video just to mute a 30 second audio segment, this won't give the desired result because the concat filter requires all segments to have starting timestamps be
0
. But the trim filters don't reset timestamps, so v2
and a2
will have non-zero timestamps and the concat filter won't behave predictably.– Gyan
Sep 11 '16 at 7:16
add a comment |
Thanks for contributing an answer to Super User!
- 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%2fsuperuser.com%2fquestions%2f1123160%2fremove-part-of-video-only-using-command-line-probably-ffmpeg%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