Video editing with python : adding a soundtrack to a video - python

I want to add a independent soundtrack to the video and keep the original soundtrack, so that I can choose which soundtrack to play later. Moviepy seems to merge the new soundtrack with the original one, which is not what I want. Are there libraries doing this job?

Related

how to let OpenCV save the last few seconds of analyzed video

I am trying to program a python OpenCV app for my own use because I can't go to gyms for some time. I would like to do the following:
Capture frames from a video flow using OpenCV [ done ]
Have OpenCV track a yellow soccer and return the coordinate of this soccer in the frame [done]
Come up with an algorithm to detect when a soccer juggling failed, for example the soccer went out of frame and so on [ done ]
Now my question is: let's say I want to save the "10 seconds right before this event" of video into a mp4 file. How should I do it? Is there any good template that I can follow?
Thanks!
You may create a memory buffer worth of 10sec of video (~about 300 frames for most web-cameras), then save frames to that buffer, removing the old ones while adding the new ones.
Once your ball is out of the frame -- open a video file, and save your frames from the buffer.

Deleting frames from a video as I add new ones

I'm detecting if the camera can see an object in openCV. I want to record the last 10 seconds the object was in scene. I thought about making 2-3 separate videos and deleting and rewriting as it goes. How would that be performance wise? Or is there a way I can keep one video at a set number of frames? I should add that I'm pretty new to openCV

How to display a group of videos in a single frame

I'm kind of new to python, so please bear with me. I am having trouble displaying videos inside a TKinter frame. What i want to do is play a group of videos inside a frame in TK.
For example: i have 3 videos named a.mp4, b.mp4, and c.mp4
i want them to play inside a frame without it reloading(closing, then play the next video)
i have tried OpenCV, but what it does is play a.mp4, closes, then plays b.mp4
Any help would be much appreciated, i have been stuck here for days
You can concatenate videos horizontally or vertically or in a grid to a single video file using ffmpeg or manually in python.
You can use ffmpeg outside python to concatenate videos into single video and show as a single video:
Vertically stack several videos using ffmpeg?
Or you can make a single video by concatenating those videos horizontally or vertically in python itself. e.g. use scikit-video or opencv to load videos into different arrays and concatenate horizontally or vertically or in grid and save as a single video.

Sound editing and equalizer on python

Im currently using pyglet as my sound library on python,
The library is great but it does not contain an important feature i really need:
Frequency control while playing a certain song (lets say .mp3),
Meaning, I want to lower the bass frequency or raise the higher frequencies while playing
a certain song.
And it should have a player which can play songs from a certain location in the song,
Play couple of .mp3's together and can pause/stop when needed (pyglet has these options)
Is there a python sound library which holds these capabilities?
Im using mac os 10.8

The simplest video streaming?

I have a camera that is taking pictures one by one (about 10 pictures per second) and sending them to PC. I need to show this incoming sequence of images as a live video in PC.
Is it enough just to use some Python GUI framework, create a control that will hold a single image and just change the image in the control very fast?
Or would that be just lame? Should I use some sort of video streaming library? If yes, what do you recommend?
Or would that be just lame?
No. It wouldn't work at all.
There's a trick to getting video to work. Apple's QuickTime implements that trick. So does a bunch of Microsoft product. Plus some open source video playback tools.
There are several closely-related tricks, all of which are a huge pain in the neck.
Compression. Full-sized video is Huge. Do the math 640x480x24-bit color at 30 frames per second. It adds up quickly. Without compression, you can't read it in fast enough.
Buffering and Timing. Sometimes the data rates and frame rates don't align well. You need a buffer of ready-to-display frames and you need a deadly accurate clock to get them do display at exactly the right intervals.
Making a sequence of JPEG images into a movie is what iPhoto and iMovie are for.
Usually, what we do is create the video file from the image and play the video file through a standard video player. Making a QuickTime movie or Flash movie from images isn't that hard. There are a lot of tools to help make movies from images. Almost any photo management solution can create a slide show and save it as a movie in some standard format.
Indeed, I think that Graphic Converter can do this.

Categories