ffmpeg script to convert files - Programming On Unix

Users browsing this thread: 1 Guest(s)
movq
Long time nixers
You just add the other types to the `for` loop. :) And for removing, well, use `rm`.

Code:
#!/bin/bash
for i in *.mkv *.webm; do
    ffmpeg -i "$i" -codec copy "${i%.*}.mp4"
    rm "$i"
done

Stuff after the `in` in a `for` really is just a list. You could also do this:
Code:
for i in hello world, how are you today?
do
    echo "$i"
done

It’ll loop over the individual words. Globs like `*.webm` will be expanded before the iteration begins.


Messages In This Thread
ffmpeg script to convert files - by pfr - 15-03-2021, 12:22 AM
RE: ffmpeg script to convert files - by movq - 15-03-2021, 02:59 AM
RE: ffmpeg script to convert files - by s0kx - 15-03-2021, 03:00 AM
RE: ffmpeg script to convert files - by movq - 15-03-2021, 03:15 AM
RE: ffmpeg script to convert files - by pfr - 15-03-2021, 07:57 PM
RE: ffmpeg script to convert files - by ckester - 16-03-2021, 01:41 AM
RE: ffmpeg script to convert files - by pfr - 16-03-2021, 07:25 PM