-
Notifications
You must be signed in to change notification settings - Fork 12
How to change filter_complex #460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
In FFmpeg, when you use the setsar filter with a single value like setsar=1, you’re setting the sample aspect ratio (SAR) to 1:1, indicating square pixels. This is because, in FFmpeg’s filter syntax, if you provide unnamed parameters, they are assigned based on the order of the filter’s declared options. For the setsar filter, the parameters are declared in the following order: Therefore, setsar=1 is interpreted as setting sar=1. In a library context, such as when using a method like .setsar(), you would specify the parameter explicitly:
This ensures clarity and aligns with the parameter’s intended use. |
Yes, you’re correct. In typed-ffmpeg, the safe parameter is not directly available in the input() function. To specify it, you should use the extra_options dictionary, as it’s a special input parameter. Here’s how you can set it:
In this example, This approach aligns with how |
Thank you very much! I have this command, which I attached in the example above, and the problem is with filter-complex. If [0:v] is first — the main video — the overlay video lasts 1 second and then stops. When I make the first video concat - [1:v], everything works fine. Can I control this in the library? |
I found a solution, but it's a workaround. Method compile
|
Yes, you can pass the entire foreground stream directly to the overlay filter instead of just foreground.video(0), provided that the stream contains only video data. If you encounter any issues or need further assistance, feel free to ask! |
I’m trying to understand and reproduce the issue you mentioned. Could you clarify what you mean by “swap”? Are you referring to just switching the order of the following two lines, without making any other changes?
So the only difference would be swapping line 6 and line 7? Please confirm, or let me know if there were any other modifications involved in the working version. |
Yes, that's correct. If I leave everything as it is in this command, it doesn't work. When I swap the sixth and seventh lines, everything works. |
Sorry, I ran some experiments but couldn’t reproduce the issue on my end — the two commands generated identical outputs for me. That said, FFmpeg can behave differently depending on subtle factors, so I agree that anything can happen under the hood. Could you let me know which FFmpeg version you’re using? |
@odi1n would you please provide more hint for me to reproduce the issue? |
Please tell me how to implement the following.
I have a list of videos, they are of different sizes, and I need to overlay them on the main video. I composed the following FFmpeg command:
After that, I wrote a Python script using the library:
As a result, I get the following FFmpeg command:
However, it doesn’t work as intended—the overlaid videos last only 1 second and abruptly cut off. I figured out that the problem lies in the following: these lines need to be swapped:
As soon as I swap them, everything starts working. How can I do this using the library?
Also, while working with the library, the following question arose.
As you can see from my command, I need to specify
setsar=1
, but in the library, the.setsar()
method has several parameters: sar and max. How can I specify setsar=1?Can I pass the entire foreground stream here instead of just video(0)?
I checked the issues and examples, and the
input
method used to have asafe
parameter, but now it's missing. How can I specify it? Throughextra_options
?The text was updated successfully, but these errors were encountered: