view the rest of the comments
Linux Troubleshooting and scripts
this is a community for sharing your scripts that help when working with Linux as well a general troubleshooting.
Rules
-
Absolutely NO NSFW posts. break this rule and you will be removed from this community. NO EXCEPTIONS!
-
Only post scripts that help yourself and others. All scripts will be tested on my machine personally, any malicious scripts will be removed immediately.
-
This community is for the benefit of other Linux users. no bigotry, hate, nudes, malicious scripts or politics allowed.
Feel free to ask any kind of support questions, as we grow more succinct answers will be available. Let's make this community grow.
We are important to one another, not only in the linux world but also in the fediverse as a whole. Feel free to reach out to me with questions or concerns, as we grow bigger I will look into adding mods. (This section will be updated as needed.)
It's a bit long for a one-liner, but this should work.
for f in /media/johann/5461-000B/DCIM/100MEDIA/*.AVI; do num=${f%.AVI}; num=${num##*IMAG}; ffmpeg -i "$f" -ss 00:00:00 -t 00:00:20 "~/Public/240321/240321_$num.avi"; rm "$f"; done
This
num=${f%.AVI}; num=${num##*IMAG};
extracts the number from the video filename. To make sure it's not deleting anything it shouldn't, you also might want to run it withrm -i "$f"
Thank you!!