Skip to content
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

general uniforms support #21

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

turengege
Copy link
Contributor

@turengege turengege commented Jul 19, 2018

Hi
This feature is unfinished but I think it should help.

Usage:

./ffmpeg -i media/0.mp4 -i media/1.mp4 -filter_complex "gltransition=duration=4:offset=1.5:source=WaterDrop.glsl:uniforms='amplitude=10.0&speed=15.5'" -y out.mp4

Limits:
only int and float are supported

@turengege turengege closed this Jul 19, 2018
@turengege
Copy link
Contributor Author

need more test

@turengege turengege reopened this Jul 19, 2018
@transitive-bullshit
Copy link
Owner

This looks awesome @turengege! Will have some time to view more in-depth this weekend 💯

Thanks!!

@turengege
Copy link
Contributor Author

Int and float vectors are supported now:

ffmpeg -i media/0.mp4 -i media/1.mp4 -filter_complex "gltransition=duration=2:offset=1.5:source=fadecolor.glsl:uniforms='color=vec3(0.0,0.5,0.0)',format=yuv420p" -y out.mp4

I don't have much C Coding experience. Hope for code reviewing and suggestions. @transitive-bullshit

if(sa.len >0){
for(int i = 0;i<sa.len;i+=2){
GLint location = glGetUniformLocation(c->program, sa.strings[i]);
if (location >= 0) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's throw an error if this is not the case; better to be strict with potential errors here rather than ignoring it silently.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an err message can't get location of uniform .. if location is not valid, but I agree that throwing an error is the right choice.

@@ -98,6 +99,7 @@ typedef struct {
double duration;
double offset;
char *source;
char *uniforms;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these uniforms should be freed in uninit

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think FFmpeg will do this cleaning up. I am not sure, will check it out later.

@transitive-bullshit
Copy link
Owner

Added a few quick comments -- overall, this looks really great!

int cursor_start = 0;
int cursor_end= 0;
int cnt_seg = 1;
auto len = (int) (strlen(str_query));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's opt for strnlen_s here, as it's safer, and str_querymay be NULL.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will require users to use C11 if we choose strnlen_s, because FFmpeg seems to be built on C99 by default.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

str_query may be NULL

@xinghuolei
Copy link

awesome! why not merge it ?

@joao-carvalheira
Copy link

Hello, which ffmpeg version were you using?

@owen-m1
Copy link

owen-m1 commented Aug 20, 2019

+1

@turengege
Copy link
Contributor Author

Hello, which ffmpeg version were you using?

I think I use the latest version at that time.

@SiviP-Glossai
Copy link

@transitive-bullshit @xinghuolei What's missing here to merge? I am willing to step in and help finish this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants