[FFmpeg-user] how to rename libx264 shared library(libx264.so.152) in FFmpeg

Carl Eugen Hoyos ceffmpeg at gmail.com
Thu Oct 10 18:45:15 EEST 2019


Am Do., 10. Okt. 2019 um 16:45 Uhr schrieb Moritz Barsnick <barsnick at gmx.net>:
>
> Hi Anand,
>
> On Thu, Oct 10, 2019 at 15:45:14 +0530, Anand wrote:
> > I compiled FFmpeg and generated shared library.
>
> > I want to rename libx264(libx264.so.152) to customized name
> > libx264_xxx.so.152 in FFmpeg. To adapt this change please let me know
> > the places where I should modify.
>
> As Harald said: Without context, this doesn't make much sense to us.
>
> We don't even know what kind of system this is. (Assumption: some kind
> of Unix, probably Linux?). Whether you need a hack or a sustainable
> solution.
>
> Here's a hack on systems with ELF binaries (such as Linux). You need
> patchelf >= 0.9:
>
> # check the original ffmpeg and the library which pulls in libx264
> [barsnick at paradise ~]$ ldd -r /usr/bin/ffmpeg | grep libx264
>         libx264.so.155 => /lib64/libx264.so.155 (0x00007fdec6cf2000)
> [barsnick at paradise ~]$ ldd /usr/lib64/libavcodec.so.58 | grep libx264
>         libx264.so.155 => /lib64/libx264.so.155 (0x00007f11337c5000)
> # proof of concept: create a version of libx264 with a new name (step 1 of your required steps)
> [barsnick at paradise ~]$ cp -p /usr/lib64/libx264.so.155 ./libx264_mine.so.155
> # proof of conecpt: create a copy of ffmpeg's dependent lib
> [barsnick at paradise ~]$ cp -p /usr/lib64/libavcodec.so.58 ./
> # modify the lib's dependency on libx264 to use the new name (step 2 of your required steps)
> [barsnick at paradise ~]$ patchelf --replace-needed libx264.so.155 libx264_mine.so.155 ./libavcodec.so.58
> # check the modified copy of the ffmpeg library
> [barsnick at paradise ~]$ ldd ./libavcodec.so.58 | grep libx264
>         libx264_mine.so.155 => not found
> [barsnick at paradise ~]$ LD_LIBRARY_PATH=. ldd -r ./libavcodec.so.58 | grep libx264
>         libx264_mine.so.155 => ./libx264_mine.so.155 (0x00007f583d15f000)
> # check ffmpeg when using the modified copy of the ffmpeg library
> [barsnick at paradise ~]$ LD_LIBRARY_PATH=. ldd -r /usr/bin/ffmpeg | grep libx264
>         libx264_mine.so.155 => ./libx264_mine.so.155 (0x00007f6ba26a7000)
>
> In other words:
> - Rename libx264.so.XYZ

> - Change the dependency on the depending component of ffmpeg using "patchelf
>  -replace-needed" (no copies needed as in my proof of concept)

As long as FFmpeg is open-source software:
Isn't it much easier to link again?

Carl Eugen


More information about the ffmpeg-user mailing list