2

I am trying to output a screenshot of a video at an specified time and the resulting picture should have a black square with the time that was given initially.

So far I was only able to produce a screenshot using vframes from the example at the documentation on ffmpeg page which is this below:

ffmpeg -i input.flv -ss 00:00:14.435 -vframes 1 out.png

But I would like to add a timestamp in the resulting thumbnail or capture of the video which would show that '00:00:14.435' using arial fontface and a black square as background an yellow as fontcolor. Can this be done?.

2
  • See here. Skip \:1466507118
    – Gyan
    Commented May 31, 2017 at 6:15
  • I've already tried the method you mentioned but it does generate a sequence of frames and it is not the way how I intend to assess my problem hence i stressed the part of inserting the time in a black frame at the bottom of the screen capture with the specified time. Commented May 31, 2017 at 6:40

1 Answer 1

3

Use

ffmpeg -start_at_zero -copyts -ss 00:00:14.435 -i input.mp4
    -vf "drawtext=fontfile=/path/to/Arial.ttf:
          fontsize=45:fontcolor=yellow:box=1:boxcolor=black:x=(W-tw)/2:y=H-th-10:
          text='Time\: %{pts\:hms}'"
    -vframes 1 output.png
1
  • Can this code be expanded to take a screenshot every X minutes from the video and paste on each one the time elapsed until that point?. I am unable to do this by my own. Commented Jun 9, 2017 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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