Convert video while uploading [closed]

2019-03-22 11:28发布

问题:

I want to convert a video (say from wmv format to flv) while a user uploads it. I can either convert a video or upload it individually, but how to do them at once?

Iam using ffmpeg for conversion, like:

ffmpeg -i WMV.wmv WMV.flv

But iam unsure about the steps to be followed to convert and upload a video. Do i need to use Ajax or something like that?

回答1:

FFMPEG is a pretty powerful plugin

For PHP side execution example

<?php

     /*** convert video to flash ***/
     exec("ffmpeg -i video.wmv -ar 22050 -ab 32 -f flv -s 320x240 video.flv");

?>

The terms used

 -i Input file name
 -ar Audio sampling rate in Hz
 -ab Audio bit rate in kbit/s
 -f Output format
 -s Output dimension

To know the advanced uses of FFMPEG Check the link

FFmpeg Tricks You Should Know About



标签: php ffmpeg