In order to accomplish everything we want to do here we will have to do 2 things in order.
1. overlay accurate timestamps on the video
2. slow the video whie retaining the original timestamps
ffmpeg can provide a time overlay via the drawtext filter
Step 1
ffmpeg -i input.mp4 -s 1920x1080 -vf "drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf:expansion=normal: text='frame %{n}\\: pts=%{pts \\: hms}': fontcolor=white:fontsize=48: x=7: y=7" -vcodec libx264 -vb 2000k -strict -2 -preset ultrafast -f mp4 output.mp4
You can adjust the location of the timecode by adjusting the x=
and y=
parameters after the fontsize parameter. ffmpeg is a tremendously powerful video processing program and I won't pretend to know all the different options by heart, but I have yet to discover much I needed to do with media files that I couldn't accomplish with it and it's included ffplay
media player other than perhaps this
FFMpeg pre-built binaries and documentation can be found here I used ffmpeg version 2.8.10-0ubuntu0.16.04.1
Step 2
Slowing down the video can be accomplished using the setpts filter video filter. This filter works by changing the presentation timestamp of each frame so you'll want to do this second in order to retain the accurate pts for the time overlay discussed above. we will begin by copying our original output file to a new input file with the command cp output.mp4 i2.mp4
We need to use a factor greater than 1 to slow down the video. Note that this filter will not effect the audio so I've added the -an switch to strip it in the following command:
ffmpeg -i i2.mp4 -an -vf "setpts=2.0*PTS" output.mp4
This results in a video that runs at 1/2 speed (takes twice as long to play) of the original.
If anything is unclear about this answer, please drop me a comment and I'll do my best to clarify.
Sources