Opened 13 days ago

Closed 3 days ago

Last modified 3 days ago

#70958 closed enhancement (fixed)

ffmpeg: add libwebp support

Reported by: seamusdemora (Seamus) Owned by: mascguy (Christopher Nielsen)
Priority: Normal Milestone:
Component: ports Version: 2.10.1
Keywords: haspatch Cc: dbevans (David B. Evans), jeremyhu (Jeremy Huddleston Sequoia), barracuda156
Port: ffmpeg

Description (last modified by ryandesign (Ryan Carsten Schmidt))

I gather that 'libwebp' is not included with the 'ffmpeg' port. I found a recipe for converting an 'mp4' to a 'webp', but all I got for that was the error 'Unknown encoder 'libwebp.

I followed Google's advice & tried to build 'libwebp' following these instructions: https://developers.google.com/speed/webp/docs/compiling#building

But this did not work either. I got the exact same error message. FWIW, here's the command I was trying to use:

ffmpeg -i "JW-recording.mp4" \ 
-vf "fps=10,scale=720:-1:flags=lanczos" \
-vcodec libwebp -lossless 0 -compression_level 6 \
-q:v 50 -loop 0 \
-preset picture -an -vsync 0 JW-recording.webp

ffmpeg version 4.4.4 Copyright (c) 2000-2023 the FFmpeg developers
  built with Apple clang version 14.0.3 (clang-1403.0.22.14.1)
  configuration: --prefix=/opt/local --cc=/usr/bin/clang --mandir=/opt/local/share/man --enable-audiotoolbox --disable-indev=jack --disable-libjack --disable-libopencore-amrnb --disable-libopencore-amrwb --disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --enable-opencl --disable-outdev=xv --enable-sdl2 --disable-securetransport --enable-videotoolbox --enable-avfilter --enable-avresample --enable-fontconfig --enable-gnutls --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libfribidi --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libzimg --enable-libzvbi --enable-lzma --enable-pthreads --enable-shared --enable-swscale --enable-zlib --enable-libaom --enable-libsvtav1 --arch=arm64 --enable-gpl --enable-libvidstab --enable-libx264 --enable-libx265 --enable-libxvid --enable-postproc
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
[libdav1d @ 0x12e815e00] libdav1d 1.4.3
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'JW-recording.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomav01iso2mp41
    encoder         : Lavf58.76.100
  Duration: 00:00:05.50, start: 0.000000, bitrate: 106 kb/s
  Stream #0:0(und): Video: av1 (Main) (av01 / 0x31307661), yuv420p(tv, progressive), 460x332 [SAR 1:1 DAR 115:83], 104 kb/s, 10 fps, 10 tbr, 10240 tbn, 10240 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]

Unknown encoder 'libwebp'     <===ERROR MESSAGE

I did set the environment variable for 'LD_LIBRARY_PATH' as follows: 'export LD_LIBRARY_PATH=/usr/local/lib/', but that also didn't help. I even ran the above command using the following (in the 3rd line of the command above):

-vcodec /usr/local/lib/libwebp -lossless 0 -compression_level 6 \

I'm afraid I've reached the limits of my ability to troubleshoot this issue; posting here looking for some help!

Change History (13)

comment:1 Changed 13 days ago by ryandesign (Ryan Carsten Schmidt)

Cc: dbevans jeremyhu added
Description: modified (diff)
Keywords: ffmpeg libwebp removed
Milestone: MacPorts 2.10.2
Owner: set to mascguy
Status: newassigned
Summary: ffmpeg - how to incorporate libwebp?ffmpeg: add libwebp support
Type: requestenhancement

You don't have to compile webp yourself; there's already a port for it in MacPorts. The maintainers of the ffmpeg port would just have to modify it to use webp.

You should not set LD_LIBRARY_PATH. Any instructions you see advising you to do so are probably for Linux and inapplicable to macOS.

comment:2 Changed 13 days ago by seamusdemora (Seamus)

Ryan,

I should have mentioned that I also installed webp using MacPorts... but that didn't prevent the error with ffmpeg.

~S

RE: "already (have) a port for webp". Aye, but I wasn't clear on whether or not that included libwebp :)

