dqz30992
2012-03-16 12:42
浏览 49
已采纳

如何在PHPmotion中使用ffmpeg&mp4box将视频从任何视频转换为mp4时减小文件大小?

I am using ffmpeg & mp4box in my PHPmotion site to convert videos to mp4 format. When I convert a 50MB video to mp4, the file size remain same. So Its affecting the video streaming in my site. So I want to reduce the file size of the video in conversion. This is my code example, that I've used the site for converting m4v videos in PHPmotion.

$ffmpeg_cmd2_2 = "$config[path_to_ffmpeg] -i $raw_video_path -vcodec libx264 -vpre veryfast -crf 15 -b 5120000 -threads 0 -acodec libfaac -ac 2 -ab 128k -ar 44100 -f mp4 $new_flv_1";
$mp4box_cmd = "$mp4box_path -add $new_flv_1 $new_flv_2" 

When I use this command,it converts the m4v file to mp4 format, but the filesize doesn't change. What command I should use in this to reduce the filesize during video conversion in PHPmotion? Can anyone write a ffmpeg command to reduce the filesize during conversion ?

图片转代码服务由CSDN问答提供 功能建议

我正在使用ffmpeg& 我的PHPmotion网站中的mp4box将视频转换为mp4格式。 当我将50MB视频转换为mp4时,文件大小保持不变。 所以它影响了我网站上的视频流。 所以我想减少转换中视频的文件大小。 这是我的代码示例,我使用该网站在PHPmotion中转换m4v视频。

  $ ffmpeg_cmd2_2 =“$ config [path_to_ffmpeg] -i $ raw_video_path -vcodec libx264  -vpre veryfast -crf 15 -b 5120000 -threads 0 -acodec libfaac -ac 2 -ab 128k -ar 44100 -f mp4 $ new_flv_1“; 
 $ mp4box_cmd =”$ mp4box_path -add $ new_flv_1 $ new_flv_2“
   
 
 

当我使用此命令时,它将m4v文件转换为mp4格式,但filesize不会更改。 我应该使用什么命令来减少PHPmotion中视频转换期间的文件大小? 任何人都可以写一个ffmpeg命令来减少转换期间的文件大小吗?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dp709369831 2012-03-21 21:05
    已采纳

    There are two main factors involve in reducing the size of mp4 video

    i: width and height of video, greater their widths, greater will be size and slower will be streaming e,g 360p, 480p, 720p, 1080p

    ii: video bitrate, greater will be their bitrate, higher will be quality, size and slower will be their streaming.

    For faster streaming i recommend using

    i: 480x360 or lower width and height of video ii: -b value 360k or lower. iii: -ab value 64k (optional)

    Hope this will help you.

    已采纳该答案
    打赏 评论
  • douzhuang2016 2012-10-25 12:02

    Apart from using smaller video frame size, you need to use higher crf value to achieve bitrate reduction while maintaining good video quality.

    Replace this

    -crf 15 -b 5120000
    

    with

    -crf 22
    
    打赏 评论

相关推荐 更多相似问题