MediaArea / MediaConch

MediaConch (funded by PREFORMA)
29 stars 11 forks source link

Mediaconch Rule with * passing when values differ across tracks #230

Closed jsciame closed 2 years ago

jsciame commented 2 years ago

We have a policy where we are saying all audio tracks, bit depth must be 24 bits.

AdVaultContributionSpec(1).txt

When we run the report you'll see it passes.

<rule name="Sample Bit Depth" value="BitDepth" tracktype="Audio" occurrence="*" operator="=" xpath="mi:MediaInfo/mi:track[@type='Audio'][*]/mi:BitDepth='24'" requested="24" actual="24" outcome="pass"/>

mediaconch_report.txt

You'll notice below that one is 24 bit and the other is 16 bit.

`Audio #1 ID : 2 Format : PCM Format settings : Little / Signed Codec ID : in24 Duration : 37 s 80 ms Bit rate mode : Constant Bit rate : 6 912 kb/s Channel(s) : 6 channels Channel layout : L R C LFE Ls Rs Sampling rate : 48.0 kHz Bit depth : 24 bits Stream size : 30.6 MiB (4%) Title : 5.1 Encoded date : UTC 2022-06-30 17:01:49 Tagged date : UTC 2022-06-30 17:01:49

Audio #2 ID : 3 Format : PCM Format settings : Little / Signed Codec ID : sowt Duration : 37 s 80 ms Bit rate mode : Constant Bit rate : 1 536 kb/s Channel(s) : 2 channels Channel layout : L R Sampling rate : 48.0 kHz Bit depth : 16 bits Stream size : 6.79 MiB (1%) Encoded date : UTC 2022-06-30 17:01:49 Tagged date : UTC 2022-06-30 17:01:49`

Version: MediaConch Command Line Interface 22.03.20220528

is this the right use of *? Also, this begs the question how do you display the result in the report when track 1 is 24 and track 2 is 16. You almost need to instead of returning a single line in the report return multiple lines, one per track. something like:

<rule name=“Sample Bit Depth” value=“BitDepth” tracktype=“Audio” occurrence=“1" operator=“=” xpath=“mi:MediaInfo/mi:track[@type=‘Audio’][1]/mi:BitDepth=‘24’” requested=“24” actual=“24" outcome=“pass”/> <rule name=“Sample Bit Depth” value=“BitDepth” tracktype=“Audio” occurrence=“2” operator=“=” xpath=“mi:MediaInfo/mi:track[@type=‘Audio’][2]/mi:BitDepth=‘16’” requested=“24" actual=“16” outcome=“fail”/>

Thanks!

JeromeMartinez commented 2 years ago

* means "any" there. Checking all tracks is possible but requires 1 line per track, and in case you don't know the count of tracks another line "if track count < x" then a policy doing a "or" of both lines ( = if track does not exist or bit depth is 24), this for the max count of tracks you may have.

Actually the wording "occurrence" was not the best.

Not the most usable method, so we added in https://github.com/MediaArea/MediaConch_SourceCode/pull/731 all as a possibility for occurrence. (and also any as a synonym of *)

jsciame commented 2 years ago

Thanks @JeromeMartinez I did a test of "all" in the 20220709 snapshot build and it does seem to catch the issue of having one track as bit depth 16 and another track of bit depth 24, however the report is not what I'd expect.

<rule name="Sample Bit Depth" value="BitDepth" tracktype="Audio" occurrence="all" operator="=" xpath="mi:MediaInfo/mi:track[@type='Audio'][*]/mi:BitDepth" requested="24" actual="24" outcome="fail"/>

You get a line that says requested="24" actual="24" outcome="fail" which is a bit confusing to an operator as the value of request and actual match. I think the report here would need to automatically break from occurrence "any" to have 2 lines like this, one for each track on output.

<rule name=“Sample Bit Depth” value=“BitDepth” tracktype=“Audio” occurrence=“1" operator=“=” xpath=“mi:MediaInfo/mi:track[@type=‘Audio’][1]/mi:BitDepth=‘24’” requested=“24” actual=“24" outcome=“pass”/> <rule name=“Sample Bit Depth” value=“BitDepth” tracktype=“Audio” occurrence=“2” operator=“=” xpath=“mi:MediaInfo/mi:track[@type=‘Audio’][2]/mi:BitDepth=‘16’” requested=“24" actual=“16” outcome=“fail”/>

JeromeMartinez commented 2 years ago

You get a line that says requested="24" actual="24" outcome="fail" which is a bit confusing to an operator as the value of request and actual match.

We show now the first failing value with https://github.com/MediaArea/MediaConch_SourceCode/pull/732, but still no split per track, which would be longer to implement and we also need to think more about how to output it.