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

2018-06-12 Thread Zak

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

2018-06-12 4:42 GMT+02:00, Zak :

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
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

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

2018-06-12 Thread Danny Mitchell
On 12/06/2018, Zak  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 E...A... use bit reservoir (default true)
>-joint_stereo  E...A... use joint stereo (default true)
>-abr   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
> ffmpeg-user@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".



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

$ ldd /usr/local/bin/ffmpeg
linux-vdso.so.1 =>  (0x7fff279ff000)
libavdevice.so.55 => /usr/local/lib/libavdevice.so.55
(0x2ac9b97e7000)
libavfilter.so.4 => /usr/local/lib/libavfilter.so.4 (0x2ac9b99fe000)
libavformat.so.55 => /usr/local/lib/libavformat.so.55
(0x2ac9b9cdf000)
libavcodec.so.55 => /usr/local/lib/libavcodec.so.55 (0x2ac9ba085000)
libswresample.so.0 => /usr/local/lib/libswresample.so.0
(0x2ac9bb1f)
libswscale.so.2 => /usr/local/lib/libswscale.so.2 (0x2ac9bb407000)
libavutil.so.52 => /usr/local/lib/libavutil.so.52 (0x2ac9bb67d000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x2ac9bb8d3000)
libpthread.so.0 => /lib/libpthread.so.0 (0x2ac9bbcb1000)
libm.so.6 => /lib/libm.so.6 (0x2ac9bbecd000)
libvdpau.so.1 => /usr/lib/libvdpau.so.1 (0x2ac9bc15)
libc.so.6 => /lib/libc.so.6 (0x2ac9bc351000)
libXv.so.1 => /usr/lib/libXv.so.1 (0x2ac9bc6b3000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x2ac9bc8b9000)
libjack.so.0 => /usr/lib/libjack.so.0 (0x2ac9bcacb000)
libasound.so.2 => /usr/lib/libasound.so.2 (0x2ac9bcd0e000)
libSDL-1.2.so.0 => /usr/lib/libSDL-1.2.so.0 (0x2ac9bcff4000)
libdc1394.so.22 => /usr/lib/libdc1394.so.22 (0x2ac9bd2ad000)
libssl.so.0.9.8 => /usr/lib/libssl.so.0.9.8 (0x2ac9bd522000)
libcrypto.so.0.9.8 => /usr/lib/libcrypto.so.0.9.8 (0x2ac9bd778000)
libbz2.so.1.0 => /lib/libbz2.so.1.0 (0x2ac9bdb19000)
libz.so.1 => /usr/lib/libz.so.1 (0x2ac9bdd29000)
libva.so.1 => /usr/lib/libva.so.1 (0x2ac9bdf4)
libvorbisenc.so.2 => /usr/lib/libvorbisenc.so.2 (0x2ac9be146000)
libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0x2ac9be416000)
libtheoraenc.so.1 => /usr/lib/libtheoraenc.so.1 (0x2ac9be447000)
libtheoradec.so.1 => /usr/lib/libtheoradec.so.1 (0x2ac9be686000)
libspeex.so.1 => /usr/lib/libspeex.so.1 (0x2ac9be89f000)
libschroedinger-1.0.so.0 => /usr/lib/libschroedinger-1.0.so.0
(0x2ac9beab9000)
libopenjpeg.so.2 => /usr/lib/libopenjpeg.so.2 (0x2ac9bed63000)
libgsm.so.1 => /usr/lib/libgsm.so.1 (0x2ac9bef83000)
librt.so.1 => /lib/librt.so.1 (0x2ac9bf191000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x2ac9bf399000)
libdl.so.2 => /lib/libdl.so.2