I've followed your suggestion to use dlopen - dlsym - dlclose to call many times the main of ffmpeg. Now I can make my own wrapper library that has different functions all calling the main of ffmpeg with different parameters. Now I'm getting crazy around a problem that I can't understand. I have renamed the main of ffmpeg.c to boss(int argc, char **argv) and I call it from another function (for example get_video_segment()). Why if I call the function boss and I pass it the right parameters it works and if I pass the same parameters to the function called by dlsym I get Must supply at least one output file. Here there is my code: void get_video_segment(int n, int m) { int (*principale)(int argc, char **argv); void* lib_handle; lib_handle = dlopen("libffmpeg.so",RTLD_LAZY);*if*(!lib_handle) { fprintf(stderr,"Coudn't open library libffmpeg.so because os %s", dlerror()); exit(1); }** *(void **)(&principale) = dlsym (lib_handle,"boss"); int hl = m-n;char beg[10];char howlong[10]; sprintf(beg,"%d",n); sprintf(howlong,"%d",hl); parametri[0]="Yasw"; parametri[1]="-ss"; parametri[2]=beg; parametri[3]="-t"; parametri[4]=howlong; parametri[5]="-an"; parametri[6]="-y"; parametri[7]="-i"; parametri[8]=filein; parametri[9]=fileout; nParametri = 10; *//boss(nParametri,parametri);* int ab = (*principale)(nParametri,parametri); dlclose(lib_handle); } It seems that i forget to pass the last parameter... but the same parameters are totally working if I uncomment boss(nParametri,parametri);, and comment the rest. Here there is the complete output: Seems stream 0 codec frame rate differs from container frame rate: 23.98(65535/2733) -> 23.98 (24000/1001) Input #0, avi, from '/users/castrogiovanni/salt/salt.avi': Duration: 00:42:39.6, start: 0.000000, bitrate: 1192 kb/s Stream #0.0: Video: mpeg4, yuv420p, 624x352, 23.98 fps(r) Stream #0.1: Audio: mp3, 48000 Hz, stereo, 160 kb/s Must supply at least one output file Premi Invio per continuare! Thanks in advance
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4