I just learned of the Stabilize filter in ffmpeg. I created one that will batch stabilize all MOV's in a folder. Just change input extension in lines 2 and 3 for other types. It's an automated two-step process that first analyses, then processes using codec of choice. It's almost as good as the DeShaker plugin for Virtualdub, but it also has advantages over it like batch processing.
To use, you'll need latest version of ffmpeg 32 or 64 bit. You'll need to edit the Path to ffmpeg in the first line. Change the input extensions as needed in lines 2 and 3. Then just drag first clip into the batch file and all will be processed.
Along with the newly created clips, it will produce RTF files (processing information) and a Dummy.avi that shows tracking markers. You can delete these when finished.
Here is a script that should work OK with most shaky footage:
Here is an example of results:Code:SET PATH="E:\Backup\Video Apps\Video Encoders\FFmpeg\FFMpeg\64-bit" for %%a in ("*.mov") do ffmpeg -i %%a -vf vidstabdetect=shakiness=10:accuracy=15:result="%%~na.trf":show=1 dummy.avi -y for %%a in ("*.mov") do ffmpeg -i %%a -vf vidstabtransform=crop=black:input="%%~na.trf" -c:v libx264 -level 41 -pix_fmt yuv420p -g 24 -crf 19 -c:a aac -strict experimental -ar 48000 -ab 256k -f mp4 "%%~na_stab.mp4" pause
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 21 of 21
Thread
-
Got my retirement plans all set. Looks like I only have to work another 5 years after I die........
-
Why create an output in the first pass at all?
Why not use:
Code:-an -f null NUL
Code:dummy.avi -y
users currently on my ignore list: deadrats, Stears555 -
Can this filer detect single frame horizontal/vertical jitter as you often can see with digitized older films?
-
Got my retirement plans all set. Looks like I only have to work another 5 years after I die........
-
I didn't see anything in the docs for Rolling Shutter compensation, hence why I said it's almost as good as Deshaker plugin for Virtualdub.
Last edited by racer-x; 2nd Nov 2014 at 09:19.
Got my retirement plans all set. Looks like I only have to work another 5 years after I die........ -
Got my retirement plans all set. Looks like I only have to work another 5 years after I die........
-
Like Stab() in AviSynth? It looks like you might be able to tweak some of the parameters to do that.
http://www.ffmpeg.org/ffmpeg-filters.html#vidstabdetect-1
http://www.ffmpeg.org/ffmpeg-filters.html#vidstabtransform-1Last edited by jagabo; 2nd Nov 2014 at 05:55.
-
If Rolling Shutter is an issue, you're better off using DeShaker in Virtualdub. It has settings for that directly. My t2i likes 70% compensation for example.
This is a useful tool to batch process a bunch of shaky source clips from phone or tablet, where quality isn't much concern anyway.Got my retirement plans all set. Looks like I only have to work another 5 years after I die........ -
Rolling shutter usually isn't an issue with film bounce. I've seen it a few times though.
-
I'm not getting any levels differences with -vf vidstabdetect/vidstabtransform on some quick tests. Something must be different about your example, maybe different libvidstab version ?
Difficult to preview / make fine tuning , adjustments with ffmpeg - but still can be useful in some situations -
I believe the source (Canon t2i DSLR) is the culprit here. I normally shoot with tripod / monopod or shoulder-mount and very rarely have a need for video stabilizer. I had to look long and hard through my HDD for shaky footage and found a couple from my t2i hand-held shots.
Just to test, I shot some shaky video with my Tablet and indeed it retained black and white levels. Interestingly the video was AVC with a .3gp extension, not a problem for ffmpeg though......Got my retirement plans all set. Looks like I only have to work another 5 years after I die........ -
-
Well here is a test clip you can try from my t2i. I actually shot it on a tripod, but the wind in conjunction with the 300 mm lens made it shake a lot. I can't get the same color levels before and after. See what you can get.
Got my retirement plans all set. Looks like I only have to work another 5 years after I die........ -
I didn't download your video, but I tested with my own from a 7d, I can confirm levels are clamped in the output file. I'll take a closer look and try to suggest a workaround
But on one hand, clamping makes everything "legal", how would you prefer to do it ?
ffmpeg is one that distinguishes the full range flag (it reads it as yuvj420p, the "j" being full range), but other decoders like quicktime clamp it to 16-235 -
Also, currently there is no way for ffmpeg to encode full range and flag it properly with x264 (assuming someone wanted to encode full range for whatever reason, and flag it properly). It's one of the various things missing from ffmpeg libx264 compared to x264.exe . (Neither -x264-params , or -x264opts in ffmpeg can call these options )
IMO, working in full range is fine, as long as the final output is normal range. You are asking for trouble if final format is full range . Very few players and setups are configured properly for full range. And only 1 renderer can handle it properly (madvr) automatically -
Another observation:
1) The usual "workaround" for people wanting to encode full range properly is using a raw pipe from ffmpeg to x264 ; and use x264 with --input-range pc --range pc. This works fine with DSLR MOV's , full range MJPEG's etc...
However, something looks like it's clamping as soon as you use -vf vidstabtransform. If I remove that filter, full range is encoded as normal with the pipe. So something is up with that filter. I'll look into it more -
Ok if anyone is interested (...crickets.... ) in keeping full range and flagging it properly while using -vf vidstabtranform , there is a convoluted workaround:
(for this purposes, I will post single, not batch cmd lines)
1) strip the full range flag with mp4box (audio has to be muxed at a later stage, because mp4box has problems with PCM in MP4. I'll leave that for another discussion, but you can use 2 inputs with stream mapping)
The mp4box build used has to have the golgol patch (offical builds do not)
http://komisar.gin.by/tools/
Code:mp4box -add input.mov:fullrange=off -new stripped.mp4
Code:ffmpeg -i stripped.mp4 -an -r 24000/1001 -vf vidstabtransform=crop=black:input="data.trf" -f rawvideo -pix_fmt yuv420p - | x264 --demuxer raw --input-res 1920x1080 --input-csp i420 --input-range pc --range pc --fps 24000/1001 -o output.mp4 -
Anyways, nobody should be doing that IMO will full range, we should be evaluating how vidstabtranform actually performs compared to others... so carry on.... -
just registered to say thank you selur and specially THANK YOU monsieur {el pollito} RACER-X {the crowd's mad on ecstasy!!!}
http://www.personal-view.com/talks/discussion/11519/mac-free-apps-tips-and-tricks
not dead allgood
maxr