Score:0

How to convert any video to mp4 with php, ffmpeg and CentOS

us flag

I have been converting videos for about a year working in localhost on a Mac. The path is, '/usr/local/bin/ffmpeg' and it has always worked fine. Recently, I installed ffmpeg on my server, with a CentOS 8 operating system, and the php script I have recently used is not working. My question is, 'Where is the path for ffmpeg in CentOS 8?'

cn flag
what does `which ffmpeg` say?
margie avatar
us flag
It says 'bindir=/usr/bin --datadir=/usr/share/ffmpeg'
Score:2
cn flag

On the Mac I will assume you installed ffmpeg with brew which does a local build, hence why it ends up under /usr/local

The build for centos probably comes as a pre-built RPM installed with dnf or yum so under normal circumstances will be installed into /usr/bin.

The which command will will search the PATH variable to find the command passed as an argument. e.g.:

$ which ffmpeg
/usr/bin/ffmpeg
margie avatar
us flag
I think there's something wrong in the command line in the php file: exec($ffmpeg . ' -i "' . $uploaded_file . '" -c:v libx264 "./testuploads/converted/' . $video_mp4 . '" -y 1>convert.txt 2>&1', $output, $convert_status['mp4']);
djdomi avatar
za flag
@margie update the question and show the complete script. however web development is off topic on serverfault.com
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.