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

Video overlay (gauges...) #222

Closed
s-celles opened this issue Oct 26, 2015 · 19 comments
Closed

Video overlay (gauges...) #222

s-celles opened this issue Oct 26, 2015 · 19 comments

Comments

@s-celles
Copy link

Hello,

I'm looking for an open source alternative using Python to make video overlay.

I'd like to make something similar to https://www.youtube.com/watch?v=EJIg9FOGH84
see also http://www.dashware.net/ or https://www.youtube.com/results?search_query=gopro+overlay
or http://racerender.com/

I wonder if moviepy is able to make video overlay and if some gauges already exists.

If not how I could make gauges that could be easily add to an existing video.

I also wonder if a realtime stream of video and data could be mixed to output a video with overlaid data (gauge...).

Kind regards

@s-celles
Copy link
Author

Some examples:

capture d ecran 2015-10-26 a 09 26 54
capture d ecran 2015-10-26 a 09 27 07
capture d ecran 2015-10-26 a 09 27 25
capture d ecran 2015-10-26 a 09 27 41
capture d ecran 2015-10-26 a 09 28 54
capture d ecran 2015-10-26 a 09 29 57
capture d ecran 2015-10-26 a 09 31 45

capture d ecran 2015-10-26 a 09 34 25

capture d ecran 2015-10-26 a 09 50 11

capture d ecran 2015-10-26 a 09 50 33

capture d ecran 2015-10-26 a 09 50 54

@Zulko
Copy link
Owner

Zulko commented Oct 26, 2015

You can definitely do all these fancy overlays with moviepy. Say that camera_clip is the clip of the racing car and gauge_clip is a clip representing a gauge with a mask (that defines where it lets see through), then you simply do:

final_clip = CompositeVideoClip([camera_clip, overlay_clip]).set_duration(camera_clip)
final_clip.write_videofile("result.mp4", **some_options)

you can compose multiple clips at once:

 final_clip = CompositeVideoClip([camera_clip,
                       overlay_clip1.set_position("bottom"),
                       overlay_clip2.set_position(("right", "top")),
                       overlay_clip3.set_position((100,55))])

I have no examples of gauges. You could try to do your own (tell me if the manual is enough, else I could try and make an example).

However you cannot do live streams with moviepy at the moment. For livestreams I suggest you look into OpenCV (it does less fancy compositing than moviepy but it is faster and may be well suited for your needs).

@s-celles
Copy link
Author

Thanks @Zulko for your quick reply

Ideally I would like to make a code for gauges that could apply to both recorded videos and also live stream.

What vector graphics library do you suggest to make gauge code ? Gizeh, cairocffi, pycairo ?

@Zulko
Copy link
Owner

Zulko commented Oct 26, 2015

I'd they Gizeh but I am biased ;)

Another solution (the one I'd go for) would be to pre-generate a series frames (with either Gizeh, Gimp, Inkscape) in which the gauge goes from 0 to 300mph, with steps of, say, 5mph. Then you load these frames and just display the right frame depending on your data (I guess you have somewhere the evolution of speed over time).

@s-celles
Copy link
Author

Don't you think that gauges should be SVG ? I don't see SVG support in Gizeh. SDL might be an other library to consider but you may have some other ideas.
See https://www.youtube.com/watch?v=v_jULVIkpRs

@Zulko
Copy link
Owner

Zulko commented Oct 26, 2015

The gauges won't be svg the moment you insert them in the video (they need to be an image for that). Gizeh is a Vector Graphics library, so you can do any effect that you could do with SVG, the only thing being that it is exported as a PNG image instead of SVG.

For SDL I'd say why not, may be a solution if you want "live" video editing (have a look at Pygame which does overlays and uses SDL), but OpenCV will work as well.

@opensourcegrappler
Copy link

I've had some success in making a guage for overlay by using pygame and passing a raw framebuffer of what is displayed directly to ffmpeg via a pipe. It's much faster than pregenerating the frames.

Incidentally one of Zulko's blog posts helped me a lot with understanding how ffmpeg works with pipes.

@tjdharamsi
Copy link

Hello, is video in video possible through moviepy? Like two videos playing simultaneously together one with audio and other without in an overlay manner..

@opensourcegrappler
Copy link

Yes it is possible, you can also use ffmpeg or Openshot.

@tjdharamsi
Copy link

Thanks, i could do it using moviepy only!

@opensourcegrappler
Copy link

This example has video in video. I assume it's still current.
http://zulko.github.io/moviepy/examples/ukulele_concerto.html

@meoso
Copy link

meoso commented Sep 16, 2016

This is interesting, as i'm looking for a dashware alternative for Linux. any tutorials of this subject by previous posters? I'm not python adept, but am very commandline adept.

@keikoro
Copy link
Collaborator

keikoro commented Feb 18, 2017

Closing this issue as it sounds like the original problem was solved.

@keikoro keikoro closed this as completed Feb 18, 2017
@aster94
Copy link

aster94 commented Mar 30, 2018

@scls19fr @opensourcegrappler @meoso did you managed to work with gauges and video sync?

@opensourcegrappler
Copy link

Yes, I wrote my own tool to generate the gauge video frames from a gps log file and overlayed them onto gopro video using kdenlive. The sync is harder, I used some of my own custom hardware to flash some lights for a visual clap to line things up. The tool for making the gauges is here https://github.com/opensourcegrappler/mct

@aster94
Copy link

aster94 commented Mar 31, 2018

nice, thanks for sharing. I would love to have a free/opensource software like dashware for unix systems but it seems that nothing exist yet. A good woorkaround would be to use moviepy as you did. i would say that the main problem right now would be the lack of gaphic gauges and their animation while the script to read the database and feed these gauges should be simple

anyway I just send an app request to wine, i will post it here when it will be reviewed

@aster94
Copy link

aster94 commented Apr 2, 2018

i added dashware to wine:
https://appdb.winehq.org/objectManager.php?sClass=application&iId=18800
you can vote it if you want people to try to make it working

@opensourcegrappler
Copy link

As far as I know dashware doesn't do a very good job of solving the sync of data and video problem. What kind of data/video do you have?

@aster94
Copy link

aster94 commented Apr 2, 2018

racing motorbikes with a custom software to read data from the ECU of my suzuki motorbike + IMU +GPS and more
imho dashware is not meant to solve sync problem it is just a software for overlay telemetry
the same i would like to obtain from moviepy, but my lack of knowledge of graphic libraries won't help me so i guess i will continue to use dashware on windows

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

7 participants