[FFmpeg-user] Generating bloated videos

Cecil Westerhof Cecil at decebal.nl
Sat Jun 3 15:41:44 EEST 2023


Cecil Westerhof via ffmpeg-user <ffmpeg-user at ffmpeg.org> writes:

> Bouke / edit 'B <bouke at editb.nl> writes:
>
>>> On 3 Jun 2023, at 12:37, Cecil Westerhof via ffmpeg-user <ffmpeg-user at ffmpeg.org> wrote:
>>> 
>>> I am not knowledgeable in the fine points of video processing, so it
>>> is possible that I ask for something that is not realistic.
>>> 
>>> Sometimes the output stream becomes bigger as the input stream and I
>>> find this strange.
>>> In the past I used:
>>>    -vcodec libx264 -crf 26
>>
>> 26 is bad quality, 23 is default, stick to that. (Good quality /
>> small size)
>
> As I said: I did not see any difference when using 26 with the
> original. A long time ago I did a lot of experimenting and this what I
> (then) saw as most optimal regarding time and size.
>
> But I forgot an important point I come back on later in this email.
>
>
>>> and this gave videos that I saw no difference in and where often
>>> 1/14th of the original size.
>>> 
>>> But sometimes they become bigger.
>>> 
>>> For example I have an input file of 117.5 MB.
>>> If I use:
>>>    ffmpeg -i ${inputfile}           \
>>>           -vcodec libx264           \
>>>           -crf 28                   \
>>>           -af "volume=${volumeCmd}" \
>>>           -y ${outputfile}
>>
>> Perhaps input file has compressed audio and output file uncompressed?
>>
>>
>>> the output file becomes 129.4 MB.
>>> 
>>> Well that could be because of the audio filter.
>>> But when I do:
>>>    ffmpeg -i ${inputfile}           \
>>>           -vcodec copy              \
>>>           -af "volume=${volumeCmd}" \
>>>           -y ${outputfile}
>>> 
>>> the output file becomes 110.7 MB. Almost 2/13 smaller.
>>> 
>>> This seems strange to me, or am I missing something?
>>
>> The size also has to do with the encoding speed
>> You can gain some bits if you give FFmpeg more time.
>> Try ‘-preset slower’ in your line.
>
> The funny thing was in the past I had speed and smaller size with:
>     -preset veryfast
>
> I try the different options again and come back.

Copy is very fast and gives 110.7 MB.

crf 28 with veryfast gives 119.2 MB and timing is:
    real    0m59.44s
    user    3m19.31s
    sys     0m2.64s
    perc    339.76

With slower gives 126.5 MB and timing is:
    real    10m13.29s
    user    31m9.92s
    sys     0m10.16s
    perc    306.60

So veryfast is better as slower and just copying is still better.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


More information about the ffmpeg-user mailing list