How to make a program to shoot video along with audio - python

How do I make a program to shoot video along with audio? I want to make a program to record video along with sound. But how to make the sound recorded along with the video and not just the video?
I tried to write a script, but I do not know how to make the video recorded along with the sound.

Related

Reading a video output from cv2.imshow into another code

I have written a code, which puts on a live webcam recording various filters, and gives me at the end again a video as output (with cv2.imshow). Now I want to use the output video in another code at the same time. Bringing the two codes together is not possible.
Does the output video have an address where I can call it? Is there an OpenCV function, (like cv2.VideoCaputere), with which I can read open videos?
Saving the video and then reusing it does not work, because the other code must process the output video at the same time.

How to play/pause a numpy sound array?

So I am making a video player, and am playing sound. The audio is in a numpy array. I have a function that can play/pause the video, but I need something to be able to play/pause the playing of the sound. I am using the module 'sounddevice' to play the audio - the code to play is:
sounddevice.play(nparray)
Does anyone know how to play/pause the sound. There is an option to stop it, but not pause it.

Python Open Source Video Player To Dynamically Play a Stream of Consecutive Videos

any help is much appreciated. I've been looking for a few days for something to meet the following use case. I need to open a single video player window which will play a dynamic stream of videos selected by an accompanying program. I'm on windows 10 but could probably find a way to use linux if needed.
So the flow would be as such:
Video 1 opens in the video player window.
On a queue sent by the same script which started the previous step, Video 1 is paused/stopped and Video 2 is played in this same window with a seamless frame to frame zero transition time.
The script in the background does some additional processing to decide whether it wants to next play Video 3, Video 4, or Video 5. Let's say the script chooses Video 5.
Now on conclusion of Video 2 we want to tell this same window to play video 5, again with seamless frame to frame zero transition or black screen.
Does anyone know how to do this? I've not been able to figure it out with python-vlc, OpenCV, or anything else! Please Help! Thanks!
I found this PyQt5 code (How to play multiple clips of a video one after another see ekhumoro's answer), which appears to play one video after another. However, the media is given to the window before calling app.exec()... How do I update the media source dynamically as the window is already open and playing media? AKA after app.exec() has been called?

How would I go about playing a video file with sound in Python and setting the play position?

I'm using ffmpeg to process video files using Python, but I want to be able to open a local video file and use a few sliders to control the timeline in the video, that way I can get the timestamp from where those sliders were moved.
The goal is to get the beginning and end time of the set positions using the sliders, that way I can cut the video at those times using ffmpeg.
Any help would be appreciated...
Thanks
I ended up using python-vlc which works great in Tkinter.
Here's an example VLC has on their website which was a big help.
http://git.videolan.org/?p=vlc/bindings/python.git;a=blob;f=examples/tkvlc.py;h=55314cab09948fc2b7c84f14a76c6d1a7cbba127;hb=HEAD
Here you can find the documentation:
https://wiki.videolan.org/PythonBinding

move a stereoscopic video on the screen

I would like to move a (stereoscopic) video on a computer screen automatically. Think of the video as the ball in a Pong game. The problem is that it should be a stereoscopic 3D video. So the video size itself is kind of small. I did this kind of movements with pictures or drawing object, but I don't know how to do it with video material!
Does somebody know how I can do this? I already searched for video tools in python like pygame or pyglet. I have an external player Bino 3d which can open the desired video. But how can I make it move around the screen?
Or is there a tool in other programming languages like c/c++ or Matlab which can help?
By the way, the program will be on a Linux OS.
I'll be grateful for any help or hints!
Anna
I'd try to use a decent video client (mplayer, vlc). They can present the video in lots of ways, hopefully your stereoscopic issue can be solved by them.
Then I would let the client present a single window (not fullscreen) which I then would move around using window manager controls.
If you must not have window decorations around the video or if the output shall be a specific window, I think mplayer at least can be told to use an existing window to perform the output in. Maybe that's an approach then.

Categories

Resources