I have now unset LD_LIBRARY_PATH.

I guess I'll have to wait on the maintainers to modify ffmpeg to use libwebp...

Last edited 13 days ago by seamusdemora (Seamus) (previous) (diff)

comment:3 in reply to:  2 Changed 13 days ago by ryandesign (Ryan Carsten Schmidt)

Replying to seamusdemora:

I should have mentioned that I also installed webp using MacPorts... but that didn't prevent the error with ffmpeg.

Correct, most ports won't magically use other ports just because you install those other ports; usually, if that happens, it would be considered a bug. We want ReproducibleBuilds, not builds that change depending on what the user already has installed.

RE: "already (have) a port for webp". Aye, but I wasn't clear on whether or not that included libwebp :)

You can use port contents webp to discover what it installed.

I guess I'll have to wait on the maintainers to modify ffmpeg to use libwebp...

Right, the maintainers need to add port:webp to depends_lib, add --enable-libwebp to configure.args, and increase revision. If you like, you can try those modifications yourself, and if they work, you can submit a pull request.

We also have ports ffmpeg-devel, ffmpeg6, and ffmpeg7. It is best to keep related ports as similar as possible, so ideally webp support would be added to all four ports at the same time and in the same way. Currently, the ffmpeg7 and ffmpeg-devel ports explicitly disable webp support while the ffmpeg and ffmpeg6 ports do not mention webp support.

comment:4 Changed 13 days ago by ryandesign (Ryan Carsten Schmidt)

Also, if you manually compiled webp and installed it to /usr/local, you should remove it and anything else you have installed there because it can interfere with MacPorts. See wiki:FAQ#usrlocal.

comment:5 in reply to:  4 Changed 12 days ago by seamusdemora (Seamus)

Replying to ryandesign:

Also, if you manually compiled webp and installed it to /usr/local, you should remove it and anything else you have installed there because it can interfere with MacPorts. See wiki:FAQ#usrlocal.

Yes - Thanks, I'm glad you mentioned that. I think I've cleaned up the mess. It's disappointing that Google implies compatibility w/ MacPorts, and then does something wacko like the LD_LIBRARY_PATH. I wondered about that, but I was anxious to get my recipe working :)

I wouldn't mind trying to make the modifications to add libwebp, but I'd need a lot of help... maybe quicker to let the maintainers handle it since this sounds fairly involved??

comment:6 Changed 11 days ago by ryandesign (Ryan Carsten Schmidt)

Cc: barracuda156 added
Keywords: haspatch added

comment:7 Changed 4 days ago by seamusdemora (Seamus)

Note: I'm only posting to try to become more familiar w/ the process here...

It seems the PR is moving forward: https://github.com/macports/macports-ports/pull/26022

Just out of curiosity, will I get a notification when the 'enhanced' ffmpeg is released & available for download?

comment:8 Changed 3 days ago by ryandesign (Ryan Carsten Schmidt)

In 5803b6ed993716736ae2ad82f1e259a3c2a9858c/macports-ports (master):

ffmpeg-devel: Enable webp

See: #70958

comment:9 Changed 3 days ago by ryandesign (Ryan Carsten Schmidt)

In 46fe41d602959d42cf161a7416bcdeebc1f4713a/macports-ports (master):

ffmpeg7: Enable webp

See: #70958

comment:10 Changed 3 days ago by ryandesign (Ryan Carsten Schmidt)

In 24e4e17b02b00a2d4fdcbcd51fb9c3624f40f71e/macports-ports (master):

ffmpeg6: Enable webp

See: #70958

comment:11 Changed 3 days ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: assignedclosed

In d5fb6bb1bdaf42f6ce7c48115957dc39b2899b3a/macports-ports (master):

ffmpeg: Enable webp and lzo2

Closes: #70958

comment:12 Changed 3 days ago by ryandesign (Ryan Carsten Schmidt)

Yes, the preceding messages notify you that the fix has been committed. It will now take a couple hours before it synchronizes to the public server and is available for you to receive by running sudo port selfupdate.

comment:13 Changed 3 days ago by seamusdemora (Seamus)

Thanks so much! :)

Note: See TracTickets for help on using tickets.