Media files tagger

Discuss and share scripts and script files...
amirvf
Posts: 133
Joined: 18 Oct 2020 00:46

Re: Media files tagger

Post by amirvf »

One more issue I just noticed:
Information regarding Text is totally ignored from scratch. But it is expected to tag the parameter with the EmptyValue.

amirvf
Posts: 133
Joined: 18 Oct 2020 00:46

Re: Media files tagger

Post by amirvf »

highend wrote: 22 Nov 2020 21:23 I need the belonging mediainfo.exe -i "<that file>" output from a command prompt as well...

Code: Select all

Microsoft Windows [Version 10.0.19041.630]
(c) 2020 Microsoft Corporation. All rights reserved.

C:\Program Files\MediaInfo_CLI_20.09_Windows_x64>MediaInfo.exe -i "Y:\Test\3 [22-11-2020][23-35-59]\1.mp4"
General
Complete name                            : Y:\Test\3 [22-11-2020][23-35-59]\1.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 1.57 GiB
Duration                                 : 1 h 37 min
Overall bit rate                         : 2 296 kb/s
Writing application                      : Lavf58.2.103

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.1
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 1 h 37 min
Bit rate                                 : 2 150 kb/s
Width                                    : 1 920 pixels
Height                                   : 816 pixels
Display aspect ratio                     : 2.35:1
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.057
Stream size                              : 1.46 GiB (94%)
Writing library                          : x264 core 152
Encoding settings                        : cabac=1 / ref=4 / deblock=1:-1:-1 / analyse=0x3:0x133 / me=umh / subme=9 / psy=1 / psy_rd=1.00:0.15 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-3 / threads=12 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=2pass / mbtree=1 / bitrate=2150 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=31250 / vbv_bufsize=31250 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00
Language                                 : English
Tagged date                              : UTC 2020-05-30 01:16:09
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 1 h 37 min
Source duration                          : 1 h 37 min
Source_Duration_LastFrame                : -13 ms
Bit rate mode                            : Constant
Bit rate                                 : 144 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 100 MiB (6%)
Source stream size                       : 100 MiB (6%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 1
Tagged date                              : UTC 2020-05-30 01:16:09

highend
Posts: 13260
Joined: 06 Feb 2011 00:33

Re: Media files tagger

Post by highend »

Ok, my guess: It does happen for all items (that have no N/A) when they don't exist (or if they are empty?) and it is some kind of interleaved...

Code: Select all

TextCount=%TextCount%Cover=%Cover%Title=%Title%Genre=%Genre%Director=%Director%Actor=%Actor%LongDescription=%LongDescription%

Leads to:
General_TextCount=N/A#::#General_Cover=#::#General_Title=N/A#::#General_Genre=#::#General_Director=N/A#::#General_Actor=#::#General_LongDescription=N/A
N/A, empty, N/A, empty, N/A, empty, N/A
Correct?
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

highend
Posts: 13260
Joined: 06 Feb 2011 00:33

Re: Media files tagger

Post by highend »

Replace this line:

Code: Select all

$result = regexreplace($result, "(#::#[a-z0-9]+?_[a-z0-9]+?=)(#::#|$)", "$1" . $EmptyValue . "$2");
with this:

Code: Select all

$result = regexreplace($result, "([a-z0-9]+?_[a-z0-9]+?=)(#::#|$)", "$1" . $EmptyValue . "$2");
Test it. A lot... It should fix the issue... But again, test it a lot...
Once you provide positive feedback I'll release an update.
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

amirvf
Posts: 133
Joined: 18 Oct 2020 00:46

Re: Media files tagger

Post by amirvf »

highend wrote: 22 Nov 2020 21:46 Ok, my guess: It does happen for all items (that have no N/A) when they don't exist (or if they are empty?) and it is some kind of interleaved...

Code: Select all

TextCount=%TextCount%Cover=%Cover%Title=%Title%Genre=%Genre%Director=%Director%Actor=%Actor%LongDescription=%LongDescription%

Leads to:
General_TextCount=N/A#::#General_Cover=#::#General_Title=N/A#::#General_Genre=#::#General_Director=N/A#::#General_Actor=#::#General_LongDescription=N/A
N/A, empty, N/A, empty, N/A, empty, N/A
Correct?
It's very weird. Because parameters of General_Cover, General_Genre, General_Director, General_LongDescription, and General_Title are exactly the same in terms of EXISTENCE. But some are randomly tagged with N/A and some are skipped.

I'll try the changes and update you.

highend
Posts: 13260
Joined: 06 Feb 2011 00:33

Re: Media files tagger

Post by highend »

The regex change will fix it
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

amirvf
Posts: 133
Joined: 18 Oct 2020 00:46

Re: Media files tagger

Post by amirvf »

Here is the new generated tag:

Code: Select all

#::#General_Format=MPEG-4#::#General_Duration=01:37:36.518#::#General_OverallBitRate=2 296 kb/s#::#General_AudioCount=1#::#General_VideoCount=1#::#General_FrameRate=23.976#::#General_TextCount=0#::#General_Cover=No#::#General_Title=N/A#::#General_Genre=N/A#::#General_Director=N/A#::#General_Actor=N/A#::#General_LongDescription=N/A#::#Video_Width=1920#::#Video_Height=816#::#Video_DisplayAspectRatio=2.35:1#::#Video_Title=N/A#::#Video_BitRate=2 150 kb/s#::#Video_VideoFormatList=AVC#::#Audio_Channels=2#::#Audio_BitRate=144 kb/s#::#Audio_Title=N/A#::#Audio_AudioLanguageList=eng#::#Audio_AudioFormatList=AAC
The issues regarding missing N/A in General section is resolved.
Still Text section is totally ignored in tagging.

I'll test the script on more files.

highend
Posts: 13260
Joined: 06 Feb 2011 00:33

Re: Media files tagger

Post by highend »

Still Text section is totally ignored in tagging.
Yeah, but that's the fault of MediaInfo.
If no text section exists it won't output anything for it so the whole result is empty for all entries of that section...
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

amirvf
Posts: 133
Joined: 18 Oct 2020 00:46

Re: Media files tagger

Post by amirvf »

highend wrote: 22 Nov 2020 22:45
Still Text section is totally ignored in tagging.
Yeah, but that's the fault of MediaInfo.
If no text section exists it won't output anything for it so the whole result is empty for all entries of that section...
But the behavior of MediaInfo is exactly similar in returning values if a missing parameter is requested:

Code: Select all

C:\Program Files\MediaInfo_CLI_20.09_Windows_x64>MediaInfo.exe --Inform=General;%Duration/String3% "Y:\Test\3 [22-11-2020][23-35-59]\1.mp4"
01:37:36.518

C:\Program Files\MediaInfo_CLI_20.09_Windows_x64>MediaInfo.exe --Inform=General;%Genre% "Y:\Test\3 [22-11-2020][23-35-59]\1.mp4"


C:\Program Files\MediaInfo_CLI_20.09_Windows_x64>MediaInfo.exe --Inform=Text;%Language% "Y:\Test\3 [22-11-2020][23-35-59]\1.mp4"


C:\Program Files\MediaInfo_CLI_20.09_Windows_x64>

highend
Posts: 13260
Joined: 06 Feb 2011 00:33

Re: Media files tagger

Post by highend »

Similar? Maybe. The same? No.

Code: Select all

$result = trim(runret("""$MediaInfoFile"" ""--Inform=file://$TemplateFile"" ""$file"""), <crlf>);
add a text $result; after it and you'll see that the string returned does contain Text_... entries for files that have that section and nothing for files that are missing that section.
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

highend
Posts: 13260
Joined: 06 Feb 2011 00:33

Re: Media files tagger

Post by highend »

v0.6 is online

From now on it will add attributes (with their empty value if defined) even if they aren't reported by MediaInfo because the belonging section is absent in the file
The bug with missing empty values should be fixed

Code: Select all

v0.6
  + MediaInfo does not return attribute strings for sections that don't exist
    in a file. But if the template contains them these attributes won't be
    in the tag database afterwards. This should now happen
  ! The regex to create empty value names wasn't accurate enough which lead
    to attributes missing their empty value
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

amirvf
Posts: 133
Joined: 18 Oct 2020 00:46

Re: Media files tagger

Post by amirvf »

highend wrote: 22 Nov 2020 22:58 Similar? Maybe. The same? No.

Code: Select all

$result = trim(runret("""$MediaInfoFile"" ""--Inform=file://$TemplateFile"" ""$file"""), <crlf>);
add a text $result; after it and you'll see that the string returned does contain Text_... entries for files that have that section and nothing for files that are missing that section.
I know what you mean. I just thought that the nature of the fault is similar and this MediaInfo Fault could also be covered by some revisions in the script, like the other fault which they return empty values and has been resolved by the script through EmptyValue.

I just saw 0.6 release, and it has resolved this issue as well. Thanks for the job! :tup:

Post Reply