Hi, I would like to remove audio tracks from several video clips contained in a single directory using the command
files=(*.mpg); ffmpeg -i "${files[@]}" -vcodec copy -an na/output.mpg
I want each processed file outputted to the sub-directory na retaining the original file name, how do I do that? Thank you for reading.
Did not test this, but...
ls *mpg | while read a ; do ffmeg -i ${a} -vcodec copy -an na/${a} ; done
Or try:
for f in *.mpg
do
if [ -f "$f" ]; then
ffmpeg -i "./$f" -vcodec copy -an "na/$f"
fi
done
Thank you, the for loop did the trick! Why do I need the test command?
The while loop produced some strange results. It only processed half the files and gave read/write permissions for output files to root (?)
And, just curious, what is the difference between
while read a; do command $a; done
and
while read a; do command ${a}; done
?
You are welcome.. It is there so that if there are no files present there will not be an error message ( in that case $f would get the value "*.mpg" ). The ./ is there to make sure that in case there are file names that start with a minus sign for example, that these cannot be interpreted as a command line option...
[..]And, just curious, what is the difference between
while read a; do command $a; done
and
while read a; do command ${a}; done
?
There is no difference in this case...