Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Something in this video segment causes jerking motion #127

Open
Pixelsplasher opened this issue Dec 28, 2023 · 4 comments
Open

Something in this video segment causes jerking motion #127

Pixelsplasher opened this issue Dec 28, 2023 · 4 comments

Comments

@Pixelsplasher
Copy link

Pixelsplasher commented Dec 28, 2023

This 12-second segment was extracted from raw footage. The 12-second segment before it worked fine with vid.stab so there must be something in the video encoding causing the jerky output. Stabilizing the whole source footage will result in jerky motion from start to end but extracting the first 12 seconds only and stabilizing that results in good stabilization. Extracting the second 12 seconds of raw footage (posted here as the source file) and stabilizing that results in jerky motion.

image
Extracted segment highlighted in the timeline with blue line.

Source:
https://drive.google.com/file/d/1XwShRO9p6F_fy8SUxQVbl34HS11okG30/view?usp=sharing

Output:
https://drive.google.com/file/d/16OMpXoJKKiJj2PcH2B26974VtoHFt32z/view?usp=sharing

Options:
vidstabdetect=shakiness=5:accuracy=15
vidstabtransform=interpol=no

Issue persists with

default interpol on
smoothing at 5,10,15 and 30.
framerate set to 24 (source is 30) fps
unsharp filter on (unsharp=5:5:0.8:3:3:0.4)

@Ssong24
Copy link

Ssong24 commented Jan 10, 2024

Hi,
When I tested your video with interpolation= bilinear, stabilized result seems alright.
I think configuration of relative, or tripod might generate shaky effect, too.

Here is all configurations value when I tested.

 # vidstabdetect
    "shakiness": 5,
    "accuracy": 15,
    "stepsize": 6,          
    "mincontrast": 0.25, 
    "show": 0,
    "tripod": 0,

# vidstabtransform
    "smoothing":15,
    "optzoom":2,
    "zoomspeed": 0.25,
    "optalgo": "gauss",
    "crop": "keep",
    "invert": 0,
    "relative": 1,
    "zoom": 0,
    "interpol": "bilinear"

Output with interpol= no
https://drive.google.com/file/d/1QE8u_Gl9PXz1e7RlNPG4ebVjTGHiusrw/view?usp=sharing

Ouput with interpol = bilinear
https://drive.google.com/file/d/1E1S-zouYrCTb51rKwvxf-EnxezfX27A7/view?usp=sharing

@Pixelsplasher
Copy link
Author

Thank you for trying it out for me, @Ssong24 . I have already tried interpolation off and on with same result.

I think this could be my

system: unsupported gpu
output format: h.265

@georgmartius
Copy link
Owner

Interpolation is not causing this. GPU is also not used, unfortunately.
What is the exact cmd line you are using?
You might want to run the motiondetection in debug mode and look at the output video.

@Pixelsplasher
Copy link
Author

Pixelsplasher commented Jan 12, 2024

Here are the exact cmd lines I used, @georgmartius.

First pass
"D:\cmd\ffmpeg\bin\ffmpeg.exe" -i "..\20160110-133454 Pomelo Climb Up (vid.stab jerky src).MP4" -vf vidstabdetect=shakiness=8:accuracy=15:result="20160110-133454 Pomelo Climb Up (vid.stab jerky src)-s8.trf" -f null -

Second pass
D:\cmd\ffmpeg\bin\ffmpeg.exe" -i "..\20160110-133454 Pomelo Climb Up (vid.stab jerky src).MP4" -c:v libx265 -filter:v "scale='min(1280,iw)':-1,minterpolate=mi_mode=mci:mc_mode=aobmc:vsbmc=1:fps=48,fps=48,vidstabtransform=optzoom=2:crop=black:relative=1:input=20160110-133454 Pomelo Climb Up (vid.stab jerky src)-s8.trf,unsharp=5:5:0.8:3:3:0.4" -fps_mode passthrough -crf 36 -preset fast "20160110-133454 Pomelo Climb Up (vid.stab jerky src).720p.48fps.crf36.mp4

Solution: use ffmpeg interpolation

On second pass I set the frame rate from 30 fps, the source frame rate, to 48 fps in order to have more frames for interpolation by ffmpeg video filter instead of vid.stab interpolation.

Problem: vid.stab does not support custom frame rates

On second pass, unaware of the new frame rate, vid.stab has used the video stabilization analysis of the source video in its original frame rate and ran out of transformation data. A warning error was shown at the end of second pass encoding:

[vidstabtransform @ 000000b9b3dff448] not enough transforms found, use last transformation!251x

The jerking motion was gone but stabilization data was out of sync with the output video and introduced more shakes than the original.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants