I'm having issue with the file-naming extension output. My input is JPG files that needs to convert to MP4 using FFMPEG. However, when I run the code below it output as img1.jpg.mp4
including the input file extension instead of just img1.mp4
.
fswatch -e ".*" -i "\\.jpg$" . |xargs -n1 basename|xargs -n1 -t -I {} sh -c 'pwd;[[ -f {} ]] && ffmpeg -y -loop 1 -i "{}" -vf "fade=t=in:st=0:d=1,fade=t=out:st=2:d=1" -preset "ultrafast" -c:v libx264 -t 3 -pix_fmt yuv420p "{}.mp4"'
Any help is much appreciated.
Running on MAC, SH/BASH
EDITED:
BTW I also tried a loop to do the trick like the code below, but I'm looking to more neat solution to fix it in the same line of code above or call function after FSWATCH
successful operation.
for file in
*.jpg.mp4; do
mv "$file" "$(basename "$file" .jpg.mp4).mp4"
done