[FFmpeg-user] Build ffmpeg with libplacebo enabled

桃源老師 xanadu6291 at dream.jp
Fri Mar 29 18:14:21 EET 2024


Hello, ffmpeg experts...

I'm trying to build ffmpeg with libplacebo enabled. I have already installed minimum set of libplacebo on my Mac. When I configure ffmpeg with below option: 

./configure --prefix=${TARGET} --pkg-config-flags=--static --enable-gpl --enable-version3 --enable-nonfree --enable-libplacebo

ffmpeg seems successfully built, but it does not start with the following error: 

$ ./ffmpeg -version
dyld[92607]: Library not loaded: @rpath/libshaderc_shared.1.dylib
  Referenced from: <E9F09951-2827-3D5D-92CA-4DACB85BD84A> /Volumes/ffmpeg_compile/bin/ffmpeg
  Reason: no LC_RPATH's found
Abort trap: 6

After googling, adding --enable-rpath option to configure line might be seems to fix this error, but: 

$ ./ffmpeg -version
dyld[3705]: Library not loaded: @rpath/libshaderc_shared.1.dylib
  Referenced from: <9FF5AC63-389F-3160-B965-4316EC33A6EA> /Volumes/ffmpeg_compile/bin/ffmpeg
  Reason: tried: '/Volumes/ffmpeg_compile/lib/libshaderc_shared.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Volumes/ffmpeg_compile/lib/libshaderc_shared.1.dylib' (no such file), '/Volumes/ffmpeg_compile/lib/libshaderc_shared.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Volumes/ffmpeg_compile/lib/libshaderc_shared.1.dylib' (no such file)
Abort trap: 6

The situation goes much worse. 

So I strip --enable-rpath from confiigure line and add LDFLAGS:

export LDFLAGS="-L${TARGET}/lib -lc++ -Wl,-ld_classic,-rpath,/usr/local/lib"

This time, ffmpeg starts correctly: 

$ ./ffmpeg -version
ffmpeg version N-114515-gfa110c32b5 Copyright (c) 2000-2024 the FFmpeg developers
built with Apple clang version 15.0.0 (clang-1500.3.9.4)
configuration: --prefix=/Volumes/ffmpeg_compile --pkg-config-flags=--static --enable-gpl --enable-version3 --enable-nonfree --enable-libplacebo
libavutil      59. 10.100 / 59. 10.100
libavcodec     61.  4.100 / 61.  4.100
libavformat    61.  2.100 / 61.  2.100
libavdevice    61.  2.100 / 61.  2.100
libavfilter    10.  2.100 / 10.  2.100
libswscale      8.  2.100 /  8.  2.100
libswresample   5.  2.100 /  5.  2.100
libpostproc    58.  2.100 / 58.  2.100

$ ./ffmpeg -filters | grep placebo
ffmpeg version N-114515-gfa110c32b5 Copyright (c) 2000-2024 the FFmpeg developers
  built with Apple clang version 15.0.0 (clang-1500.3.9.4)
  configuration: --prefix=/Volumes/ffmpeg_compile --pkg-config-flags=--static --enable-gpl --enable-version3 --enable-nonfree --enable-libplacebo
  libavutil      59. 10.100 / 59. 10.100
  libavcodec     61.  4.100 / 61.  4.100
  libavformat    61.  2.100 / 61.  2.100
  libavdevice    61.  2.100 / 61.  2.100
  libavfilter    10.  2.100 / 10.  2.100
  libswscale      8.  2.100 /  8.  2.100
  libswresample   5.  2.100 /  5.  2.100
  libpostproc    58.  2.100 / 58.  2.100
 ..C libplacebo        N->V       Apply various GPU filters from libplacebo


And seems to work with libplacebo's example, Rescale input to fit into standard 1080p, with high quality scaling: 

$ ./ffmpeg -i ~/Movies/Enough\ is\ Enough.mp4 -vf "libplacebo=w=1920:h=1080:force_original_aspect_ratio=decrease:normalize_sar=true:upscaler=ewa_lanczos:downscaler=ewa_lanczos" ~/Desktop/test.mp4
ffmpeg version N-114515-gfa110c32b5 Copyright (c) 2000-2024 the FFmpeg developers
  built with Apple clang version 15.0.0 (clang-1500.3.9.4)
  configuration: --prefix=/Volumes/ffmpeg_compile --pkg-config-flags=--static --enable-gpl --enable-version3 --enable-nonfree --enable-libx264 --enable-libplacebo
  libavutil      59. 10.100 / 59. 10.100
  libavcodec     61.  4.100 / 61.  4.100
  libavformat    61.  2.100 / 61.  2.100
  libavdevice    61.  2.100 / 61.  2.100
  libavfilter    10.  2.100 / 10.  2.100
  libswscale      8.  2.100 /  8.  2.100
  libswresample   5.  2.100 /  5.  2.100
  libpostproc    58.  2.100 / 58.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/roushi/Movies/Enough is Enough.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf58.18.104
  Duration: 00:05:25.33, start: 0.000000, bitrate: 452 kb/s
  Stream #0:0[0x1](und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, progressive), 720x480 [SAR 32:27 DAR 16:9], 301 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)
      Metadata:
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 139 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
        vendor_id       : [0][0][0][0]
File '/Users/roushi/Desktop/test.mp4' already exists. Overwrite? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x11f60f650] using SAR=1/1
[libx264 @ 0x11f60f650] using cpu capabilities: ARMv8 NEON
[libx264 @ 0x11f60f650] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 0x11f60f650] 264 - core 164 r3190 7ed753b - H.264/MPEG-4 AVC codec - Copyleft 2003-2024 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/Users/roushi/Desktop/test.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf61.2.100
  Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(tv, progressive), 1620x1080 [SAR 1:1 DAR 3:2], q=2-31, 29.97 fps, 30k tbn (default)
      Metadata:
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]
        encoder         : Lavc61.4.100 libx264
      Side data:
        cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
        vendor_id       : [0][0][0][0]
        encoder         : Lavc61.4.100 aac
frame=   66 fps= 33 q=29.0 size=       0KiB time=00:00:02.13 bitrate=   0.2kbits
frame=  128 fps= 51 q=29.0 size=     512KiB time=00:00:04.20 bitrate= 997.7kbits
frame=  188 fps= 62 q=29.0 size=     768KiB time=00:00:06.20 bitrate=1013.8kbits
frame=  251 fps= 71 q=29.0 size=    1280KiB time=00:00:08.30 bitrate=1262.1kbits

[snip]

frame= 9685 fps=106 q=29.0 size=   59392KiB time=00:05:23.08 bitrate=1505.9kbits
[out#0/mp4 @ 0x60000215c300] video:54605KiB audio:5025KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.769506%
frame= 9750 fps=107 q=-1.0 Lsize=   60089KiB time=00:05:25.25 bitrate=1513.4kbits/s speed=3.56x
[libx264 @ 0x11f60f650] frame I:73    Avg QP:17.01  size: 37763
[libx264 @ 0x11f60f650] frame P:2478  Avg QP:20.85  size: 12066
[libx264 @ 0x11f60f650] frame B:7199  Avg QP:22.61  size:  3231
[libx264 @ 0x11f60f650] consecutive B-frames:  1.2%  0.7%  0.9% 97.2%
[libx264 @ 0x11f60f650] mb I  I16..4: 33.0% 59.5%  7.6%
[libx264 @ 0x11f60f650] mb P  I16..4:  2.5%  3.8%  0.2%  P16..4: 31.7%  5.8%  3.2%  0.0%  0.0%    skip:52.9%
[libx264 @ 0x11f60f650] mb B  I16..4:  0.1%  0.1%  0.0%  B16..8: 26.0%  0.7%  0.1%  direct: 0.3%  skip:72.6%  L0:41.0% L1:57.6% BI: 1.3%
[libx264 @ 0x11f60f650] 8x8 transform intra:58.9% inter:93.7%
[libx264 @ 0x11f60f650] coded y,uvDC,uvAC intra: 34.0% 37.3% 4.1% inter: 4.6% 5.6% 0.0%
[libx264 @ 0x11f60f650] i16 v,h,dc,p: 29% 22%  4% 44%
[libx264 @ 0x11f60f650] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 17% 21%  4%  7%  8%  6%  7%  4%
[libx264 @ 0x11f60f650] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 27% 16%  4%  7%  6%  5%  4%  2%
[libx264 @ 0x11f60f650] i8c dc,h,v,p: 64% 17% 16%  3%
[libx264 @ 0x11f60f650] Weighted P-Frames: Y:4.0% UV:1.0%
[libx264 @ 0x11f60f650] ref P L0: 63.9% 11.2% 20.2%  4.6%  0.0%
[libx264 @ 0x11f60f650] ref B L0: 93.5%  5.5%  1.0%
[libx264 @ 0x11f60f650] ref B L1: 97.9%  2.1%
[libx264 @ 0x11f60f650] kb/s:1375.00
[aac @ 0x11f64d9d0] Qavg: 3032.814

After all, my question is that To add "-rpath,/usr/local/lib" into LDFLAGS to fix "no LC_RPATH's found" error on ffmpeg when enabling libplacebo is correct or not?

Best Regards,

Miya a.k.a. Tougen-roushi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4329 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20240330/a34f8704/attachment.bin>


More information about the ffmpeg-user mailing list