georgmartius / vid.stab

Video stabilization library
http://public.hronopik.de/vid.stab/
Other
842 stars 108 forks source link

Using vid.stab in a continous stream? #75

Closed martinschilliger closed 5 years ago

martinschilliger commented 5 years ago

I want to stream continously to a RTMP-Server using ffmpeg, which works great. Now I found vid.stab I thought about stabilizing the stream. On static files I can stabilize in one step with for example -i "$SOURCE" -vf vidstabdetect -vf vidstabtransform=zoom=5.

However in stream (rtp://-Input from GoPro) this doesn't work, it only gives the following error. If I try to use vidstabdetect only it gives no errors, but using vidstabtransform afterwards with the created file does nothing with the video.

[swscaler @ 0x110571000] deprecated pixel format used, make sure you did set range correctly
[Parsed_vidstabtransform_0 @ 0x7fabdb729e00] cannot open input file transforms.trf
[Parsed_vidstabtransform_0 @ 0x7fabdb729e00] Failed to configure input pad on Parsed_vidstabtransform_0
Error reinitializing filters!

Any idea how I could detect and transform in one step? Or isn't this possible at all?

I want to mount the camera on a pig and stream the video, so stabilization would be great… 😂🐷

georgmartius commented 5 years ago

Hi, so far the filter is implemented as a two-phase process. To do it online one cannot look into the future for camera movement compensation. This makes the quality worse. I have such a version in "transcode" but did not make an equivalent version for ffmpeg.

karbiv commented 5 years ago

Not in open source yet. Sony has their algorithm for BIONZX processor(in action cams). 60 FPS online stabilization, it must have a big memory buffer. But it passes over some shakiness and crops field of view significantly(the reason why they use very wide FOV lens). It was their investment(besides wider FOV) to enter a competition with GoPro(which added stabilization much later). Sony smartphones have online stabilization but pixels quality on my model is not great, and it still passes over some shakiness.(maybe Google's stabilization is better, doubt it)

Probably some multi-threading algorithm on desktop CPU(at lest 8 cores) could do that better. That would require a lot of time and research investment.

martinschilliger commented 5 years ago

Thank you both for the clarification. So it's clear that it isn't technically possible right now with vid.stab.

I saw stabilization on the GoPro and was impressed to see it in ffmpeg also. Your software is impressing anyway. 😊