RNK
RNK

Reputation: 5792

How to do video conversion in php using ffmpeg?

I am using ffmpeg to convert any video to mp4.

I am using this command in my php script to convert video:

echo exec("/usr/bin/ffmpeg -i $inputFile -c:v libx264 -strict experimental $outputFile");

$inputFile  = DOC_ROOT. "media/video/tmp/{$postId}_v.{$ext}";
$outputFile  = DOC_ROOT. "media/video/{$postId}_v.mp4";

But, somehow, it's not converting the video. What could be the reason?

Is there any option to change another method or is there any particular library add to the codeigniter?

Upvotes: 0

Views: 1303

Answers (1)

Grald
Grald

Reputation: 464

Use shell_exe for linux:

shell_exec("ffmpegPath  -i sample.mov-s 1280x720 -metadata title='Sample' -bufsize 1835k -b:v 1000k -vcodec libx264 -acodec libfdk_aac sample.mp4");

Upvotes: 1

Related Questions