Results 1 to 2 of 2
I want to exec ffmpeg in my program
My test code is as follows:
if ((ppid = fork()) == 0)
{
execl("/bin/sh", "sh", "-c", "./ffmpeg -i ./sample1.mp4 -vcodec libx264 -b ...
- 04-14-2010 #1Just Joined!
- Join Date
- Apr 2010
- Posts
- 2
A problem about exec ffmpeg
I want to exec ffmpeg in my program
My test code is as follows:
if ((ppid = fork()) == 0)
{
execl("/bin/sh", "sh", "-c", "./ffmpeg -i ./sample1.mp4 -vcodec libx264 -b 768k -r 29.97 -s 400x300 test.mp4" , NULL);
}
But when I exec this code, ffmpeg is blocked in "Press [q] to stop encoding", and test.mp4 file is always 48KB.
Where my problem is ?
Thanks.
- 04-15-2010 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
Why are you creating a shell to run ffmpeg? In any case, the current process is being superceded by /bin/sh. The ffmpeg application needs a real device for stdout, stderr, and stdin, so if this application was not being starting in a terminal/console, it will hang. You can redirect I/O to /dev/null and that will probably work, even if you aren't running this application in a terminal/console.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote