![]() So, assuming the trim command you added above in your question works, your final command should look something like this: ffmpeg -ss 823.2 -t 44.1 -i input.mp4 -ss 1074.1 -t 27.3 -i input.mp4 -filter_complex "concat=n=2:v=1:a=1" -map "" -map "" -vcodec libx265 -fs YOUR_FILE_SIZE_IN_BYTES -crf 29 output.mp4 I suggest playing around with the -fs and -crf limit until you get a file size and video quality you're happy with. If you wanted your -crf value to be 28, you would type -crf 28 and you can adjust that number as you desire. You can do this by just searching "mb to bytes" or "gb to bytes" in google. You must convert the file size from megabytes (or gigabytes, depending on what you want) to bytes. To use -fs, if, for example you wanted to limit your file size to 250mb, you would add -fs 250000000 To use -vcodec in the way I have described above you would add -vcodec libx265. Higher crf value means lower bitrate, and as such, lower crf values correspond the higher bitrates, so adjust this as you will. You should also add a -crf value - change this to something around 26-30. Using -vcodec h265 could also help as the H.265 codec allows for smaller file sizes and it is newer. Of course, make it a reasonable size, not so small that your media is unwatchable. ![]() You can limit the file size with -fs and then specify your desired file size in bytes. See Limit file size in FFmpeg for more info about -fs. ![]() It does not automatically fit the complete video to fit a specified size. fs is supposed to stop encoding when the output reaches a certain size. If you need to target a specific output file size Libx265 also uses -crf and -preset, but the -crf values are somewhat different.Įxample: ffmpeg -ss 823.2 -t 44.1 -i input.mp4 -ss 1074.1 -t 27.3 -i input.mp4 -filter_complex "concat=n=2:v=1:a=1" -map "" -map "" -c:v libx265 -crf 35 -preset slow output.mp4 This format may not be supported by your player/device. It is a slower encoder but will usually output a smaller file size for the same quality. Default is medium.Įxample: ffmpeg -ss 823.2 -t 44.1 -i input.mp4 -ss 1074.1 -t 27.3 -i input.mp4 -filter_complex "concat=n=2:v=1:a=1" -map "" -map "" -c:v libx264 -crf 29 -preset slower output.mp4Īdd -c:v libx265 to output HEVC/H.265 video instead of H.264. A slower preset: enables more fancy and complicated compression features, takes longer to encode, and usually provides a smaller file size. Use -preset to control compression efficiency and therefore encoding speed. The output file size cannot be predicted using -crf. Increasing the CRF value by +6 will result in about 50% smaller output size (such as -crf 23 vs -crf 29, not comparing input vs output sizes). Use the highest value that still provides an acceptable quality. A higher value is a lower quality and therefore a lower file size. Default encoder is libx264 (most builds of ffmpeg have -enable-libx264 so I'll assume yours does too).Ĭontrol quality with -crf.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |