Selur's Little Message Board

Full Version: Feature Suggestions Regarding Automatic Filename Generation
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Quote:Hmm... It would also need a way of being pointed towards user's baseline reference for Encoding settings or it won't be able to shorten the output, as well as towards the correct '*_Report.txt' file for PSNR & SSIM parsing if/when implemented. Other than that this looks good.
That would both be some for some later version of the program.

To support only showing a portion of the 'Encoding settings' an additional parameter like:
Code:
--showEncodingSettings=[param1, param2,..]
would be needed.
The tool would then additionally need to:
a. grab the 'Encoding settings' in case they exist.
b. split them by " / " and check whether there is an entry for "paramX=" and then add those values to the new file name.

For PSNR, SSIM at least two additional parameters would be needed.
Code:
--reportFile="Path to report file"
and
Code:
--report1="regexp to capture the wanted"

Problem is:
a. something like
Code:
x264 [info]: SSIM Mean Y:0.9999810 (47.223db)
x264 [info]: PSNR Mean Y:73.727 U:72.391 V:72.120 Avg:73.127 Global:69.056 kb/s:87.37
Would need to be converted to something like:
Code:
SSIM Mean Y 0.9999810 (47.223db) PSNR Mean Y 73.727 U 72.391 V 72.120 Avg 73.127 Global 69.056 87.37 kBit per second
which is really length,... Note that ':' (colon) can't be used since it's a reserved character.
b. most folks won't be able to write RegExps which I can directly feed to Qt. So this wouldn't be that easy, especially if folks should be able to select what should be added and how it should be added.

=> Writing a small program which covers the
Code:
MediaInfoRenamer --Inform=<InformCall> --Separator=<used seperator> --Merger=<append> <File>
functionality is relatively simple and probably just an hour or two programming.

Adding the parts of the 'Encoding settings' and PSNR and/or SSIM values is a lot more work.

