Log in

View Full Version : AVC to Animated WEBP


jay123210599
29th September 2024, 00:54
How do I convert an AVC video to a lossless animated webp file, and make the output have the same colors as the input?

Video information:
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.1
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference frames : 4 frames
Format settings, Slice count : 4 slices per frame
Codec ID : V_MPEG4/ISO/AVC
Bit rate mode : Variable
Bit rate : 21.6 Mb/s
Maximum bit rate : 39.0 Mb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.435
Time code of first frame : 00:59:59:00
Stream size : 3.70 GiB (85%)
Language : English
Default : No
Forced : No
Original source medium : Blu-ray

GeoffreyA
1st October 2024, 14:53
Give this a go and see if it works:

ffmpeg -i INPUT -c:v libwebp_anim -lossless 1 OUTPUT.webp

Here is the help from FFmpeg:

Encoder libwebp_anim [libwebp WebP image]:
General capabilities: dr1 delay
Threading capabilities: none
Supported pixel formats: bgra yuv420p yuva420p
libwebp encoder AVOptions:
-lossless <int> E..V....... Use lossless mode (from 0 to 1) (default 0)
-preset <int> E..V....... Configuration preset (from -1 to 5) (default none)
none -1 E..V....... do not use a preset
default 0 E..V....... default preset
picture 1 E..V....... digital picture, like portrait, inner shot
photo 2 E..V....... outdoor photograph, with natural lighting
drawing 3 E..V....... hand or line drawing, with high-contrast details
icon 4 E..V....... small-sized colorful images
text 5 E..V....... text-like
-cr_threshold <int> E..V....... Conditional replenishment threshold (from 0 to INT_MAX) (default 0)
-cr_size <int> E..V....... Conditional replenishment block size (from 0 to 256) (default 16)
-quality <float> E..V....... Quality (from 0 to 100) (default 75)

jay123210599
20th October 2024, 01:23
@GeoffreyA I got this: [libwebp_anim @ 0000022da2913a40] Using libwebp for YUV-to-RGB conversion. You may want to consider passing in RGB instead for lossless encoding.

How do I remove this warning?

Z2697
20th October 2024, 07:04
If you want control over this conversion you can use -vf zscale=min=709[:d=ordered],format=gbrap


Dude...

GeoffreyA
20th October 2024, 07:51
@GeoffreyA I got this: [libwebp_anim @ 0000022da2913a40] Using libwebp for YUV-to-RGB conversion. You may want to consider passing in RGB instead for lossless encoding.

How do I remove this warning?

Adding Z2697's suggestion eliminates the warning:

ffmpeg -i INPUT -vf zscale=min=709,format=gbrap -c:v libwebp_anim -lossless 1 OUTPUT.webp

Having said that, does the use case mandate WebP?