Loops

From Steak Wiki
Revision as of 06:13, 5 June 2020 by Adminguy (talk | contribs) (Created page with "This is a basic (bash) loop to operate on files. Examples are given for 7z and video conversion. <pre> #!/bin/bash -x #for i in *.webm; for i in *.7z do name=`echo $...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

This is a basic (bash) loop to operate on files.

Examples are given for 7z and video conversion.

#!/bin/bash -x
#for i in *.webm;
        for i in *.7z
 do name=`echo $i | cut -d'.' -f1`;
 echo $name;

#for h264
# ffmpeg -i $i -s 1280x720 -c:a copy $name.mp4;

#for webm

#-map_metadata -1 is to remove metadata, at least try to remove some. (need to verify)
#ffmpeg -i $i -map_metadata -1 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis $name.webm
7z e -o"$name" ./"$i" 
done

Basically, trim off extension of i, put into name. Use both for extractions/conversion.