3

I use this command below for converting file

./avconv -i inputFile -vcodec libx264 -trellis 2 -crf 23 -tune psnr -vf crop='trunc(iw/2)*2:trunc(ih/2)*2' -y outputFile

But, I don't want to use this command, I want to make a function like

convert(char *inputFile, char *outputFile). (The option of my function like option in command line)

And then I will call it from my main function for example

int main(){ 
    convert(in01, out01); 
    convert(in02, out02); 
    convert(in03, out03); 
    return 0; 
} 

I also read this post. But it is not clear to me.
Could anyone tell me how to solve this problem? I have googled many times but did not find the solution.

Community
  • 1
  • 1
Phien
  • 148
  • 1
  • 14

1 Answers1

0

Assuming you are using Linux OS ...

The solution to your question is more about how to execute a process in C. So, not to do with ffmpeg but to do with programming in Linux C.

Basically you need to first 'fork' a process from your C function, then exchange (exec) the forked process with 'avconv' and pass the arguments into this process.

http://www.yolinux.com/TUTORIALS/ForkExecProcesses.html

Sany Liew
  • 1,615
  • 21
  • 25