ffmpeg is not compressing the videos

时间:2016-10-20 19:57:40

标签: video ffmpeg compression

I am trying to compress a video using ffmpeg and using the following command. ffmpeg -i data/video.mp4 -vcodec h264 -acodec mp2 data/output.mp4

However, the resultant video's size is more than that of the original video. Can some one point out why this could be happening and if there is other command that I should be using.

1 个答案:

答案 0 :(得分:2)

为了减小文件大小,您应该选择较低的比特率。

您正在使用的ffmpeg参数,使用h264和mp2的默认ffmpeg压缩参数。
默认参数配置为相对较高的质量和较大的文件大小 您可以控制平均比特率,恒定比特率,最大比特率和其他参数 请参阅ffmpeg文档:https://trac.ffmpeg.org/wiki/Encode/H.264#AdditionalInformationTips

您获得更大文件大小的原因是输入文件已经被压缩 如果原始视频是未压缩的原始视频,则压缩文件大小将远小于原始大小 您正在执行名为" transcoding"。的流程 转码过程(通常)将输入解码为未压缩格式,并使用不同(或相同)codec对其进行重新压缩。

检查输入视频的比特率信息:
How to get h264 video info?

ffprobe -show_streams -i "data/video.mp4"

尝试降低比特率:

ffmpeg -i data/video.mp4 -vcodec h264 -b:v 1000k -acodec mp2 data/output.mp4

您也可以尝试使用h265视频编解码器进行编码,这样可以在较低的比特率下保持更高的质量。

请考虑以下事项:

  • 较低的比特率(通常)会降低质量。
  • 视频转码的结果质量低于直接压缩原始视频的质量。