125 questions
-1
votes
0
answers
57
views
Matplotlib ffmpeg libopenh264 error in FFMpegWriter
When I try to use matplotlib's ``FFMpegWriter```.
import matplotlib.animation as animation
FFwriter = animation.FFMpegWriter(fps=10)
...
ani.save('./temp/animation.mp4', writer = FFwriter)
I get the ...
4
votes
1
answer
127
views
ffmpeg: How to merge multiple audio files into stereo
I have an initially undefined number of input mono audio files (.wav) that I want to merge into a single stereo output audio file (.mp3), so that one of the input files goes into left channel, and all ...
0
votes
1
answer
161
views
Discord Music Bot FFMPEG Troubleshooting
I am trying to create a Python Cog for a Discord.py bot on Windows 10 that allows the bot to join a voice channel to play music or funny audio. It is just something for me and my friends to goof off ...
1
vote
2
answers
806
views
convert YT video to audio file - "ERROR: Postprocessing: audio conversion failed: Error opening output files: Encoder not found"
I am using yt_dlp with Python to load a video from Youtube as an audio-only mp3 file. Until recently this worked fine, but now I get the following error message:
ERROR: Postprocessing: audio ...
-1
votes
1
answer
551
views
How to fix the ffmpeg python issue "Error applying option 'original_size' to filter 'ass': Invalid argument"?
ENVIRONMENT:
Python 3.10
Windows 11
ffmpeg-python==0.2.0
CONTEXT:
I am trying to add hardcoded subtitles on a video with ffmpeg and Pyton.
PROBLEM:
ffmpeg is not able to find the path of my ass ...
1
vote
2
answers
222
views
How to resize dimensions of video through ffmpeg-python?
I'm trying to resize a video file which a user has uploaded to Django, by using ffmpeg-python. The documentation isn't very easy to understand, so I've tried to cobble this together from various ...
2
votes
0
answers
123
views
Automate removing segments of a video using ffmpeg-python
I'm very new to ffmpeg and unable to wrap my head around the concepts entirely. My goal for this little script I've been working on all day is to:
Step 1: Read a list of timestamps from a text file ...
-1
votes
1
answer
156
views
How to Stream Audio from Google Cloud Storage in Chunks and Convert Each Chunk to WAV for Whisper Transcription
I'm working on a project where I need to transcribe audio stored in a Google Cloud Storage bucket using OpenAI's Whisper model. The audio is stored in WebM format with Opus encoding, and due to the ...
0
votes
1
answer
68
views
Saving frames for mov file with multiple streams using python-ffmpeg
I have a mov file with multiple video streams, and I'm trying to use ffmpeg python bindings to read each stream and save all of its frames.
To do so, I've made a code similar to this one:
import numpy ...
0
votes
1
answer
198
views
Getting Error while trying to download youtube video by using python
Code
I'm working on a script that allows users to manually select and download separate video and audio streams from YouTube using yt-dlp. The script lists the available video and audio formats, lets ...
0
votes
1
answer
440
views
AttributeError: 'FilterableStream' object has no attribute 'input' - ffmpeg-python
I am a fresh programmer and I am learning the Python language.
I have been trying to design a graphical application (using tkinter and ffmpeg-python libraries) that converts an image file along with ...
-1
votes
2
answers
72
views
how i can save overlay text box with a video in gallery by using ffmpeg?
final escapedOverlayText = overlayText.replaceAll(''', '\'');
final command =
'-i $videoPath -vf "drawtext=text='$escapedOverlayText':x=10:y=10:fontsize=24:fontcolor=white" -c:a copy $...
0
votes
0
answers
106
views
ffmpeg python causing deadlock
I am facing issues using ffmpeg python to process camera frames. My first approach with process.communicate() worked well, but has latency issues.
process = (
ffmpeg
.input('...
-1
votes
1
answer
110
views
How Do I Get Python To Capture My Screen At The Right Frame Rate
I have this python script that is supposed to record my screen, on mac os.
import cv2
import numpy as np
from PIL import ImageGrab
import subprocess
import time
def record_screen():
# Define the ...
-1
votes
1
answer
56
views
Trying to convert code to be compatible with macOS by not using the .exe version of FFmpeg and FFmprobe. Cant open the .mp4 file when i go to run code
I am attempting to edit some code in python for extracting frames from a video (using parallel processing to make it faster) a friend created that works on windows, so that it can be used on macOS. ...
1
vote
0
answers
237
views
the "non-monotonic DTS in output stream " error while concatenation even after reencoded input files
hi I am trying to write a Python program that is trying to first edit different videos separately under the heading "intro" "story" and "byte" with the help of FFmpeg and ...
0
votes
1
answer
88
views
TypeError: source must be an AudioSource not FFmpegOpusAudio
async def play(ctx, *, link):
try:
voice_client = await ctx.author.voice.channel.connect()
voice_clients[voice_client.guild.id] = voice_client
except Exception as e:
...
1
vote
0
answers
219
views
How do I merge video, audio and subtitles together in ffmpeg via python?
I have been trying to merge a video, audio and subtitle stream in ffmepg but, since it is my first time trying it out, I am having a bit of trouble figuring out how to do so.
Goal: The output I am ...
1
vote
1
answer
1k
views
Coordinates with file format .ASS
I'm grabbing my text coordinates that I want to use for the file format .ASS and for centering on a 1080 by 1920 video, I have an application that displays where the text is on the video and can ...
1
vote
1
answer
110
views
FFMPEG stream from python to browser using socketio
I want to show the video on the browser streamed by ffmpeg.
Here's the python script which i made but can't find the way to do so since i am not much into javascript. Can anyone help me please ?
...
-1
votes
1
answer
159
views
ffmpeg subtitles filter defaults to Helvetica instead of specified font
I am trying to use a custom font in the subtitles of a video using ffmpeg, but despite my efforts, the font defaults to Helvetica. Here is the code I am using:
import ffmpeg
import os
import tempfile
...
0
votes
2
answers
219
views
FFmpeg-Python command too long because of drawtext
I have a FFmpeg-Python program that puts subtitles into a video, pseudocode below:
for i in range(10000):
video= video.filter(
'drawtext', fontfile=FONT_FILE, text=cur_string, x='(w-text_w)...
0
votes
0
answers
182
views
ffmpeg python error when adding subtitles
When I run it I think there is an error with the subtitle path, but I can't solve it.
The error in terminal:
[Parsed_subtitles_0 @ 0000019bcc509780] Unable to parse option value
"...
1
vote
1
answer
453
views
Streaming audio over websockets and process it with ffmpeg, Invalid frame size error
I am building an application in Python that processes audio data on a streaming connection with WebSockets. To work with it, I need to process it with ffmpeg on the server before passing it to some ML ...
-1
votes
1
answer
111
views
define the input FPS of a stream using ffmpeg-python
Im creating an HLS playlist using ffmpeg, reading my input from an RTSP stream.
When probing the RTSP stream, i get an FPS which is not the true FPS, and i want to "tell" ffmpeg the actual ...
1
vote
1
answer
2k
views
FileNotFoundError: [WinError 2] The system cannot find the file specified - FFMPEG
I am running a script using conda environment on Windows and getting this error (stack trace below), which is apparently caused by python executable not being able to find the ffmpeg.exe. There are ...
-1
votes
1
answer
131
views
edit a video in python [closed]
I'm trying edit a MP4 video using ffmpeg-python library but I get
TypeError: 'ffmpeg' has no attribute 'input'
Here is my code, directly copied from the official repository):
import ffmpeg
x=ffmpeg....
-1
votes
1
answer
448
views
Is there an efficient way to use ffmpeg to perform a large quantity of cuts from a single file?
I'm trying to cut video files into smaller chunks. (each one being one word said in the video, so they're not all of equal size)
I've tried a lot of different approaches to try to be as efficient as ...
0
votes
1
answer
1k
views
Play a video with ffmpeg and SDL2 on a Raspberry Pi 5
I want to create a python script that decodes a h264 1080p video and outputs it via SDL2 on a Raspberry Pi 5. The Raspberry Pi 5 is able to play a h264 1080p video without problem using VLC. Total CPU ...
0
votes
1
answer
333
views
Subtitels with ffmpeg-python
I'm currently working on a video processor project and aiming to generate subtitles for the videos processed.
I've found that code that combines audio, video, and adds subtitles. However, I'm ...
2
votes
0
answers
214
views
How to interpret ndarray in a pyAV AudioFrame?
I want to process streaming audio (coming in from a person speaking on the peer of a webRTC peer connection) to detect when the person is done talking. I have got the audio track and access to ...
0
votes
0
answers
234
views
ffmpeg-python lib's 'run' function works locally but doesn't work in server
I am using ffmpeg-python library to process video, specifically I had to add watermark to video. Code is very simple:
def set_watermark_to_video(
video_url: str,
directory: str,
filename: ...
1
vote
0
answers
814
views
Python - Extracting audio from video files to numpy array using ffmpeg
I want to use python & ffmpeg-python to extract the audio from a video directly into numpy array.
Currently, I first dump the audio as a wav file using ffmpeg through CLI and read it back to ...
0
votes
0
answers
202
views
how to use ffmpegs's afir in ffmpeg-python
My goal is to slow down a file and add reverberation using python
here's my code:
import ffmpeg
audio = ffmpeg.input(r'test_files\Gorillaz - Rhinestone Eyes.mp3').audio
audio = audio.filter('...
-1
votes
1
answer
320
views
How to edit metadata using ffmpeg-python?
import ffmpeg
input= "input.mkv"
output = "output.mkv"
title = "Clinton Abraham"
try:
datas = 'title=' + title
mains = ffmpeg.input(input)
nemos = mains....
0
votes
1
answer
250
views
Is it possible to save snapshots from multiple video streams using ffmpeg?
I would like to periodically save a snapshot from a video stream using ffmpeg. This is is possible using the following command:
ffmpeg -i [source] -r 0.2 -f image2 ./image-%04d.jpeg
or the (rough) ...
1
vote
1
answer
348
views
ffmpeg mp3 chunk to wav chunk adds gap in the start of the audio
I have an mp3 streaming from a URL, I save the chunks in 1024 byes buffer size.
After I get all the chunks, I'm using ffmpeg to convert the incoming mp3 chunk (22050 mono) to a wav chunk.
When I open/...
0
votes
0
answers
117
views
Popen subprocess giving wrong ffmpeg process ID when trying to close
I'm trying to create a Video Management System application using Python and Django, that displays live camera stream and do video recording. For this, I add cameras using POST request and everything ...
0
votes
1
answer
115
views
FFMPEG: How to add transparency to watermark logo? Getting error: "Filter scale2ref has an unconnected output"
Hey guys I am new to Ffmpeg, I want to resize a watermark logo according to the video size and add transparency to it. The code I have is not working as expected.
This is the code
ffmpeg -i $...
0
votes
1
answer
539
views
Add subtitles starting at a specific timestamp using Ffmpeg-Python
I want to add a .srt file (subtitles) to a .mp4 video. How can I add the subtitles at a specific timestamp?
As an example, my .mp4 video starts the talking part at 00:00:25, so thats there where I ...
-1
votes
1
answer
148
views
Discord Python Music Bot Not Playing Music
I am new to making discord bots and while I was making a music bot and run on my ubuntu server with python Venv I receive some random number while I tried to play music and the music didn't start. But ...
0
votes
1
answer
140
views
Running command Subprocess python failed but the same exact command runs well in Terminal
As the title says: weird problem. I've been struggling to make this work for a whole day but to no avail. Any help would be deeply appreciated.
# I've tried every one of the below path but still ...
2
votes
1
answer
316
views
Timeline editing with ffmpeg-python
I'm trying to draw a box on one part of the screen at a specific instance in time. I've tried looking through the documentation for ffmpeg-python, but am unable to locate any instance of support for ...
0
votes
0
answers
138
views
How can I use the 'afade' parameter in ffmpeg-python without getting an 'option not found' error?
I am using the ffmpeg library with python to add subtitles and a video as an overlay to a background still image. This code is working fine, but I want to use the afade parameter. The code without ...
1
vote
1
answer
430
views
How to use argument with dash in name in ffmpeg-python?
Following is a simple ffmpeg command line for encoding an input video into a AV1 output with CRF 30:
ffmpeg -i input.mkv -c:v libsvtav1 -crf 30 output.mkv
Converting that command line into the syntax ...
0
votes
2
answers
1k
views
How do I reverse a video in ffmpeg?
- Full Error:
Stream specifier 's1:v' in filtergraph description [0]split=2:outputs=2[s0][s1];[s1:v]reverse[s2];[s0][s2]concat=a=0:n=2:v=1[s3] matches no streams.
- Formatted Error
[0]split=2:outputs=...
0
votes
1
answer
58
views
How to translate ffmpeg linux comand into python
I'm using this to join screenshots into a movie
ffmpeg -hide_banner -loglevel error -framerate 1 -pattern_type glob -i "$1" -c:v libx264 -pix_fmt yuv420p $2
But is there a way to translate ...
0
votes
1
answer
51
views
"No Output pad"error when using ffmpeg to create a subtitle overlay
I am using a Lambda function to run ffmpeg to rescale a video and then add subtitles from an .ass file.
I have tried a few variations, but am continuing to get an error:
[AVFilterGraph @ 0x721bec0] No ...
0
votes
0
answers
61
views
How to merge two videos, so that the scale of the video takes up 50% of the size of the output video
How to merge two videos, so that the scale of the video takes up 50% of the size of the output video.
For example I need to merge two videos so that one half of the video takes up 50% of the output ...
0
votes
1
answer
808
views
reverse Video: Moviepy Error, by using time.mirror
im desperately trying to reverse a movie with moviepy by using .time_mirror.
from moviepy.editor import *
import moviepy.video.fx.all as vfx
# Load the video
video = VideoFileClip("/videos/uncut/...