2

There are several big video files(.mp4) and I want to reduce the size of them to at least half or even less in cost of losing quality, but I want to do this in the fastest way.

I've tried with libx265 or libx264, the output quality is pretty good but it cost too much time. I want to do this faster and I CAN accept a relatively lower quality. Is there any method to do this?

1
  • Fastest is probably very dependent on what hardware you're using. In particular, whether you have GPU codec support and/or CPU features to accelerate video encoding. Commented Nov 16, 2021 at 10:44

2 Answers 2

5

You can use the preset modifier to get a faster rendering time as mentioned here:

  • use something like,
    -vcodec libx264 -crf 22 -preset ultrafast
    
  • adjust crf value according to your preference and it will change the video quality (18-24 will preserve the input video quality).
  • Rendering time is totally adjustable with the -preset modifier.
4
  • 2
    Looks good. For that +1 could you modify the example code line to include the invocation of ffmpeg too, please (so we can see examples of where the input and output files would go, etc.) Commented Sep 5, 2022 at 14:06
  • @roaima Here is some code that I hope helps. #!/bin/bash # # Reduce mp4 to 480i resolution and reduce size considerably # [ ! $1 ] && { echo -e "Error!! No filename given."; exit 1; } || echo -e "Searching for $1" ffmpeg -i $1 -s hd480 -strict -2 $1Small.mp4
    – fixit7
    Commented Sep 5, 2022 at 17:35
  • It needs to go into your answer. As code (select the code block and hit the {} button). Comments can - and do - get deleted Commented Sep 5, 2022 at 17:38
  • Thank you! Unlike some other snippets, this one utilizes M1 at 92% (user), and speed raised alot. Commented Apr 7, 2023 at 11:35
-2

Here is some code that I hope helps.

#!/bin/bash
# Reduce mp4 to 480i resolution and reduce size considerably

[ ! "$1" ] && {
echo -e "Error!! No filename given."; exit 1; } || echo -e "Searching for $1"
ffmpeg -i "$1" -s hd480 -strict -2  "$1"Small.mp4
4
  • 1
    Can you explain what makes this fast? Code-only answers have low education value compared to those that properly explain why the code is the way it is. Commented Sep 13, 2022 at 10:24
  • I never said it was fast. @Toby Speight
    – fixit7
    Commented Sep 13, 2022 at 10:26
  • 1
    In that case, you're not answering the question, which is specifically about performing the transcoding quickly. Commented Sep 13, 2022 at 10:27
  • I enjoy helping others. I am not perfect, but that is ok by me. @Toby Speight
    – fixit7
    Commented Sep 13, 2022 at 10:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .