I have the following bash script generating a jpg file with the same name of the video file. Now I need to change the bash script to generate the jpg file with the name image.jpg instead of with the same name of the video.
I tried lots of different ways to do that but I'm not really good in bash scripting and I have some problem with the basename and subdirectories.
May you please help me?
#!/bin/bash for i in */*.mp4; do j=`basename $i .mp4`; /usr/bin/ffmpeg -i "$i" -r 1 -f image2 -vframes 1 -s 640x360 -ss 0:0:30 $j.jpg; done
Following the directory tree
/ /a/video1.mp4 /b/video2.mp4 /c/video3.mp4
Following the result I need
/ /a/video1.mp4 /a/image.jpg /b/video2.mp4 /b/image.jp4 /c/video3.mp4 /c/image.jpg
Thank you very much!