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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With