Apply command on all files in a folder
up vote
-1
down vote
favorite
I have a folder full of videos which all have 2 audio tracks and I want to remove the first one from each of them.
So I need to run:
ffmpeg -i [filename] -map 0:0 -map 0:2 -acodec copy -vcodec copy temp.mp4
mv temp.mp4 [filename]
on every file in that folder.
shell-script
add a comment |
up vote
-1
down vote
favorite
I have a folder full of videos which all have 2 audio tracks and I want to remove the first one from each of them.
So I need to run:
ffmpeg -i [filename] -map 0:0 -map 0:2 -acodec copy -vcodec copy temp.mp4
mv temp.mp4 [filename]
on every file in that folder.
shell-script
What have you tried so far? The thing you are looking for is calledfor loop
in bash.
– Fiximan
Oct 26 '16 at 12:12
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I have a folder full of videos which all have 2 audio tracks and I want to remove the first one from each of them.
So I need to run:
ffmpeg -i [filename] -map 0:0 -map 0:2 -acodec copy -vcodec copy temp.mp4
mv temp.mp4 [filename]
on every file in that folder.
shell-script
I have a folder full of videos which all have 2 audio tracks and I want to remove the first one from each of them.
So I need to run:
ffmpeg -i [filename] -map 0:0 -map 0:2 -acodec copy -vcodec copy temp.mp4
mv temp.mp4 [filename]
on every file in that folder.
shell-script
shell-script
edited 2 days ago
Rui F Ribeiro
38.2k1475125
38.2k1475125
asked Oct 26 '16 at 11:36
Ginso
1
1
What have you tried so far? The thing you are looking for is calledfor loop
in bash.
– Fiximan
Oct 26 '16 at 12:12
add a comment |
What have you tried so far? The thing you are looking for is calledfor loop
in bash.
– Fiximan
Oct 26 '16 at 12:12
What have you tried so far? The thing you are looking for is called
for loop
in bash.– Fiximan
Oct 26 '16 at 12:12
What have you tried so far? The thing you are looking for is called
for loop
in bash.– Fiximan
Oct 26 '16 at 12:12
add a comment |
3 Answers
3
active
oldest
votes
up vote
3
down vote
find . -type f
-exec ffmpeg -i '{}' -map 0:0 -map 0:2 -acodec copy -vcodec copy temp.mp4 ;
-exec mv temp.mp4 '{}' ;`
1
Themv
is not going to work as you have it.
– Patrick
Oct 26 '16 at 12:21
Corrected. It should work now.
– mtahmed
Oct 26 '16 at 13:05
add a comment |
up vote
1
down vote
I would use find
with -exec
:
find . -type f -name "*.mp4" -exec ffmpeg -i {} -map 0:0 -map 0:2 -acodec copy -vcodec copy {} ;
But a ls -1 *.mp4 | ffmpeg
also works fine.
add a comment |
up vote
0
down vote
for file in $(ls)
do
#whatever you want to do with "${file}"
done
2
Careful with that --touch "a b"
– Jeff Schaller
Oct 27 '16 at 12:30
Oh... Quotation mark added (if that's what you mean).
– corsel
Oct 27 '16 at 12:34
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
find . -type f
-exec ffmpeg -i '{}' -map 0:0 -map 0:2 -acodec copy -vcodec copy temp.mp4 ;
-exec mv temp.mp4 '{}' ;`
1
Themv
is not going to work as you have it.
– Patrick
Oct 26 '16 at 12:21
Corrected. It should work now.
– mtahmed
Oct 26 '16 at 13:05
add a comment |
up vote
3
down vote
find . -type f
-exec ffmpeg -i '{}' -map 0:0 -map 0:2 -acodec copy -vcodec copy temp.mp4 ;
-exec mv temp.mp4 '{}' ;`
1
Themv
is not going to work as you have it.
– Patrick
Oct 26 '16 at 12:21
Corrected. It should work now.
– mtahmed
Oct 26 '16 at 13:05
add a comment |
up vote
3
down vote
up vote
3
down vote
find . -type f
-exec ffmpeg -i '{}' -map 0:0 -map 0:2 -acodec copy -vcodec copy temp.mp4 ;
-exec mv temp.mp4 '{}' ;`
find . -type f
-exec ffmpeg -i '{}' -map 0:0 -map 0:2 -acodec copy -vcodec copy temp.mp4 ;
-exec mv temp.mp4 '{}' ;`
edited Oct 26 '16 at 13:16
Stéphane Chazelas
294k54554897
294k54554897
answered Oct 26 '16 at 11:42
mtahmed
1,301108
1,301108
1
Themv
is not going to work as you have it.
– Patrick
Oct 26 '16 at 12:21
Corrected. It should work now.
– mtahmed
Oct 26 '16 at 13:05
add a comment |
1
Themv
is not going to work as you have it.
– Patrick
Oct 26 '16 at 12:21
Corrected. It should work now.
– mtahmed
Oct 26 '16 at 13:05
1
1
The
mv
is not going to work as you have it.– Patrick
Oct 26 '16 at 12:21
The
mv
is not going to work as you have it.– Patrick
Oct 26 '16 at 12:21
Corrected. It should work now.
– mtahmed
Oct 26 '16 at 13:05
Corrected. It should work now.
– mtahmed
Oct 26 '16 at 13:05
add a comment |
up vote
1
down vote
I would use find
with -exec
:
find . -type f -name "*.mp4" -exec ffmpeg -i {} -map 0:0 -map 0:2 -acodec copy -vcodec copy {} ;
But a ls -1 *.mp4 | ffmpeg
also works fine.
add a comment |
up vote
1
down vote
I would use find
with -exec
:
find . -type f -name "*.mp4" -exec ffmpeg -i {} -map 0:0 -map 0:2 -acodec copy -vcodec copy {} ;
But a ls -1 *.mp4 | ffmpeg
also works fine.
add a comment |
up vote
1
down vote
up vote
1
down vote
I would use find
with -exec
:
find . -type f -name "*.mp4" -exec ffmpeg -i {} -map 0:0 -map 0:2 -acodec copy -vcodec copy {} ;
But a ls -1 *.mp4 | ffmpeg
also works fine.
I would use find
with -exec
:
find . -type f -name "*.mp4" -exec ffmpeg -i {} -map 0:0 -map 0:2 -acodec copy -vcodec copy {} ;
But a ls -1 *.mp4 | ffmpeg
also works fine.
edited Oct 26 '16 at 12:16
answered Oct 26 '16 at 11:41
Willian Paixao
1,48211029
1,48211029
add a comment |
add a comment |
up vote
0
down vote
for file in $(ls)
do
#whatever you want to do with "${file}"
done
2
Careful with that --touch "a b"
– Jeff Schaller
Oct 27 '16 at 12:30
Oh... Quotation mark added (if that's what you mean).
– corsel
Oct 27 '16 at 12:34
add a comment |
up vote
0
down vote
for file in $(ls)
do
#whatever you want to do with "${file}"
done
2
Careful with that --touch "a b"
– Jeff Schaller
Oct 27 '16 at 12:30
Oh... Quotation mark added (if that's what you mean).
– corsel
Oct 27 '16 at 12:34
add a comment |
up vote
0
down vote
up vote
0
down vote
for file in $(ls)
do
#whatever you want to do with "${file}"
done
for file in $(ls)
do
#whatever you want to do with "${file}"
done
edited Oct 27 '16 at 12:33
answered Oct 27 '16 at 11:18
corsel
787
787
2
Careful with that --touch "a b"
– Jeff Schaller
Oct 27 '16 at 12:30
Oh... Quotation mark added (if that's what you mean).
– corsel
Oct 27 '16 at 12:34
add a comment |
2
Careful with that --touch "a b"
– Jeff Schaller
Oct 27 '16 at 12:30
Oh... Quotation mark added (if that's what you mean).
– corsel
Oct 27 '16 at 12:34
2
2
Careful with that --
touch "a b"
– Jeff Schaller
Oct 27 '16 at 12:30
Careful with that --
touch "a b"
– Jeff Schaller
Oct 27 '16 at 12:30
Oh... Quotation mark added (if that's what you mean).
– corsel
Oct 27 '16 at 12:34
Oh... Quotation mark added (if that's what you mean).
– corsel
Oct 27 '16 at 12:34
add a comment |
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%2funix.stackexchange.com%2fquestions%2f319047%2fapply-command-on-all-files-in-a-folder%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
What have you tried so far? The thing you are looking for is called
for loop
in bash.– Fiximan
Oct 26 '16 at 12:12