mushfique's avatar

Unable to load FFProbe

On my local pc, I've installed the FFmpeg package and run my Laravel application nicely. But when I deployed my application in the cloud server FFmpeg is not working properly. When I upload an audio file this error occurred. "Unable to load FFProbe" I tried many times to install the FFmpeg package on the cloud server. It shows successfully installed but the package is not working. What can I do now? I am using PHP 8.1 and Laravel version 8

0 likes
27 replies
Sinnbeck's avatar

Can you run it from the shell with ssh? ffprobe

mushfique's avatar

@Sinnbeck I have executed it from my controller

		     $inputAudio = $audio_directory . $file_name;
   			  $outputAudio = $compress_audio_directory . $file_name;
   			  exec("ffmpeg -i $inputAudio -ab 64 $outputAudio");
Sinnbeck's avatar

@mushfique ok can you show the code for that? That's for ffmpeg not ffprobe? And why not just test it via ssh?

mushfique's avatar

@Sinnbeck Sue. I will share my controller code

	public function upAudio(Request $request){

    $user=Auth::user()->name;
    $decoded_file = $request->getContent();  //Decoded audio file
    $audio_parts  = explode(";base64,", $decoded_file);
    $audio_type   = explode("audio/wav", $audio_parts[0]);
    $audio_base64 = base64_decode($audio_parts[1]);
    $audio_directory = 'SFGSG/SGSFVFVGs/SGSDFG/';
    $file_name_no_ext =  'record_'.time().'_'.unique_code(10);
    $file_name = $file_name_no_ext . '.mp3';
    $record = file_put_contents($audio_directory . $file_name, $audio_base64);

    //compress audio start
    $compress_audio_directory = 'SFGSG/SGSFVFVGs/';
    if (!file_exists($compress_audio_directory)) {
        mkdir($compress_audio_directory, 0777, true);
    }
    $compress_file_name_no_ext = 'compress_record_'.time().'_'.unique_code(10);
    $compress_file_name = $compress_file_name_no_ext . '.mp3';

    $inputAudio = $audio_directory . $file_name;
    $outputAudio = $compress_audio_directory . $file_name;
    exec("ffmpeg -i $inputAudio -ab 64 $outputAudio");

    $this->compressPath = $outputAudio;
    $this->x ='22';
    session()->put('compressPath', $outputAudio);
    return response('success');
}
Sinnbeck's avatar

@mushfique how is this code testing that ffprobe is installed correctly? Can you try as I suggested?

mushfique's avatar

@Sinnbeck When I upload audios it shows "Unable to load FFProbe" this error.I am not sure that its an FFmpeg issue or ffprobe issue.But I was pretty sure that these are in the same package

Sinnbeck's avatar

@mushfique they should be installed together yes. But clearly there is a problem. How did you install it? sudo apt install ffmepg?

Sinnbeck's avatar

@mushfique ok then to help i need to know your setup. Is the app inside the same docker container?

mushfique's avatar

@Sinnbeck when I run ffprobe input-file , it shows

ffprobe: command not found

yes. the app is in same docker container

Sinnbeck's avatar

@mushfique then it isn't installed. Can you run ffmepg in the same shell and have that working? How did you install ffmepg? Which command?

mushfique's avatar

@Sinnbeck FFmpeg is installed and it shows the version when I run the following command "ffmpeg -version". then it shows

ffmpeg version 3.4.12 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-44)

but these all are shown in my project directory. but when I run the same command in my docker container

(to enter my docker containers i use "docker exec -it -u root container name bash" command)

to check the version it shows ffmpeg:: command not found.

In my Dockerfile, i am using the following command to install ffmpeg

RUN apt update && apt install -y ffmpeg\apt-utils libonig-dev libzip-dev libxml2-dev autoconf libpng-dev

I don't understand what is happening.Is there any mistake from my end?

Sinnbeck's avatar

@mushfique Can you show your complete Dockerfile? It seems that it isnt installing ffprobe for some reason. Maybe it is a problem with the base image. Does it work with the same docker image locally?

mushfique's avatar

@Sinnbeck locally it works properly.

My DockerFile

		FROM php:8.1-fpm

			# Arguments defined in docker-compose.yml
			ARG user
			ARG uid

			# Copy composer.lock and composer.json
			COPY composer.json /var/www/
			# COPY composer.lock composer.json /var/www/
			# Set working directory
			WORKDIR /var/www
			# Install dependencies
			RUN apt update && apt install -y \
				build-essential \
				default-mysql-client \
				zip \
				jpegoptim optipng pngquant gifsicle \
				nano \
			    unzip \
				git \
				curl\
				ffmpeg\
				apt-utils \
			    libonig-dev\
				libzip-dev\
				libxml2-dev\
				autoconf\
				libpng-dev
								# Clear cache
								RUN apt-get clean && rm -rf /var/lib/apt/lists/*

								# Install extensions
								RUN docker-php-ext-configure gd \
									&& docker-php-ext-install -j$(nproc) gd \
									&& docker-php-ext-install pdo_mysql \
									&& docker-php-ext-install mysqli \
									&& docker-php-ext-install zip \
									&& docker-php-ext-install bcmath \
								 && docker-php-ext-install mbstring \
									&& docker-php-ext-install exif \
									&& docker-php-ext-install pcntl \
									&& docker-php-source delete 
								# && docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
								# && docker-php-ext-install pdo pdo_pgsql pgsql

				# Install composer
				RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

				# Create system user to run Composer and Artisan Commands
				RUN useradd -G www-data,root -u $uid -d /home/$user $user
				RUN mkdir -p /home/$user/.composer && \
				 chown -R $user:$user /home/$user

				# Set working directory
				WORKDIR /var/www

				 USER $user
				 EXPOSE 9000
				 CMD ["php-fpm"]
Sinnbeck's avatar

@mushfique It looks fine. If I recall correctly php:8.1-fpm is based on either debian or ubuntu. I cannot say why it isnt working then. I just added ffmpeg to one of my debian dockerfiles and rebuilt it, and I have both installed now

ff

1 like
mushfique's avatar

@Tray2 I run this command but it shows

"Package ffmpeg-3.4.12-1.el7.x86_64 already installed and latest version

No package ffprobe available.

Nothing to do"

Tray2's avatar

@mushfique What do you get if your run this command

find . -name "ffprobe*"

If you get this response, then it's not installed

find: ffprobe: No such file or directory
Sinnbeck's avatar

@Tray2 Think that should be / instead of . as it probably isnt installed in the current directory :)

mushfique's avatar

@Tray2 I run this command, it shows nothing

If not installed it should show ffprobe: No such file or directory.but nothing shows

Tray2's avatar

@Sinnbeck It depends,

If you do . then it looks recursively from the current directory. and if you do / it looks from the root.

The / might give some permission errors since it tries to access everything.

deepak1234's avatar

Hi I am also facing the same issue on linux server but i am able to see the ffprove installed on my server.

Getting error:"Unable to load FFProbe"

Please or to participate in this conversation.