使用 FFmpeg 转换到 WebP

使用例

ffmpeg -i "t.jpg" -compression_level 0 -quality 80 -preset photo "[email protected]"

批处理:

for /f "tokens=1 delims=." %%a in ('dir /B *.png') do ffmpeg -y -i "%%a.png" -compression_level 0 -preset picture "%%a.webp"
for /f "tokens=1 delims=." %%a in ('dir /B *.jpg') do ffmpeg -y -i "%%a.jpg" -compression_level 0 -preset picture "%%a.webp"

官方文档

https://ffmpeg.org/ffmpeg-codecs.html#libwebp

-lossless boolean

    Enables/Disables use of lossless mode. Default is 0.
-compression_level integer

    For lossy, this is a quality/speed tradeoff. Higher values give better quality for a given size at the cost of increased encoding time. For lossless, this is a size/speed tradeoff. Higher values give smaller size at the cost of increased encoding time. More specifically, it controls the number of extra algorithms and compression tools used, and varies the combination of these tools. This maps to the method option in libwebp. The valid range is 0 to 6. Default is 4.
-quality float

    For lossy encoding, this controls image quality. For lossless encoding, this controls the effort and time spent in compression. Range is 0 to 100. Default is 75.
-preset type

    Configuration preset. This does some automatic settings based on the general type of the image.

    none

        Do not use a preset. 
    default

        Use the encoder default. 
    picture

        Digital picture, like portrait, inner shot 
    photo

        Outdoor photograph, with natural lighting 
    drawing

        Hand or line drawing, with high-contrast details 
    icon

        Small-sized colorful images 
    text

        Text-like 

添加新评论