0

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

2 Answers 2

1

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
0
1

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
1
  • Use bash parameter expansion to prevent the .mp4 in the output file name: "Action/${i%.*}.png"
    – llogan
    Commented Apr 27, 2016 at 2:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.