Python Play two videos in one window - python

Is it possible to play two videos in one single window then generate a new video using python? i.e. I have video_1.avi and video_2.avi and want to create video_3.avi which includes 1 and 2. As this picture shows:
Any ideas and suggestions will be greatly appreciated.

Related

How to display small images in an HMI ? PyQt Python

I am making my first software with an HMI.
I'm creating a tool to easily perform contour detection on an image and make small images for each contour that's detected. So far I managed to do all of that. Now I wish to display the small images obtained into my HMI. Currently I stopped after generating and saving the small images on my PC. I thus have them already. I'm now trying to find some way to display them all at once in the tool part of my HMI. The problem is I don't really know where to start to do such.
I'm not asking for a complete working code but just for clues or tips that could help me figure out how I can proceed to display them. I heard about QIcon, could that maybe do it for example ?
To help you understand better my idea, here is a screenshot of my HMI. In red is how I would like to display small images from my computer as a mosaic with some scroll bar to display the next images in case they don't all fit in the space.
Thank you for all the ideas you can give me !!

How can I dynamically stack gifs horizontally to create one gif in python?

What I need to do is combine two or more GIF files into one horizontally using Python. I thought about using PIL or ffmpeg but I could never really get anywhere. I found partial solutions on the internet, however they aren't exactly what I'm looking for. I'm looking for a way to add an uncertain amount of gifs to one horizontal strip gif. The sizes of each individual GIF are different, and the amount of GIFS being stacked horizontally changes depending on the user's input. Essentially a dynamic hstack filter for ffmpeg. Help would be appreciated!

How to count similar objects in OpenCV Python?

I've been trying to do my thesis in OpenCV using webcam for a live video and python. One of my problems for a few weeks now, is the fact that i cant enumerate similar objects.
For example i have managed to count the number of the objects in the following picture, but the thing is that, i cant display the number of squares(square1, square2, square3), the number of circles(circle1, circle2) and the number of triangles(triangle1)...(lets skip the fact that there's a rectangle and an elipse here and just name them, square and cirle).enter image description here
Any idea on how should i proceed with my code?
Thanks in advance everyone.

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.

(Python) MainWindow background image with two overlapping images

I'm trying to make a my main window have a background image. The problem I'm running into is that the background is comprised of 2 separate images. the top image is placed in the center above the bottom image. I can't find any references on how to accomplish this. I'm thinking I might be able to utilize these two methods to do it, but I'm not sure if I'm heading in the right direction or not.
QGraphicsScene.BackgroundLayer
QGraphicsScene.ForegroundLayer
I'm using python3 with pyqt5. Any help pointing me in the right direction would be greatly appreciated. I wasn't able to find much of anything on this so far.
Thanks in advance.
-edit: In case there is confusion, I have to use 2 images because the background is generated from 2 pictures that are scraped from the web during run time. Maybe someone knows of a way to dynamically merge the 2 images together with specific x,y coordinates with a library, then just use the new image as a background?
I figured it out. The easiest way to accomplish what I'm trying to do is to make 2 labels. 1 that covers the entirety of the window, and another that covers the area where the second picture is supposed to go. Then use Pixmap on each label to cast an image to each label. Figure out the x,y offset required to line up the inner image, adjust the label placement, done.

Categories