Reputation: 59
I have over 1700 emulator videos I need to take screenshots of. I need one set of (Action) screenshots about 5 seconds into the start of the video and another set of (Title) screenshots at about 2 seconds from the end of video.
For the Action Shots (Start) I've got:
ffmpeg -y -ss 5 -i "VideoName.mp4" -vframes 1 "Action/VideoName.png"
And for Title Shots (End) I've got:
ffmpeg -sseof -2 -i "VideoName.mp4" -vframes 1 "Title/VideoName.png"
But now I need these new image's to retain the same filename as the source.
For example:
Donkey Kong.mp4 > Action/Donkey Kong.png
And I also need to be able to do this to many video files.
Any help will be much appreciated, Nem
Upvotes: 0
Views: 233
Reputation: 59
The following did the trick for Action shots:
mkdir Action
for i in *.mp4
do
ffmpeg -y -ss 5 -i "$i" -vframes 1 "Action/$i.png"
done
For some reason the .mp4 extension remained in the image name. For example:
Donkey Kong.mp4.png
So I used the following to fix that:
cd Action
rename 's/.mp4//g' *.png
cd ..
To get:
Donkey Kong.png
Upvotes: 1
Reputation: 93028
To take a screenshot from 2.5 seconds before the end of the video, use
ffmpeg -sseof -2.5 -i input.mp4 -vframes 1 input-end.png
Upvotes: 1