How can I see what version of a library is linked? (e.g. libmp3lame)

classic Classic list List threaded Threaded
4 messages Options
Zak
Reply | Threaded
Open this post in threaded view
|

How can I see what version of a library is linked? (e.g. libmp3lame)

Zak
Dear FFmpeg User Mailing List,

The versions of certain libraries are printed in the banner, such as
libavcodec.

I am curious how to find information about linked libraries, such as
libmp3lame, the LAME MP3 encoder. I would like to know:

1. Was it statically or dynamically linked?

2. If dynamically linked, where is the libmp3lame.so file?

(I think the answer is /usr/local/libmp3lame.dylib in my case on my Mac,
but I want FFmpeg to tell me. I am not on Kubuntu right now, but I can
probably find it on Kubuntu also, and I'm guessing it is an .so and not
a .dylib file on that OS.)

3. What is the version of the linked library? Here is how I can ask LAME
itself, from the LAME CLI front-end for libmp3lame:

bash$ lame --version

LAME 64bits version 3.100 (http://lame.sf.net)

-----

Here is my best guess:

bash$ ffmpeg -h encoder=libmp3lame

Encoder libmp3lame [libmp3lame MP3 (MPEG audio layer 3)]:
     General capabilities: delay small
     Threading capabilities: none
     Supported sample rates: 44100 48000 32000 22050 24000 16000 11025
12000 8000
     Supported sample formats: s32p fltp s16p
     Supported channel layouts: mono stereo
libmp3lame encoder AVOptions:
   -reservoir         <boolean>    E...A... use bit reservoir (default true)
   -joint_stereo      <boolean>    E...A... use joint stereo (default true)
   -abr               <boolean>    E...A... use ABR (default false)

This looks promising, but it turns out all of that information is
hardcoded in this file:

ffmpeg/libavcodec/libmp3lame.c

You can even change this string:

AVCodec ff_libmp3lame_encoder = {
   // ...snip...
   .long_name = "libmp3lame MP3 (MPEG audio layer 3)"

...and the FFmpeg help will display whatever you type. It is not pulling
it from the library.

This is intended to be a general question, so I am not going to include
a specific FFmpeg banner because I use FFmpeg on two operating systems
(MacOS 10.12 and Kubuntu) and I have multiple versions of FFmpeg.

Thank you,

Zak F.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: How can I see what version of a library is linked? (e.g. libmp3lame)

Danny Mitchell
On 12/06/2018, Zak <[hidden email]> wrote:

> Dear FFmpeg User Mailing List,
>
> The versions of certain libraries are printed in the banner, such as
> libavcodec.
>
> I am curious how to find information about linked libraries, such as
> libmp3lame, the LAME MP3 encoder. I would like to know:
>
> 1. Was it statically or dynamically linked?
>
> 2. If dynamically linked, where is the libmp3lame.so file?
>
> (I think the answer is /usr/local/libmp3lame.dylib in my case on my Mac,
> but I want FFmpeg to tell me. I am not on Kubuntu right now, but I can
> probably find it on Kubuntu also, and I'm guessing it is an .so and not
> a .dylib file on that OS.)
>
> 3. What is the version of the linked library? Here is how I can ask LAME
> itself, from the LAME CLI front-end for libmp3lame:
>
> bash$ lame --version
>
> LAME 64bits version 3.100 (http://lame.sf.net)
>
> -----
>
> Here is my best guess:
>
> bash$ ffmpeg -h encoder=libmp3lame
>
> Encoder libmp3lame [libmp3lame MP3 (MPEG audio layer 3)]:
>      General capabilities: delay small
>      Threading capabilities: none
>      Supported sample rates: 44100 48000 32000 22050 24000 16000 11025
> 12000 8000
>      Supported sample formats: s32p fltp s16p
>      Supported channel layouts: mono stereo
> libmp3lame encoder AVOptions:
>    -reservoir         <boolean>    E...A... use bit reservoir (default true)
>    -joint_stereo      <boolean>    E...A... use joint stereo (default true)
>    -abr               <boolean>    E...A... use ABR (default false)
>
> This looks promising, but it turns out all of that information is
> hardcoded in this file:
>
> ffmpeg/libavcodec/libmp3lame.c
>
> You can even change this string:
>
> AVCodec ff_libmp3lame_encoder = {
>    // ...snip...
>    .long_name = "libmp3lame MP3 (MPEG audio layer 3)"
>
> ...and the FFmpeg help will display whatever you type. It is not pulling
> it from the library.
>
> This is intended to be a general question, so I am not going to include
> a specific FFmpeg banner because I use FFmpeg on two operating systems
> (MacOS 10.12 and Kubuntu) and I have multiple versions of FFmpeg.
>
> Thank you,
>
> Zak F.
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".



If you're on a Unix-like system (including MacOS and *Ubuntu) use
ldd <executable>
where <executable> is the path to the executable you want to examine. Example:

$ ldd /usr/local/bin/ffmpeg
        linux-vdso.so.1 =>  (0x00007fff279ff000)
        libavdevice.so.55 => /usr/local/lib/libavdevice.so.55
(0x00002ac9b97e7000)
        libavfilter.so.4 => /usr/local/lib/libavfilter.so.4 (0x00002ac9b99fe000)
        libavformat.so.55 => /usr/local/lib/libavformat.so.55
(0x00002ac9b9cdf000)
        libavcodec.so.55 => /usr/local/lib/libavcodec.so.55 (0x00002ac9ba085000)
        libswresample.so.0 => /usr/local/lib/libswresample.so.0
(0x00002ac9bb1f0000)
        libswscale.so.2 => /usr/local/lib/libswscale.so.2 (0x00002ac9bb407000)
        libavutil.so.52 => /usr/local/lib/libavutil.so.52 (0x00002ac9bb67d000)
        libX11.so.6 => /usr/lib/libX11.so.6 (0x00002ac9bb8d3000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00002ac9bbcb1000)
        libm.so.6 => /lib/libm.so.6 (0x00002ac9bbecd000)
        libvdpau.so.1 => /usr/lib/libvdpau.so.1 (0x00002ac9bc150000)
        libc.so.6 => /lib/libc.so.6 (0x00002ac9bc351000)
        libXv.so.1 => /usr/lib/libXv.so.1 (0x00002ac9bc6b3000)
        libXext.so.6 => /usr/lib/libXext.so.6 (0x00002ac9bc8b9000)
        libjack.so.0 => /usr/lib/libjack.so.0 (0x00002ac9bcacb000)
        libasound.so.2 => /usr/lib/libasound.so.2 (0x00002ac9bcd0e000)
        libSDL-1.2.so.0 => /usr/lib/libSDL-1.2.so.0 (0x00002ac9bcff4000)
        libdc1394.so.22 => /usr/lib/libdc1394.so.22 (0x00002ac9bd2ad000)
        libssl.so.0.9.8 => /usr/lib/libssl.so.0.9.8 (0x00002ac9bd522000)
        libcrypto.so.0.9.8 => /usr/lib/libcrypto.so.0.9.8 (0x00002ac9bd778000)
        libbz2.so.1.0 => /lib/libbz2.so.1.0 (0x00002ac9bdb19000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00002ac9bdd29000)
        libva.so.1 => /usr/lib/libva.so.1 (0x00002ac9bdf40000)
        libvorbisenc.so.2 => /usr/lib/libvorbisenc.so.2 (0x00002ac9be146000)
        libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0x00002ac9be416000)
        libtheoraenc.so.1 => /usr/lib/libtheoraenc.so.1 (0x00002ac9be447000)
        libtheoradec.so.1 => /usr/lib/libtheoradec.so.1 (0x00002ac9be686000)
        libspeex.so.1 => /usr/lib/libspeex.so.1 (0x00002ac9be89f000)
        libschroedinger-1.0.so.0 => /usr/lib/libschroedinger-1.0.so.0
(0x00002ac9beab9000)
        libopenjpeg.so.2 => /usr/lib/libopenjpeg.so.2 (0x00002ac9bed63000)
        libgsm.so.1 => /usr/lib/libgsm.so.1 (0x00002ac9bef83000)
        librt.so.1 => /lib/librt.so.1 (0x00002ac9bf191000)
        libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00002ac9bf399000)
        libdl.so.2 => /lib/libdl.so.2 (0x00002ac9bf5b5000)
        /lib64/ld-linux-x86-64.so.2 (0x00002ac9b95c7000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00002ac9bf7ba000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00002ac9bface000)
        libdirectfb-1.2.so.9 => /usr/lib/libdirectfb-1.2.so.9
(0x00002ac9bfce5000)
        libfusion-1.2.so.9 => /usr/lib/libfusion-1.2.so.9 (0x00002ac9bff67000)
        libdirect-1.2.so.9 => /usr/lib/libdirect-1.2.so.9 (0x00002ac9c0171000)
        libvga.so.1 => /usr/lib/libvga.so.1 (0x00002ac9c0388000)
        libraw1394.so.11 => /usr/lib/libraw1394.so.11 (0x00002ac9c05e7000)
        libusb-1.0.so.0 => /usr/lib/libusb-1.0.so.0 (0x00002ac9c07f5000)
        libogg.so.0 => /usr/lib/libogg.so.0 (0x00002ac9c0a0d000)
        liborc-0.4.so.0 => /usr/lib/liborc-0.4.so.0 (0x00002ac9c0a15000)
        libXau.so.6 => /usr/lib/libXau.so.6 (0x00002ac9c0c6f000)
        libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00002ac9c0e73000)
        libx86.so.1 => /lib/libx86.so.1 (0x00002ac9c1078000)
        libudev.so.0 => /lib/libudev.so.0 (0x00002ac9c129b000)

HTH
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: How can I see what version of a library is linked? (e.g. libmp3lame)

Carl Eugen Hoyos-2
In reply to this post by Zak
2018-06-12 4:42 GMT+02:00, Zak <[hidden email]>:

> 1. Was it statically or dynamically linked?
>
> 2. If dynamically linked, where is the libmp3lame.so file?

These two questions cannot be answered by ffmpeg, by
any executable, I suspect security considerations are
among the reasons why this is impossible.

Iirc, ldd does not work on osx, "otool -L ffmpeg" will tell you.

Version information (that may not be available for all
external libs but certainly for some) is a missing feature.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Zak
Reply | Threaded
Open this post in threaded view
|

Re: How can I see what version of a library is linked? (e.g. libmp3lame)

Zak
On 2018-06-12 at 4:11 AM EDT, Carl Eugen Hoyos wrote:

> 2018-06-12 4:42 GMT+02:00, Zak <[hidden email]>:
>
> These two questions cannot be answered by ffmpeg, by
> any executable, I suspect security considerations are
> among the reasons why this is impossible.
>
> Iirc, ldd does not work on osx, "otool -L ffmpeg" will tell you.
>
> Version information (that may not be available for all
> external libs but certainly for some) is a missing feature.
>
> Carl Eugen

Yes, the following works on MacOS:

bash$ otool -L /path/to/ffmpeg

/usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version
1.0.5)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
# ...snip...

By default, it follows symlinks all the way to a real file, and it
prints the compatibility version and current version, which is nice.

I can't figure out how to see what the executable actually requires, in
the case where it was given a newer version than it requires. So it
loads libz.1.dylib verson 1.2.5, but what version does FFmpeg really
NEED? Is 1.0.0 good enough? Or does FFmpeg need >= 1.1.0? Or >= 1.2.0?
Does the FFmpeg executable actually include such specific information,
or will it fail if and when it looks up a symbol and can't find it? I
have this question about otool on MacOS and also ldd on Linux.

Sad note:

libmp3lame is not dynamically linked by FFmpeg on either my Mac or my
Kubuntu box. It must be statically linked, which means the version
information is lost - unless I disassemble ffmpeg or something. On
Kubuntu, the default behavior of GNU ld should be to use the dynamic
link version if possible (I think), and it is possible to dynamically
link libmp3lame.so. I may try recompiling FFmpeg and looking for the
linker call with something like -lmp3lame or -llibmp3lame, and see if it
is preceded by an instruction to statically link it.

It looks like Danny Mitchell's compiled version of ffmpeg also has
libmp3lame statically linked, or else it doesn't have it at all. And
Danny Mitchell's ldd ffmpeg output lists a large number of dynamically
linked libraries that I didn't enable or link in any way, so I'm
guessing the MP3 encoder was not disabled. But maybe it was disabled. My
ffmpeg only has one MP3 encoder (libmp3lame), although it seems to have
possibly up to six decoders (I don't know whether to count MP3onMP4, for
instance). I am unaware of any MP3 encoder aside from libmp3lame that is
supported by FFmpeg, and I don't see any on that ldd output from Danny
Mitchell.

It would be nice for FFmpeg to record the versions of statically linked
libraries, but it looks like it would be hard.

Zak
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".