Cu Selur
I wrote the basic version of MediaInfoRenamer (see: https://github.com/Selur/MediaInfoRenamer) and attached a 64bit Windows binary here. Smile
(copying it into you Hybrid folder should make it usable)

Cu Selur

---
Edit: binary is now in a later post
About the encoding settings.

I could add an additional option like:
Code:
--EncodingSettings=<encoding>
Quote:Parameter:
--EncodingSettings: string which specified what parameters should be represented how

So for example:
Code:
--Separator="#" --Merger="_" --EncodingSettings="CRF %crf=%#Fast-Intra %fast-intra%"
would take a "Encoding settings" string like:
Code:
cpuid=1173503 / frame-threads=4 / numa-pools=16 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=640x480 / interlace=0 / total-frames=0 / level-idc=0 / high-tier=1 / uhd-bd=0 / ref=3 / no-allow-non-conformance / no-repeat-headers / annexb / no-aud / no-hrd / info / hash=0 / no-temporal-layers / no-open-gop / min-keyint=25 / keyint=250 / bframes=4 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=20 / lookahead-slices=0 / scenecut=40 / no-intra-refresh / ctu=64 / min-cu-size=8 / no-rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=2 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / strong-intra-smoothing / max-merge=2 / limit-refs=3 / limit-modes / me=1 / subme=2 / merange=57 / temporal-mvp / weightp / no-weightb / no-analyze-src-pics / deblock=-1:-1 / sao / no-sao-non-deblock / rd=3 / no-early-skip / rskip / no-fast-intra / no-tskip-fast / no-cu-lossless / no-b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.50 / psy-rdoq=10.00 / no-rd-refine / analysis-reuse-mode=0 / no-lossless / cbqpoffs=-2 / crqpoffs=-2 / rc=crf / crf=18.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / ipratio=1.40 / pbratio=1.30 / aq-mode=1 / aq-strength=0.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=1 / overscan=0 / videoformat=5 / range=0 / colorprim=2 / transfer=2 / colormatrix=5 / chromaloc=0 / display-window=0 / max-cll=0,0 / min-luma=0 / max-luma=255 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / no-opt-cu-delta-qp / no-aq-motion / no-hdr / no-hdr-opt / no-dhdr10-opt / analysis-reuse-level=5 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=0 / limit-sao / ctu-info=0 / no-lowpass-dct / refine-mv-type=0 / copy-pic=1
and look for 'crf=' and 'fast-intra'.
It would then detect: 'crf=18.0' and 'no-fast-intra' and convert those to:
Code:
"CRF 18.0_Fast-Intra false"

This would allow to add 'Encoding settings'-part to the file name.

About adding both 'Inform' and 'Encoding settings':
To allow mixing of 'Inform' and 'Encoding settings' multiple instances of both parameters would be accepted and their order would determine the order in which they are added.
Options like:
Code:
--Separator="#" --Merger="_" --Inform="Video#Width %Width%%" --EncodingSettings="CRF %crf=%" -Inform="Video;Height %Height%%"
could result in a name addition like:
Code:
Width 660_CRF 18.0_Height 480

=> Should I add this? Any thoughts about it?

Cu Selur
(19.11.2017, 05:54)Selur Wrote: [ -> ]About adding both 'Inform' and 'Encoding settings':
To allow mixing of 'Inform' and 'Encoding settings' multiple instances of both parameters would be accepted and their order would determine the order in which they are added.
Options like:
Code:
--Separator="#" --Merger="_" --Inform="Video#Width %Width%%" --EncodingSettings="CRF %crf=%" -Inform="Video;Height %Height%%"
could result in a name addition like:
Code:
Width 660_CRF 18.0_Height 480

=> Should I add this? Any thoughts about it?
Sure, it would have it's uses, however it wouldn't be quite as useful by itself as with a blacklist for baseline settings.

I've been trying to identify and categorize potential problems and solutions relating to special characters for couple of hours now. Looks like MediaTab output differs in some ways from what MediaInfoRenamer produces, so the list below might not be completely accurate, but here goes:

I'd use a RegEx based output filter for replacing any unusable characters, the main ones i keep seeing used in MediaInfo output being: '/' & ':'
  1. RegEx Replace: all instances of "kb/s" with "Kbps".
  2. As exceptions to oncoming stages: RegEx Replace ':' with '÷' for 'Display aspect ratio' & '/' with '÷' for 'frame rate'.
  3. RegEx Replace ':' with either '¦' or ' - As these would be very readable in the context of timecodes, which seem to be the main usage case here (aside from 'Display aspect ratio'), unlike '.' or ';' which already seem to have a specific uses in the context of timecodes and would require further replace actions for the sake of clarity.
  4. RegEx Replace '/' with ';' - As the former seems to be mostly used in listing stuff like 'Channel positions' & 'Encoding settings' (aside from 'Frame rate'), while the latter is previously unused in those contexts while also having a similar meaning in everyday use.
  5. RegEx Replace " with ' - I'm not sure if this is even used anywhere as i didn't encounter any examples, however it's the closest match.
  6. RegEx Replace any of these: '/\|?*' with '' (as in nothing) or perhaps '_'
Letting users specify RegExs is a bad since most users can't use them. So this would only be an additional option for advanced users.
What you specified there are just replacement so an additional option could be added:
Code:
--Separator="#" --Replacements="kb/s%Kbps#:%¦"
this would tell the Renamer to replace "kb/s" with "Kbps" and ":" with "¦" inside part of the additions string.
So
Code:
640 pixels_352 pixels_722 kb/s_25.000 FPS
from before, would end up ad:
Code:
640 pixels_352 pixels_722 Kbps/s_25.000 FPS
As a side note: Replacing "kb/s" with "Kbps" is a bad thing since the first implies k = 1000 and the second K = 1024. (see: https://en.wikipedia.org/wiki/Kilobit)

Cu Selur
(19.11.2017, 06:51)Selur Wrote: [ -> ]Letting users specify RegExs is a bad since most users can't use them. So this would only be an additional option for advanced users.
Actually i was just looking at the problem from the perspective of execution order and one possible method used, not from end-user's perspective, as in what to show them.

(19.11.2017, 06:51)Selur Wrote: [ -> ]What you specified there are just replacement so an additional option could be added:
Code:
--Separator="#" --Replacements="kb/s%Kbps#:%¦"
this would tell the Renamer to replace "kb/s" with "Kbps" and ":" with "¦" inside part of the additions string.
So
Code:
640 pixels_352 pixels_722 kb/s_25.000 FPS
from before, would end up ad:
Code:
640 pixels_352 pixels_722 Kbps/s_25.000 FPS
Looks good. PS. Just realized that the exceptions from second step of my RegEx example would give the simple replacement approach trouble when those symbols are also required in another context. (e.g. %AspectRatio/String% & %Duration/String4% both use ':')

(19.11.2017, 06:51)Selur Wrote: [ -> ]As a side note: Replacing "kb/s" with "Kbps" is a bad thing since the first implies k = 1000 and the second K = 1024. (see: https://en.wikipedia.org/wiki/Kilobit)
Indeed, i was copy-pasting lines from MediaTab while comparing them to MediaInfoRenamer outputs and failed to catch that.

PS. I kept seeing multiple output format choices in MediaTab and after some testing found out that there is an undocumented feature in MediaInfoRenamer: Replacing '/String' with '/String1', etc. will give different output formats when available. Order equivalence to MediaTab is: '%StreamSize%', '%StreamSize/String%', '%StreamSize/String1%', '%StreamSize/String2%', etc.
Here's a MediaInfoRenamer build which also supports:
  • '--EncodingSettings':  analog zu den 'Inform'-parameter once specified
    that some of the encoding setting should be added to the output name.
  • '--Replacements': List of replacements separated by 'Sepearator'
    Note now multiple instances of '--Inform' and '--EncodingSettings' can
    be used

Cu Selur
(19.11.2017, 10:02)Selur Wrote: [ -> ]Here's a MediaInfoRenamer build which also supports:
  • '--EncodingSettings': analog zu den 'Inform'-parameter once specified
    that some of the encoding setting should be added to the output name.
  • '--Replacements': List of replacements separated by 'Sepearator'
    Note now multiple instances of '--Inform' and '--EncodingSettings' can
    be used

Cu Selur
Got around to properly testing this build today and found that while '--Replacements=' works as specified above, '--Encoding settings' doesn't alter the filename at all, unless '=' is removed. As an example:
Code:
"MediaInfoRenamer.exe" --EncodingSettings="crf %crf=%#ipratio#pbratio=#qcomp%qcomp%" --Separator="#" --Merger="_" test.mkv
Results in a file named 'test_0.80%0.80%.mkv' (when qcomp = 0.8)

PS. Being able to use wildcards to select multiple files for input and/or removing parts of an already long filename(s) would make this tool easier to integrate into one's workflow.
For example: test*.mkv for renaming both 'test1.mkv' & 'test2.mkv' or 'MediaFile_*.mkv' for renaming previously renamed 'MediaFile_1001kbps.mkv' & 'MediaFile_23.976fps.mkv'.
LOL, I see my mistake. Smile
+
your call should be:
Code:
"MediaInfoRenamer.exe" --EncodingSettings="crf %crf%#%ip_ratio%#%pb_ratio%#qcomp%qcomp%" --Separator="#" --Merger="_" test.mkv
(23.11.2017, 20:56)Selur Wrote: [ -> ]LOL, I see my mistake. Smile
+
your call should be:
Code:
"MediaInfoRenamer.exe" --EncodingSettings="crf %crf%#%ip_ratio%#%pb_ratio%#qcomp%qcomp%" --Separator="#" --Merger="_" test.mkv
I realize above isn't proper usage; systematically running through variations while removing stuff was just my method for narrowing the problem down to '=', so i decided to retain the variations in my example to better showcase the way this feature is broken.

Code:
"MediaInfoRenamer.exe" --EncodingSettings="crf %crf%#%ip_ratio%#%pb_ratio%#qcomp%qcomp%" --Separator="#" --Merger="_" test.mkv
Filename resulting from the corrected example you posted is: 'test_28.0 %28.0%_0.80%0.80%.mkv'
Pages: 1 2 3 4