2

I need a video editor to slow down some videos and overlap a time scale (millisecond) with the video. Can you recommend me any software that has these functions? Slowing down the videos is not as important as the time subtitle. I recorded all the clips using a GoPro Hero4 camera using optimum settings (roughly 60fps?).

I am trying to measure the time required for a wave front to travel a known distance for some school project experiments.

1
  • 1
    Close voters. Not too broad, pretty straightforward actually. I at least didn't find it unclear. See my answer
    – Elder Geek
    Feb 13, 2017 at 21:06

2 Answers 2

2

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

5
  • It should be possible to do both in one step if you tell FFmpeg to chain the two filters. Feb 16, 2017 at 13:14
  • @DavidFoerster Without losing timestamp accuracy? I'd honestly love to see an example of that and test it.
    – Elder Geek
    Feb 16, 2017 at 15:38
  • 1
    ffmpeg -i input.m4v -ss 240 -t 60 -filter:v "drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf:expansion=normal: text='frame %{n}\\: pts=%{pts \\: hms}': fontcolor=white:fontsize=24: x=7: y=7, setpts=4.0*PTS" -c:v libx264 -strict -2 -preset ultrafast -filter:a "atempo=0.5,atempo=0.5" -f mp4 output.m4v worked excellently for both video and audio (tested with FFmpeg 3.2.2 on this video). Notice the time code running from 00:01:00 to 00:01:15 over 60 seconds. Feb 16, 2017 at 21:42
  • Interesting. Looks like this results in 1/4 speed video and audio both. (I couldn't use your test video as youtube is disabled on the system I'm currently on, but I think I was able to parse the command regardless). Thank you!
    – Elder Geek
    Feb 16, 2017 at 21:52
  • 1
    Yes, setpts=4.0*PTS slows down video by a factor of 4 and duplicates frames to that end (unless you change the frame rate accordingly) and atempo=0.5,atempo=0.5 speeds up audio twice by a factor of 0.5 (which is the same as a twofold slow-down) each because atempo is limited to the range [0.5, 2.0] for a total slow-down by 4. Feb 16, 2017 at 22:06
0

If you are looking for an editor that has the ability to do this stuff as well as be a full suite editor then I'd suggest looking at Kdenlive.

Timecode Overlay with Kdenlive

Slow Down Video with Kdenlive

Otherwise, if you are looking for a solution to this and only this then this answer from Elder Geek might be what you want. Those commands could be tweaked and used again in the future even in script form as long as the source camera is consistent.

5
  • It seems kdenlive is quite a bit slower is this no longer true? I haven't used it in quite some time for that reason. Do you think I should give it another look?
    – Elder Geek
    Feb 13, 2017 at 21:38
  • The thread you linked is referencing Kdenlive 0.9.10 which is a VERY old version of the application. Kdenlive is currently on 16.12.2 and has had rapid development over the last year or so with massive improvements both in features and stability. So it depends on how long "quite some time" means but I'd say yea, give it a try. || as for render speed, I have no idea because it depends on what you are rendering and what that user on the forum was trying to render which they never said. Feb 13, 2017 at 21:52
  • Do you still have to import a clip before you can manipulate it? As I recall this was very time consuming 2 or 3 years back.
    – Elder Geek
    Feb 13, 2017 at 22:11
  • Yes, importing clips is needed to add them to the timeline. This takes only seconds now and you can easily add clips in batches to the import section as well. As stated, if you haven't used Kdenlive in years then your experience with those older versions do not at all correlate to the current versions. Massive development restarted in March 2015 and there have been 33 releases since then. Feb 13, 2017 at 22:13
  • Too bad the timecode resolution is only a centisecond rather than the millisecond resolution the OP requested. This doesn't appear to quite meet the criteria. I'll grant that kdenlive is improved since I saw it last.
    – Elder Geek
    Feb 13, 2017 at 22:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .