Video AND Photo resolution column
-
- Posts: 79
- Joined: 26 Sep 2020 10:10
Video AND Photo resolution column
Hey all, just wondering, is it possible to make a custom column that shows both the video and photo resolution?
It would be good to combine the code below with something for images, but i cannot seem to find a script for calling image resolutions
$mediaInfo = "C:\Program Files\MediaInfo_CLI_20.08_Windows_x64\MediaInfo.exe";
return regexreplace(runret("$mediaInfo --Inform=Video;%Width%x%Height% ""<cc_item>"""), "\r?\n");
It would be good to combine the code below with something for images, but i cannot seem to find a script for calling image resolutions
$mediaInfo = "C:\Program Files\MediaInfo_CLI_20.08_Windows_x64\MediaInfo.exe";
return regexreplace(runret("$mediaInfo --Inform=Video;%Width%x%Height% ""<cc_item>"""), "\r?\n");
Re: Video AND Photo resolution column
Create a file like inform.txt somewhere and fill it with
and call it e.g. with --Inform="file://d:/inform.txt" on your <cc_item>
Code: Select all
Video;%Width%x%Height%
Image;%Width%x%Height%
One of my scripts helped you out? Please donate via Paypal
-
- Posts: 79
- Joined: 26 Sep 2020 10:10
Re: Video AND Photo resolution column
little bit confused, is
--Inform="file://d:/inform.txt" on your <cc_item>
a script for the custom column?
i would like a column that displays hundreds of resolutions etc, just all in one column
--Inform="file://d:/inform.txt" on your <cc_item>
a script for the custom column?
i would like a column that displays hundreds of resolutions etc, just all in one column
Re: Video AND Photo resolution column
Sure it is
Replace your
with
in your cc script
Replace your
--Inform=Video;%Width%x%Height%
with
--Inform=""file://d:/inform.txt""
(or wherever you've created that file)in your cc script
One of my scripts helped you out? Please donate via Paypal
-
- Posts: 79
- Joined: 26 Sep 2020 10:10
Re: Video AND Photo resolution column
So for example:
$mediaInfo = "C:\Program Files\MediaInfo_CLI_20.08_Windows_x64\MediaInfo.exe";
return regexreplace(runret("$mediaInfo --Inform="file://C:/Program Files/MediaInfo_CLI_20.08_Windows_x64/New Text File.txt" ""<cc_item>"""), "\r?\n");
this returns:
runexreplace(runret("C:\Program Files\MediaInfo_CLI_20.08_Windows_x64\MediaInfo.exe --Inform="file:
im pretty sure im doing what you suggested, or did i make a mistake?
also do you think calling that file would result in slow downs?
$mediaInfo = "C:\Program Files\MediaInfo_CLI_20.08_Windows_x64\MediaInfo.exe";
return regexreplace(runret("$mediaInfo --Inform="file://C:/Program Files/MediaInfo_CLI_20.08_Windows_x64/New Text File.txt" ""<cc_item>"""), "\r?\n");
this returns:
runexreplace(runret("C:\Program Files\MediaInfo_CLI_20.08_Windows_x64\MediaInfo.exe --Inform="file:
im pretty sure im doing what you suggested, or did i make a mistake?
also do you think calling that file would result in slow downs?
Re: Video AND Photo resolution column
You need two quotation marks around it (in the same way as with ""<cc_item>"") and that file is in the file cache so it shouldn't cause any slowdowns
One of my scripts helped you out? Please donate via Paypal
-
- Posts: 79
- Joined: 26 Sep 2020 10:10
Re: Video AND Photo resolution column
thats awesome mate, thank you, just donated a little
got a few more questions
say i have this script:
Audio Codec
$mediaInfo = "C:\Program Files\MediaInfo_CLI_20.08_Windows_x64\MediaInfo.exe";
return regexreplace(runret("$mediaInfo --Inform=Audio;%Format% ""<cc_item>"""), "\r?\n");
To output: AACAAC
but i also want to display number of streams
Audio Streams
$mediaInfo = "C:\Program Files\MediaInfo_CLI_20.08_Windows_x64\MediaInfo.exe";
return regexreplace(runret("$mediaInfo --Inform=General;%AudioCount% ""<cc_item>"""), "\r?\n");
anyway to combine it so it displays something like AAC x 2
Also i cant figure out how to output spaces
got a few more questions
say i have this script:
Audio Codec
$mediaInfo = "C:\Program Files\MediaInfo_CLI_20.08_Windows_x64\MediaInfo.exe";
return regexreplace(runret("$mediaInfo --Inform=Audio;%Format% ""<cc_item>"""), "\r?\n");
To output: AACAAC
but i also want to display number of streams
Audio Streams
$mediaInfo = "C:\Program Files\MediaInfo_CLI_20.08_Windows_x64\MediaInfo.exe";
return regexreplace(runret("$mediaInfo --Inform=General;%AudioCount% ""<cc_item>"""), "\r?\n");
anyway to combine it so it displays something like AAC x 2
Also i cant figure out how to output spaces
Re: Video AND Photo resolution column
E.g.:
with stream_format.txt content of:
Code: Select all
$mediaInfo = "C:\Program Files\MediaInfo_CLI_20.08_Windows_x64\MediaInfo.exe";
$result = trim(runret("""$mediaInfo"" --Inform=""file://C:/Program Files/MediaInfo_CLI_20.08_Windows_x64/stream_format.txt"" ""<cc_item>"""), <crlf>);
return regexreplace($result, "(^\d+?)([a-z].+)$", "$2 x $1");
Code: Select all
Audio;%Format%
General;%AudioCount%
One of my scripts helped you out? Please donate via Paypal
Re: Video AND Photo resolution column
You may want to also look into using a "mixed" column type where you would use Special Property Dimensions or whatever for your images file types and use your MediaInfo for your video. You make a new mixed type column, name it and select the 2 column types one for Image dimensions and one for Video dimension using your existing Video size script. You shouldn't need to use MediaInfo for image files (i.e., there are plenty of XY built-in Special Properties and Windows canonical properties to use). From the help file...it's worth looking into even if you don't use it for this.
· Mixed: The column is defined as a set of other Custom Columns. If those other Custom Columns have non-overlapping Filters defined you can make a context-sensitive column this way which will display data in dependence of the file type. You could e.g. show pixel dimensions for images, play time for audio files, page count for documents, and the version number for executables -- all in ONE column! Details see Mixed Columns below.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440
-
- Posts: 79
- Joined: 26 Sep 2020 10:10
Re: Video AND Photo resolution column
highend wrote: ↑26 Sep 2020 14:47 E.g.:with stream_format.txt content of:Code: Select all
$mediaInfo = "C:\Program Files\MediaInfo_CLI_20.08_Windows_x64\MediaInfo.exe"; $result = trim(runret("""$mediaInfo"" --Inform=""file://C:/Program Files/MediaInfo_CLI_20.08_Windows_x64/stream_format.txt"" ""<cc_item>"""), <crlf>); return regexreplace($result, "(^\d+?)([a-z].+)$", "$2 x $1");
Code: Select all
Audio;%Format% General;%AudioCount%
Thank you so much for the help btw, ill donate some more if you can help me with this:
Is there anyway to make it show
AAC x 2, instead of AACAAC x 2?
And say i also wanted to include video codec, and any subtitles if a file has any, i understand how you would include these parameters in the .txt file but im a bit confused in this line:
return regexreplace($result, "(^\d+?)([a-z].+)$", "$2 x $1");
i dont really understand what all the codes represent
so say i have a file with 1 video stream, 2 audio, 3 subtitles
HEVCx265, AAC x 2, PGS x 2
for example
this is the current code i use for my video:
$mediaInfo = "C:\Program Files\MediaInfo_CLI_20.08_Windows_x64\MediaInfo.exe";
return regexreplace(runret("$mediaInfo --Inform=Video;%Format%%Encoded_Library_Name% ""<cc_item>"""), "\r?\n");
-
- Posts: 79
- Joined: 26 Sep 2020 10:10
Re: Video AND Photo resolution column
Thanks for that, what i have noticed is there is quiet a drastic slow down with MediaInfo columns, so i setup shortcuts to change column layouts for when i need fast browsing to informed video column browsing for exampleklownboy wrote: ↑26 Sep 2020 16:58 You may want to also look into using a "mixed" column type where you would use Special Property Dimensions or whatever for your images file types and use your MediaInfo for your video. You make a new mixed type column, name it and select the 2 column types one for Image dimensions and one for Video dimension using your existing Video size script. You shouldn't need to use MediaInfo for image files (i.e., there are plenty of XY built-in Special Properties and Windows canonical properties to use). From the help file...it's worth looking into even if you don't use it for this.· Mixed: The column is defined as a set of other Custom Columns. If those other Custom Columns have non-overlapping Filters defined you can make a context-sensitive column this way which will display data in dependence of the file type. You could e.g. show pixel dimensions for images, play time for audio files, page count for documents, and the version number for executables -- all in ONE column! Details see Mixed Columns below.
Would you using a mixed column would speed up browsing?
Re: Video AND Photo resolution column
The fastest way is to decide in the script if image of video properties are needed (by file extension) and only use mediainfo for video and the
property()
script command for images for all properties.By using a simpleAAC x 2, instead of AACAAC x 2?
replace()
script commandThat was necessary because format and count were unseparated and needed a different order. By using \r\n at the end of each line in the .txt file you could useAnd say i also wanted to include video codec, and any subtitles if a file has any, i understand how you would include these parameters in the .txt file but im a bit confused in this line:
return regexreplace($result, "(^\d+?)([a-z].+)$", "$2 x $1");
gettoken()
to get the necessary parts insteadOne of my scripts helped you out? Please donate via Paypal
Re: Video AND Photo resolution column
E.g.:
with this content for the stream_format.txt file:
Code: Select all
if (strpos(get("genericfiletype", "{:Image}"), "*.<cc_ext>") != -1) {
return property("#image.dimensions", <cc_item>);
// Video(s)
} elseif (strpos(get("genericfiletype", "{:Video}"), "*.<cc_ext>") != -1) {
$mediaInfo = "C:\Program Files\MediaInfo_CLI_20.08_Windows_x64\MediaInfo.exe";
$result = trim(runret("""$mediaInfo"" --Inform=""file://C:/Program Files/MediaInfo_CLI_20.08_Windows_x64/stream_format.txt"" ""<cc_item>""", , 65001), <crlf>, "R");
$general = gettoken($result, 1, <crlf>);
$video = gettoken($result, 2, <crlf>);
$audio = gettoken($result, 3, <crlf>);
$vDimensions = gettoken($video, 1, ":");
$vFormat = gettoken($video, 2, ":");
$output = "$vDimensions, $vFormat, $audio x $general";
$output = replace($output, "AACAAC", "AAC");
return $output;
}
Code: Select all
General;%AudioCount%\r\n
Video;%Width%x%Height%:%Format%%Encoded_Library_Name%\r\n
Audio;%Format%\r\n
One of my scripts helped you out? Please donate via Paypal
Re: Video AND Photo resolution column
I haven't tested your script, but to me it looks like it will give a false count of the audio tracks, if for example you have a file with a AAC, AC3, DTS tracks, currently it would be listed as AAC x 3 I think, another thing is that if you had say 3+ AAC tracks in a row the AACAAC replacement would fail to produce the desired return I assume, also if the same codecs weren't adjacent you would have multiple listings.
Also if you decide to change it, subtitles are excluded currently, but were requested, although you may be leaving it up to the OP to add that part themselves.
Also if you decide to change it, subtitles are excluded currently, but were requested, although you may be leaving it up to the OP to add that part themselves.
Re: Video AND Photo resolution column
Quite possible. But I neither have such video files to test and not the time to mux them (apart from the multitude of possible combinations).but to me it looks like it will give a false count of the audio tracks, if for example you have a file with a AAC, AC3, DTS tracks, currently it would be listed as AAC x 3 I think, another thing is that if you had say 3+ AAC tracks in a row the AACAAC replacement would fail to produce the desired return I assume
That's the intention, because he said:subtitles are excluded currently, but were requested, although you may be leaving it up to the OP to add that part themselves.
I just wanted to show how my comments from the previous post can be implemented scripting wise...And say i also wanted to include video codec, and any subtitles if a file has any, i understand how you would include these parameters in the .txt file
One of my scripts helped you out? Please donate via Paypal