4 ms·
Speaking of FFMPEG, anyone have a command-line they can share for a good de-shake filter? (Like the kind that keeps the subject in the center by rotating/moving
by mehrdadn 7y ago
Speaking of FFMPEG, anyone have a command-line they can share for a good de-shake filter? (Like the kind that keeps the subject in the center by rotating/moving the frame if needed?)
I've Googled and tried this so many times but there are so many filters and knobs I half-understand (at best) that I haven't really managed to find one I actually like in practice, but I feel like it must be possible given that people post videos online that do this extremely well.
- cma 7y agoI'm sure it is possible, but YouTube has a built in one you can select which may explain why lots of online videos have it even if they aren't using pro software.
- mehrdadn 7y agoOh wow I see, thanks. That would explain a lot...
- verst 7y agoIt seems that Blender can do this 2D motion tracking well [1]. FFmpeg has a filter for this as well [2]. I haven't tried either approach. [1]: https://www.youtube.com/watch?v=nU8zqn091rM https://www.youtube.com/watch?v=nU8zqn091rM [2]: http://blog.gregzaal.com/2014/05/30/camera-stabilisation-with-ffmpeg/ http://blog.gregzaal.com/2014/05/30/camera-stabilisation-wit...
- capableweb 7y agoBlender will be able to able to you to apply transformation to stabilize the footage, granted you'll need to cut the final output to remove the blank areas around the footage since it's moving around. What Blender won't help you with (I haven't found it at least) is removing the motion blur that happens because of the camera shake. Which is fine, Blender is not a post-production tool, but worth knowing that if you want to stabilize footage, you probably need Blender + insert-favorite-post-production-tool.
- iwalton3 7y agoI used this to stabilize a bunch of vacation videos with great results. It works better than the deshake filter but does require two passes. function stabilize { tempfile=".temp$RANDOM$RANDOM.trf" ffmpeg -nostdin -loglevel error -y -i "$1" -vf vidstabdetect=shakiness=5:show=1:result="$tempfile" -f null - ffmpeg -nostdin -loglevel error -y -i "$1" -vf vidstabtransform=input="$tempfile",unsharp=5:5:0.8:3:3:0.4 -movflags +faststart "$2" rm "$tempfile" } Usage: stabilize infile outfile.mp4
- mehrdadn 7y agoThank you! I'll give it a try. Update: Just tried it. It seems to do some kind of blurring to smooth the vibrations over several frames instead of trying to cancel the shaking by inverse-transforming the frame with respect to the shake. I think I've tried this in my experiments before -- and I guess it's the difference between "de-shake" and "stabilization"? Sadly it doesn't really seem better to my eyes sadly, but thanks for the help anyway.
- iwalton3 7y agoIt does have a mild blur filter which you can remove, but if it isn’t actually stabilizing the video from shakiness, something is wrong. See here: https://ffmpeg.org/ffmpeg-filters.html#vidstabdetect-1 https://ffmpeg.org/ffmpeg-filters.html#vidstabdetect-1 Maybe your ffmpeg build doesn’t have it? Also try removing the log level parameter.
- mehrdadn 7y agoIt is stabilizing, just not in the way (or as much) as I imagined, is the issue. I tried to describe it, not really sure how else to. But it's not really the same kind of output I'm expecting from a deshaking filter. I'd expect black margins etc. to bleed in for example, but I don't see that here.
- foxes 7y ago>This filter generates a file with relative translation and rotation transform information about subsequent frames >which is then used by the vidstabtransform filter. The first pass is meant to find the rotation, then I assume the next pass cancels it out.
- ehsankia 7y agoI usually do it with VirtualDub [0] + deshaker [1] Not command line though. [0] http://www.virtualdub.org/ http://www.virtualdub.org/ [1] https://www.guthspot.se/video/deshaker.htm https://www.guthspot.se/video/deshaker.htm
- jacobush 7y agoI always use Avisynth and Virtualdub with Deshaker
- mcdevilkiller 7y agoif you want scriptability, go for Avisynth. It's complicated, but very powerful.
- aikinai 7y agoI think vidstab is the only option for ffmpeg and it doesn't seem that great. I recently compared it to Premiere and Premiere was quite a bit better. I would also love a top tier option in ffmpeg.