[FEATURE] FFProbe vs MediaInfo

All your suggestions, requests and ideas for future development
Post Reply
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

[FEATURE] FFProbe vs MediaInfo

Post by devster »

FileBot comes bundled with and relies on MediaInfo libraries to identify several characteristics of the video file.
I can completely see how this is logical and efficient. However I've also been bitten more than once by incomplete, missing or not standardized information extracted by MediaInfo. Despite their continuous effort to fix this I believe this to be suboptimal.
In particular the vast majority of software I see used for media playback (from Plex to Kodi to VLC or MPV) relies and uses ffmpeg as a backend.
Logically it would follow that this is what they use to extract information regarding the files and indeed there's ffprobe and related libraries for this purpose.

Would it be feasible to add this as the preferred backend for media file info retrieval with graceful fallback on mediainfo?

I believe the consistency could be enough of an advantage to justify this.
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [FEATURE] FFProbe vs MediaInfo

Post by rednoah »

That's a negative. It'd take some serious effort to make things work with ffprobe not to mention that any changes would have to be tested on all native platforms. libmediainfo is well tested and provides binaries for almost all platforms (except aarch64).

Furthermore, FileBot uses MediaInfo internally in various ways, as do end users in custom formats. All of this would break, or maybe break, who knows, I certainly don't. So there'd have to be options for backwards compatibility, and now I end up maintaining two native components (that I can't / won't regularly test on non-Windows/Mac platforms).

Please collect specific examples of how libmediainfo is inferior to ffprobe in this thread. If there's many many issues by many many users, then I'll have a serious look at ffprobe, otherwise I'd opt with "don't fix it if it ain't broke".

:?: Is there a libffprobe.so with C API? If there's binary builds for aarch64 then that'd be interesting.
:idea: Please read the FAQ and How to Request Help.
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Re: [FEATURE] FFProbe vs MediaInfo

Post by devster »

I assumed it would have been a bit difficult and I just wanted to mention it as an idea.
I confirm that it's not something that currently doesn't work, I don't think it's common but takes a bit of fiddling in Groovy to account for all the nuances of MediaInfo for specific files using specific formats.
I'll try and collect examples below as they become available.

Regarding ffmpeg if I understand correctly it relies on 2 specific components for ffprobe which are libavformat and libavcodec, both of which seem to have packages for many architectures: Debian libavcodec-dev and Debian libavformat-dev (I'm assuming this wasn't a question for Windows or MacOS)
I'm not sure how to answer the question about the C API but I found this [FFmpeg-devel] Add JNI and Android content resolver support as well as https://www.ffmpeg.org/doxygen/trunk/jni_8h.html and https://www.ffmpeg.org/doxygen/trunk/jni_8c.html which seems to provide some kind of JNI support for ffmpeg, not sure though.
I only work in black and sometimes very, very dark grey. (Batman)
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Re: [FEATURE] FFProbe vs MediaInfo

Post by devster »

Audio-specific for the following release: The.Greatest.Showman.2017.1080p.BluRay.x264-SPARKS
Command used is simply mediainfo <file> and ffprobe -v error -select_streams a:0 -show_streams
Mediainfo

Code: Select all

Audio
ID                                       : 2
Format                                   : DTS
Format/Info                              : Digital Theater Systems
Format profile                           : ES Matrix / Core
Codec ID                                 : A_DTS
Duration                                 : 1 min 1 s
Bit rate mode                            : Constant
Bit rate                                 : 1 509 kb/s
Channel(s)                               : 7 channels / 6 channels
Channel positions                        : Front: L C R, Side: L R, Back: C, LFE / Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 93.750 FPS (512 SPF)
Bit depth                                : 24 bits
Compression mode                         : Lossy
Delay relative to video                  : 8 ms
Stream size                              : 11.1 MiB (22%)
Language                                 : English
Default                                  : Yes
Forced                                   : No
vs ffprobe:

Code: Select all

[STREAM]
index=1
codec_name=dts
codec_long_name=DCA (DTS Coherent Acoustics)
profile=DTS
codec_type=audio
codec_time_base=1/48000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
sample_fmt=fltp
sample_rate=48000
channels=6
channel_layout=5.1(side)
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/1000
start_pts=8
start_time=0.008000
duration_ts=N/A
duration=N/A
bit_rate=1536000
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:language=eng
[/STREAM]
The profile identified is different (DTS vs DTS-ES) and channel layout as well seems to differ.
I tested the same commands on a sample file from https://wiki.videolan.org/DTS/ and they are in accordance (sample file ES 6.1 - 5.1 16bit.dts). Below the results for the audio stream on this sample.
MediaInfo

Code: Select all

Audio
Format                                   : DTS
Format/Info                              : Digital Theater Systems
Format profile                           : ES Discrete / Core
Duration                                 : 27 s 733 ms
Bit rate mode                            : Constant
Bit rate                                 : 1 510 kb/s
Channel(s)                               : 7 channels / 6 channels
Channel positions                        : Front: L C R, Side: L R, Back: C, LFE / Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 93.750 FPS (512 SPF)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 4.99 MiB (100%)
and ffprobe

Code: Select all

[STREAM]
index=0
codec_name=dts
codec_long_name=DCA (DTS Coherent Acoustics)
profile=DTS-ES
codec_type=audio
codec_time_base=1/48000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
sample_fmt=fltp
sample_rate=48000
channels=7
channel_layout=6.1
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/90000
start_pts=0
start_time=0.000000
duration_ts=2453344
duration=27.259378
bit_rate=1536000
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
[/STREAM]
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [FEATURE] FFProbe vs MediaInfo

Post by rednoah »

Is ffprobe part of ffmpeg? Are there any options for ffmpeg to make it behave as if it was ffprobe? ffmpeg is available out of the box on all my NAS devices, but ffprobe isn't. Being able to rely on existing system tools would be a big plus for using ffmpeg.
:idea: Please read the FAQ and How to Request Help.
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Re: [FEATURE] FFProbe vs MediaInfo

Post by devster »

As far as I know ffprobe is a separate command, usually built and included in the ffmpeg package but not always since there's the following option available:

Code: Select all

  --disable-ffprobe        disable ffprobe build
Both binaries rely on the same libraries but I don't think one can replicate another.
However, since the underlying libraries are the same, the availability of ffmpeg should automatically include libavformat and libavcodec which are the backbone for ffprobe and could (in theory) be accessed programmatically.
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [FEATURE] FFProbe vs MediaInfo

Post by rednoah »

Using libavformat / libavcodec would only be an option if somebody also wrote a Java / JNA wrapper library for those yet. That would make things easier. Personally, I don't have time to take on additional open source library projects. Otherwise, calling ffprobe and parsing the output would be much more easy / reliable but also slower.


EDIT:

My new QNAP NAS (aarch64) did actually have ffprobe in /mnt/ext/opt/medialibrary/bin/ffprobe so I do have a test device where libmediainfo doesn't work, and where ffprobe might be an easy replacement. Let's see how the FileBot for Linux Patreon goes. Support for ffprobe makes sense as a feature specifically for Linux packages on platforms where ffprobe is preinstalled on the system (and where libmediainfo doesn't work or just isn't available).


EDIT 2:

Also available on Synology NAS at /volume1/@appstore/MediaServer/bin/ffprobe.
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [FEATURE] FFProbe vs MediaInfo

Post by rednoah »

EXPERIMENTAL:

Newer revisions allow you to use the {ffprobe} binding to access the JSON object provided by running the ffprobe executable on the given file.

The ffprobe executable can be specified like this if ffprobe isn't in the $PATH by default:

Code: Select all

-Dnet.filebot.media.ffprobe=/usr/local/bin/ffprobe
Make FileBot use ffprobe internally instead of libmediainfo:

Code: Select all

-Dnet.filebot.media.parser=ffprobe
:idea: Please read the FAQ and How to Request Help.
Post Reply