ffmpeg

How to multithread ffmpeg-python process?

How to multithread ffmpeg-python process? Question: I’m working on a cancel button that cancels the ffmpeg video & audio merging process when pressed. But while loop doesn’t keep looping once ffmpeg starts execution, while loop continues to loop after ffmpeg finished the process. I couldn’t really figure it out, sorry if it’s duplicate. I know …

Total answers: 1

Crop a video in Python, centered on a 16×9 video, cropped to 9×16, moviepy?

Crop a video in Python, centered on a 16×9 video, cropped to 9×16, moviepy? Question: I want to crop a video that is 16×9 resolution to 9×16. This can be done by cropping a centered 607px wide rectangle on the 16×9 video. Can this be done? EDIT: I do not care to stay within moviepy. …

Total answers: 2

Using ffmpeg on PythonAnywhere

Using ffmpeg on PythonAnywhere Question: My (first) web app uses pydub, which depends on ffmpeg. On my local windows environment, I installed ffmpeg and added the path to the ffmpeg executables to the windows "path" environment variables. It all works locally, but bow that I have deployed my app to PythonAnywhere, the following line in …

Total answers: 2

Why does this code detects images as video and how can I fix it?

Why does this code detects images as video and how can I fix it? Question: This method is detecting .jpg pictures as video. Why is that? How can I fix it? def is_video(self) -> bool: try: res = self.video_metadata[‘codec_type’] == ‘video’ logger.info(f"Video.is_video() -> {res}") return res except: return False I’m getting the metadata with ffmpeg.probe(self.path, …

Total answers: 1

Programmatically accessing PTS times in MP4 container

Programmatically accessing PTS times in MP4 container Question: Background For a research project, we are recording video data from two cameras and feed a synchronization pulse directly into the microphone ADC every second. Problem We want to derive a frame time stamp in the clock of the pulse source for each camera frame to relate …

Total answers: 1

Getting the file name of downloaded video using yt-dlp

Getting the file name of downloaded video using yt-dlp Question: I’m intending to use yt-dlp to download a video and then cut the video down afterward using ffmpeg. But to be able to use ffmpeg I am going to have to know the name of the file that yt-dlp produces. I have read through their …

Total answers: 2

Compiling frames into a video with ffmpeg

Compiling frames into a video with ffmpeg Question: I have a folder with a number of frames in which I’d like to concatenate into an mp4 file using ffmpeg. What is the correct syntax to do this in a Jupyter notebook script? I have tried: os.system("ffmpeg -r 30 -i ./inputs/upload%00001d.png -y ./inputs/result.mp4") The above runs …

Total answers: 1

Variable fps (frame per second) in cv2

Variable fps (frame per second) in cv2 Question: I use cv2 for creating videos from different frames that I have. When I create the video, I cannot change the fps (frame per second). I want the video be slow at the beginning but fast towards the end, meaning small fps at the beginning but large …

Total answers: 2

When I run this it is showing ffmpeg has no attribute input. How to solve this?

When I run this it is showing ffmpeg has no attribute input. How to solve this? Question: def extract_audio_from_video(file_path: str) -> np.ndarray: inputfile = ffmpeg.input(file_path) out = inputfile.output(‘-‘, format=’f32le’, acodec=’pcm_f32le’, ac=1, ar=’44100′) raw = out.run(capture_stdout=True) del inputfile, out return np.frombuffer(raw[0],np.float32) Asked By: Ashik Ali || Source Answers: If you’d like to explore a different option, …

Total answers: 2

Batch ffmpeg conversion

Batch ffmpeg conversion Question: I’m looking to batch draw text using ffmpeg on a directory of mp4s. Basically, take the mp4s from the old directory and drop the newly minted mp4s in the new directory. In this case, there are 20 chunks (0 to 19, chunk_x.mp4). I haven’t been able to implement the existing solutions …

Total answers: 1