-1

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.

  • 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
3
find . -type f \
       -exec ffmpeg -i '{}' -map 0:0 -map 0:2 -acodec copy -vcodec copy temp.mp4 \; \
       -exec mv temp.mp4 '{}' \;`
  • 1
    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
1

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.

1
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.