简体   繁体   中英

ffmpeg output file is too large

I want to burn a subtitle file(.srt) to a mp4 video.My command is:

ffmpeg -i input.mp4 -c:v mpeg4 -q:v 1 -vf subtitles=input.srt out.mp4

It output a video with a good quality,but its size is 1.12GB while the input file is 213MB.

I think the problem is kbps of output file is too high.the bitrate of input file is 568 kb/s but the output file is 3154 kb/s.

So I want to set the kps,now here is my code:

ffmpeg -i input.mp4 -b:v 569k -minrate 568k -maxrate 570k -c:v mpeg4 -q:v 1 -vf subtitles=input.srt out.mp4

Although the output file become smaller(538MB),the video's quality is awful(Compare with input file)... So how to make the output file smaller and in good quality?Thanks.

Try this:

ffmpeg -i input.mp4 -c:v libx264 -crf 23 -vf subtitles=input.srt out.mp4

This uses the x264 library instead of mpeg4. It's newer and has better compression. You might try playing around with the 23 being passed to the -crf option. The Constant Rate Factor will give better results and higher file sizes at lower values, and poorer results with smaller files sizes at higher values. Try for something between 20 and 30.

If you're sure you want to stick with mpeg4, this page details the options a bit more and might help.

And if you want to make your subtitles look nicer, take a look at the different options for subtitles , such as using different fonts.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM