Author Topic: Video: add basic technical data  (Read 282 times)

abgestumpft

  • Sr. Member
  • **
  • Posts: 266
Video: add basic technical data
« on: October 12, 2021, 12:00:18 AM »
Hi,

for Video I'm interested in some basic technical information:

1. Video dimensions
-> OK already available in iMatch

2. fps
Availble for many (but not all) Videos via different tags:
{File.MD.QuickTime::SampleTable\stts\VideoFrameRate\0}
{File.MD.QuickTime::ItemList\android.capture.fps\AndroidCaptureFps\0}
{File.MD.RIFF::StreamHeader\5\VideoFrameRate\1}

3. Bitrate
Availble for many (but not all) Videos via different tags:
{File.MD.Composite\QuickTime-AvgBitrate\AvgBitrate\0}
{File.MD.MPEG::Video\Bit32-49\VideoBitrate\0}
{File.MD.RIFF::AVIHeader\1\MaxDataRate\0}


4. Codec
Did not find any tags on this

5. Duration
-> OK already available in iMatch


My request would be to read out the basic technical video data via ffprobe and store it in a central iMatch Tag, like
photools.com::IMatch\xxxx\VideoCodec\0
photools.com::IMatch\xxxx\VideoBitrate\0
photools.com::IMatch\xxxx\Videofps\0

E.g. the data could be queried like this:
Code: [Select]
"C:\Program Files\photools.com\imatch6\ffprobe.exe" -loglevel quiet -print_format json -show_streams -select_streams v:0  "<FILENAME>"
{
    "streams": [
        {
            "index": 0,
            "codec_name": "hevc",
            "codec_long_name": "H.265 / HEVC (High Efficiency Video Coding)",
            ...
            "r_frame_rate": "30/1",
            ...
            "bit_rate": "10046297",
            ....

Alternatively you could also do something like:
Code: [Select]
"C:\Program Files\photools.com\imatch6\ffprobe.exe" -loglevel quiet -show_streams -select_streams v:0  "<FILENAME>"
[STREAM]
index=0
codec_name=hevc
codec_long_name=H.265 / HEVC (High Efficiency Video Coding)
...
r_frame_rate=30/1
...
bit_rate=10046297

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 30082
Re: Video: add basic technical data
« Reply #1 on: October 12, 2021, 12:23:21 AM »
IMatch reads metadata via ExifTool.
It reads video duration for some formats via FFMpeg.

I suggest you speak to your camera vendor and ask them to just make your device fill the standard XMP tags for the data you want to see.
The data you are interested in would then immediately be available in IMatch and any other XMP-supporting application.

I'm afraid though, they just will laugh in your face and give a shit. You've paid them for your device. They have your money already, why bother...?
XMP can cover all of this, your camera vendor just has to support it.
I'm sure camera vendors have a lot more resources (and money) than I have.
« Last Edit: October 12, 2021, 12:29:59 AM by Mario »

abgestumpft

  • Sr. Member
  • **
  • Posts: 266
Re: Video: add basic technical data
« Reply #2 on: October 12, 2021, 09:17:02 PM »
Also if my camera vendor would do that (which I highly doubt), there are still hundred others and the videos that have been shot are also the way the are now.
Even when I try to find existing XMP metadata tags for video I could store information in I don't find them (e.g. for codec).


For a quick test I have created a Metadata template that misuses some of the existing XMP Tags:
Code: [Select]
{File.MD.XMP::xmpDM\videoFrameRate\VideoFrameRate\0} = {File.MD.QuickTime::SampleTable\stts\VideoFrameRate\0}{File.MD.QuickTime::ItemList\android.capture.fps\AndroidCaptureFps\0}{File.MD.RIFF::StreamHeader\5\VideoFrameRate\1}
{File.MD.XMP::xmpDM\TracksMarkersName\TracksMarkersName\0} = {File.MD.Composite\QuickTime-AvgBitrate\AvgBitrate\0}{File.MD.MPEG::Video\Bit32-49\VideoBitrate\0}{File.MD.RIFF::AVIHeader\1\MaxDataRate\0}
{File.MD.XMP::xmpDM\shotName\ShotName\0} = ""  (assign e.g. "h264" manually.)
   


Then I can create a layout like this:


But nothing I want to do regularly in a live environment  :)


In addition I have written a small cmd script that uses the ffprobe binary that comes with IMatch (see attached ZIP file).
In IMatch I configured it as External Tool in Applications:
Command to execute: <path and filename of script>
Arguments: "{File.MD.photools.com::IMatch\101400\file.foldername\0}{File.MD.photools.com::IMatch\101100\file.name\0}"

This will then open a cmd window with the technical core data I'm interested in from the file that is currently selected in IMatch:
Code: [Select]
VIDEO INFO:
----------------------------
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
width=3840
height=2160
avg_frame_rate=30000/1001
duration=24.524500
duration_hr=00:00:24.52
bit_rate_mbit=95.21

AUDIO INFO:
----------------------------
codec_name=pcm_s16le
codec_long_name=PCM signed 16-bit little-endian
sample_rate=48000
bit_rate=1536000

I have tested the script on videos from all the different cameras I have in IMatch (Fotos, Camcorder, Mobiles, Point&Shoot, Edited Videos,...) -> works on all of them.
So for now, this is what I will use to display the missing information...

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 30082
Re: Video: add basic technical data
« Reply #3 on: October 12, 2021, 09:57:20 PM »
Have you looked in the ECP which video data ExifTool returns? It returns a lot of data for videos. For example, QuickTime duration, track duration etc.
Nothing of this goes into XMP by default, but you can still use all the data since IMatch imports it (unless disabled in the Tag Manager).

abgestumpft

  • Sr. Member
  • **
  • Posts: 266
Re: Video: add basic technical data
« Reply #4 on: October 13, 2021, 08:48:47 PM »
I have now downloaded several sample videos for some of the more recent cameras.
Then I have analyzed them with exiftool directly and later in IMatch what metadata is available in videos.

I've put this together in an excel file (see also attached file).
This is sorted from new to old. As you can see all recent cameras I tested (2015 or newer) use the QuickTime tags (marked in green) - with the exception for Olympus and bitrate tag.
Camera Model and Lens is still a mess.
Older Cameras (2009-2014) were using M2TS tags (blue), and very old ones (<2009) RIFF tags (yellow).

Since my newer cameras are all Olympus and the rest is older I'm missing a lot information in the QuickTime tags.


I have now created a layout that uses all the tags I found:


For the Sony A7SIII sample file I downloaded it seems like date was set wrong, and also has forgotten to set the {File.MD.XMP::XML\DeviceModelName\DeviceModelName\0} tag corretly (set to: MODEL-NAME)

Input used:
Code: [Select]
Camera: {File.MD.Olympus::prms\44\Model\0}{File.MD.Exif::Main\272\Model\0}{File.MD.H264::MDPM\228\Model\0}{File.MD.XMP::XML\DeviceModelName\DeviceModelName\0}{File.MD.QuickTime::ItemList\model\Model\0}
Lens: {File.MD.photools.com::IMatch\2900\lens\0}
fps: {File.MD.QuickTime::SampleTable\stts\VideoFrameRate\0}{File.MD.RIFF::StreamHeader\5\VideoFrameRate\1}fps
Bitrate: {File.MD.Composite\QuickTime-AvgBitrate\AvgBitrate\0}{File.MD.RIFF::AVIHeader\1\MaxDataRate\0}
Video Codec: {File.MD.QuickTime::ImageDesc\2\CompressorID\0|replace:avc1==h264;replace:hvc1==h265}{File.MD.M2TS::Main\VideoStreamType\VideoStreamType\0|replace:H.264 (AVC) Video==h264;replace:H.264 Video==h264}{File.MD.RIFF::StreamHeader\1\VideoCodec\1}
Audio Codec: {File.MD.QuickTime::AudioSampleDesc\4\AudioFormat\0|replace:mp4a==AAC (Advanced Audio Coding);replace:raw==PCM unsigned 8-bit;replace:twos==PCM signed 16-bit big-endian;replace:sowt==PCM signed 16-bit little-endian;replace:lpcm==PCM signed 24-bit little-endian}{File.MD.M2TS::Main\AudioStreamType\AudioStreamType\0}{File.MD.RIFF::AudioFormat\0\Encoding\0}
Audio SampleRate: {File.MD.QuickTime::AudioSampleDesc\32\AudioSampleRate\0}

For VideoCodec I do the following replacement:
hvc1=h265
avc1=h264

For AudioCodec I do the following replacement:
mp4a = AAC (Advanced Audio Coding)
raw = PCM unsigned 8-bit
twos = PCM signed 16-bit big-endian
sowt = PCM signed 16-bit little-endian (twos spelled backwards)
lpcm = PCM signed 24-bit little-endian


My conclusion is:
For newer models (2015+, also applies to mobile phones) one should be pretty save with the quicktime tags (with exception of Olympus and bitrate)
The cmd script I posted earlier in this post is listing all the informations corretly for all cameras I tested (e.g. also bitrate for Olympus and older Panasonic models)
I will now work with some layout as shown above for videos. Manually I will only assign the camera-name to tag {File.MD.XMP::xmpDM\cameraModel\CameraModel\0} -> so I can work on categories on this one...

abgestumpft

  • Sr. Member
  • **
  • Posts: 266
Re: Video: add basic technical data
« Reply #5 on: October 16, 2021, 09:31:07 PM »
FYI:
exiftool 12.33 was released today:
https://exiftool.org/history.html

This also contains two changes:
Quote
Extract LensModel from some Olympus MOV videos
Generate MediaDataOffset/Size for MOV videos with zero-sized MDAT chunk

For olympus bitrate the issue was that mdat size was missing that is used (together with duration) to calculate the avg. bitrate.
For my video test-catalog I temporary replaced the iMatch exiftool with 12.33 and reload metadata:



Now avg. bitrate and even lens-information is available for Olympus videos (not EM1, but like EM1.2, EM1.3, E-P7,...)  8)
AvgBitrate via: File.MD.Composite\QuickTime-AvgBitrate\AvgBitrate\0 (like from all other recent cameras too)
Lens ID via: File.MD.Composite\Exif-LensID-2\LensID\0



Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 30082
Re: Video: add basic technical data
« Reply #6 on: October 16, 2021, 09:43:39 PM »
Quote
For my video test-catalog I temporary replaced the iMatch exiftool with 12.33 and reload metadata:

I don't recommend to do that. It may break IMatch. It may break future IMatch updates. Even in subtle ways.
It may leave your database is a mess that manifests itself in a week, a month or several months - and then we will chase problems only happening with your installation, wasting lots of time for everybody involved.
Undo the change, replace the ExifTool shipped with IMatch AND your database from before you did this change.
I don't support this and I have made a note so I know in future support cases that your database was modified by a non-supported out-of-line ExifTool version.

No other user has commented or +1'ed your feature request yet.
The data you are looking for should be available in any specialized video processor or FFMpeg.
If ExifTool supports the data, IMatch does too.
If ExifTool does not support the data, there is just not enough interest.

I don't think many people are interested in the actual bit rate or the codec used when their camera recorded a video.
If you are, +1 this feature request below.
« Last Edit: October 16, 2021, 09:46:58 PM by Mario »

abgestumpft

  • Sr. Member
  • **
  • Posts: 266
Re: Video: add basic technical data
« Reply #7 on: October 16, 2021, 10:03:13 PM »
Hi Mario,

as I had written I temporary replaced it on my (temporary) video test-catalog.
I only had the new exiftool binary in place for one start of that test-DB. The original exiftool is already back in place.
My main catalog has never seen the new exiftool binary.

With this post I just wanted to update you that exiftool will solve the missing bitrate (and also add lens info) for Olympus with 12.33.
So as soon as IMatch is updating exiftool to a new version this information will also be available here.

Initially I was looking at the videos I had in my iMatch catalog: this were old cameras (<2013) and Olympus.
When you look at the excel I posted earlier (were I was downloading a lot of video sample from current cameras of different manufacturers) you can see that this fps, bitrate,... information is available for all cameras starting 2016 - with exception of Olympus. And this is solved starting exiftool 12.33.
So even from my side, there is no need for this feature request anymore :-)