Reputation: 11
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.
Upvotes: 1
Views: 2281
Reputation: 32124
In order to reduce file size, you should select lower bit rate.
The ffmpeg parameters you are using, use default ffmpeg compression parameters of h264 and mp2.
Default parameters are configured for relativly high quality, and large file size.
You can control Average Bit Rate, Constant Bit Rate, Maximum bit rate and other parameters.
Refer to ffmpeg documentation: https://trac.ffmpeg.org/wiki/Encode/H.264#AdditionalInformationTips
The reason you are getting larger file size, is that the input file is already compressed.
In case original video were uncompressed raw video, the compressed file size would be much smaller than original size.
You are performing a process called "transcoding".
The transcoding process, (usually) decode the input to uncompressed format, and re-compress it, using different (or same) codec.
Check the bitrate information of your input video:
see How to get h264 video info?
ffprobe -show_streams -i "data/video.mp4"
Try to reduce the bitrate:
ffmpeg -i data/video.mp4 -vcodec h264 -b:v 1000k -acodec mp2 data/output.mp4
You can also try encoding using h265 video codec, which can keep higher quality with lower bitrate.
Consider the following:
Upvotes: 2