简体   繁体   中英

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?

对Linux使用shell_exe:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM