2014-09-26 259 views
0

我在上次购买的一个用于转换视频的php脚本中遇到了此代码。该脚本在Ubuntu 12.04使用FFMPEG将视频转换为FLV

-i $file_source -b 9600k -aspect 16:9 -acodec aac -strict experimental -ab 128k -ar 22050 $file_dest" 

也就是说元素/属性的全部含义运行,可能是什么替代方案?

感谢您的帮助

+0

确切地说你想要什么? – 2014-09-26 09:17:17

+0

我想将用户提交的视频转换为flv – 2014-09-27 08:49:31

回答

1

您可以使用下面的命令使用的ffmpeg转换视频

所需的codec:

  1. libmp3lame - acodec
  2. libfaac - acodec
  3. libvorbis - acodec
  4. libx264 - 了vcodec
  5. libtheora - 了vcodec
  6. libvpx - 了vcodec
  7. FFmpeg的内部版本 - ffmpeg的版本N-54207-ge59fb3f

命令如下 -

  1. 转换为flv -

    $file_source = "/tmp/test.mp4"; 
    $file_dest = "/tmp/test.flv"; 
    ffmpeg -i $file_source -pass 1 -vcodec libx264 -preset slower -b 512k -bt 512k -threads 0 -s 640x360 -aspect 16:9 -acodec libmp3lame -ar 44100 -ab 32 -f flv -y $file_dest 
    
  2. 转换到MP4,支持HTML5 -

    $file_source = "/tmp/test.flv"; 
    $file_dest = "/tmp/test.mp4"; 
    ffmpeg -y -i $file_source -vcodec libx264 -q:v 1 -preset slower -profile:v baseline -level 30 -crf 30 -vf scale="480:360" -aspect 16:9 -s 640x360 -acodec libfaac -ab 128k -ac 2 -coder ac -me_range 16 -subq 5 -sc_threshold 40 -partitions +parti4x4+partp8x8+partb8x8 -i_qfactor 0.71 -keyint_min 25 -b_strategy 1 -g 250 -r 20 -f mp4 $file_dest 
    
  3. 转换为WebM的支持HTML5 -

    $file_source = "/tmp/test.mp4"; 
    $file_dest = "/tmp/test.webm"; 
    ffmpeg -y -i $file_source -vcodec libvpx -b:v 480k -bt 480k -preset slower -level 30 -crf 30 -vf scale="480:360" -aspect 16:9 -s 640x360 -acodec libvorbis -ab 128k -ac 2 -coder ac -me_range 16 -subq 5 -sc_threshold 40 -partitions +parti4x4+partp8x8+partb8x8 -i_qfactor 0.71 -keyint_min 25 -b_strategy 1 -g 250 -r 20 -f webm $file_dest 
    
  4. 转换为远洋船支持HTML5-

    $file_source = "/tmp/test.mp4"; 
    $file_dest = "/tmp/test.ogv"; 
    ffmpeg -y -i $file_source -vcodec libtheora -b:v 480k -bt 480k -preset slower -level 30 -crf 30 -vf scale="480:360" -aspect 16:9 -s 640x360 -acodec libvorbis -ab 128k -ac 2 -coder ac -me_range 16 -subq 5 -sc_threshold 40 -partitions +parti4x4+partp8x8+partb8x8 -i_qfactor 0.71 -keyint_min 25 -b_strategy 1 -g 250 -r 20 -f ogg $file_dest; 
    

欲了解更多有关ogg,mp4,web检查链接的信息,请访问:html5-videos-things-you-need-to-knoweasyhtml5video

1

这是FFMPEG
命令行指令,你可以在阅读的替代选项的文档:FFMPEG Docs

反正只是为了解释..

-i $file_source -b 9600k -aspect 16:9 -acodec aac -strict experimental -ab 128k -ar 22050 $file_dest

其中..
-i $file_source是输入文件(任何媒体类型)

-b 9600k是视频比特率

-aspect 16:9正在使用AAC编解码器(宽屏

-acodec aac -strict experimental是实验性的编解码器,以便使用严格无论如何强制使用)

-ab 128k是音频比特率128kb/s

-ar 22050是音频采样率22。05千赫

$file_dest输出文件名(带有扩展,使FFMPEG知道你的首选输出格式