Morphex's blogologue (Life, technology, music, politics, business, mental health and more)

This is the blog of Morten W. Petersen, aka. morphex in various places. I blog about my life, and what I find interesting and/or important. This is a personal blog without any editor or a lot of oversight so treat it as such. :)

My email is

An OGG/Vorbis player, implemented in Javascript.

My Kiva bragging page
My shared (open source) code on GitHub

Morphex's Blogodex


Zope hosting by Nidelven IT

Morten Petersen on Linkedin

Morten Petersen on Facebook

Morten Petersen on SoundCloud

Morten Petersen on MixCloud

Blogologue on Twitter

Older entries

Atom - Subscribe - Categories

A bit of video fun, ffmpeg fractional timestamp and slow-down

So, I've been recording some workouts, and posting them on Instagram; lately I've also experimented with video-altering apps on Android.

But, Linux has its own Swiss-army knife for altering videos, called ffmpeg.

I've also been recording myself massaging a punching bag, and was pleased when I saw myself tapping and then stomping the bag, in rapid succession, with great power.

So, I thought I'd see how fast I was actually going, and after some digging around, I found that I could add a fractional timestamp to a video, and slow it down, using these commands:

ffmpeg -i VID_20180803_153745~2.mp4 -vf "drawtext=text='Time\ \ \ \ \ \ ':x=120:y=h-lh-30:fontsize=20:fontcolor=white:shadowcolor=black:shadowx=1:shadowy=1:timecode='00\:00\:00\:00':timecode_rate=25/2" out.mp4

which adds the timestamp, and

ffmpeg -i out.mp4 -filter:v "setpts=8.0*PTS" out2.mp4

which slows down the video 8-fold. Here's the video:

And here's another, edited using an Android app, to go forwards and backwards, creating something that can be watched over and over again, smoothly:

[Added a day later:] I guess I should mention that the commando used to find the timecode_rate was:

ffprobe -v 0 -of csv=p=0 -select_streams 0 -show_entries stream=r_frame_rate VID_20180803_153745~2.mp4

and the output was: 25/2

[Permalink] [By morphex] [ffmpeg (Atom feed)] [04 Aug 20:19 Europe/Oslo]