D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG]Shell Scripting question

 

Hi, all


I am trying to write a shell script to auto mate a task of stripping sound from some video files,  as I am fairly new to writing scripts I have so far found part of a solution


I have modified this 
#!/bin/bash
echo Create files listed in an array with the touch command
files=(
  # list of files to create
  "file1.txt"
  "file2.txt"
  "file3.txt"
)

# Loop to create each file
for filelist in "${files[@]}"; do
  touch "$filelist"
done

To include the target file names in the array

The following will strip from a single file

ffmpeg -i 20OCT5.mp4 -c copy -an 20OCT5-ns.mp4

So far I have modified so it applies the source file(s) listed in the array

ffmpeg -i $filelist -c copy -an 20OCT5-ns.mp4

I am not sure what to put in to tell the script to slightly modify the filename so the output file is modified for example

if the inputfile is
video.mp4 the output file with sound stripped is something like video-ns.mp4

Can anyone advise further please, it is probably fairly simple for someone with more shell scripting experience.


Thanks

Paul


-- 
The Mailing List for the Devon & Cornwall LUG
FAQ: https://www.dcglug.org.uk/faq/