Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Announcements and Chat > General Discussion

Reply
 
Thread Tools Search this Thread Display Modes
Old 29th January 2017, 18:49   #1  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,502
Get-MediaInfo - a complete PowerShell MediaInfo solution

Visit the project site at:

https://github.com/stax76/Get-MediaInfo

Last edited by stax76; 29th March 2020 at 02:19.
stax76 is offline   Reply With Quote
Old 16th October 2019, 09:24   #2  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,502
This is a complete new project and this time I think I know what I'm doing.

https://github.com/stax76/Get-MediaInfo

Last edited by stax76; 16th October 2019 at 09:34.
stax76 is offline   Reply With Quote
Old 16th October 2019, 13:36   #3  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 8,528
MediaInfo CLI does not allow to interrogate specific info from a stream that is one of many streams of same type, eg 2nd audio stream when there are 4 audio streams.

In not CLI (eg MediaInfo dll) :::---
Audio stream index 0, is used for single stream count stream, and 1 for first of multi-stream audio.
My MIFO_Lib thing:- https://forum.doom9.org/showthread.p...light=MIFO_LIB
dont allow for multi-stream info extraction, because the CLI dont work proper. [You can extract everything, and then extract from that, there are functions to do it in MIFO_LIB).

One thing I want is "TOTAL STREAM ORDER" index (dont know what else to call it, ie stream order where all streams of all types are counted).
When using LSMash or ffms2, and wanting to know specific info about a stream that we are perhaps gonna extract (maybe we want stream with greatest video resolution and so have to find out which one we want),
then we need to know TOTAL STREAM ORDER index, and tell LSMash/ffms2 to extract that track (or maybe it is eg video index with LSMash and total index with ffms2, Or the other way around, cant remember, but at least one of them is awkward).

I wish you luck with this project, at least with the CLI version MI, it is not a totally pleasant task.

Quote:
I think I know what I'm doing.
I'm quite sure that I dont know what I'm doing.

EDIT: You can check above out by muxing the same multiple video and multiple audio streams in differing orders (EDIT: then try extracting tracks using LSMash and ffms2, you [EDIT: can] get different results I think).
(I used Yamb I think for this ordered muxing).
EDIT: "Differing orders", eg V1,V2,V3,V4,A1,A2,A3,A4 and A1,V1,A2,V2,A3,A4,V3,V4.
Make all video streams different sizes and all audio stream differing samplerates, so you know which one you got.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 16th October 2019 at 19:05.
StainlessS is online now   Reply With Quote
Old 16th October 2019, 17:32   #4  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,502
You know PowerShell? It's hard to learn but I'm absolutely willing to help.

Are you sure ffms2 or l-smash need total index and not kind index? Sounds like bad design and besides that I don't think MediaInfo gives you this info, I just checked and couldn't find it.

To use the PowerShell function you will need a proper MediaInfo GUI which will show you the names of the parameters you need to query, I don't think the official GUI shows this because I tried it and couldn't find out how to do it. The official MediaInfo CLI app is probably able to show it but I think using a GUI is much easier for this kind of task. I don't know if Lord Mulders GUI shows it, if not you can ask him to support it. My GUI shows it, I think it's the best GUI because it's searchable which dramatically boosts productivity, to use it you will need to learn Open with++ and you need staxrip.

https://github.com/stax76/OpenWithPlusPlus

The docs have a config example to show you exactly the configuration you need:

https://github.com/stax76/OpenWithPlusPlus#mediainfo

You need to enable developer mode in the context menu otherwise it does not show you the parameter names used by the MediaInfo API.

I've also a standalone GUI you can try, I don't remember if it supports dev mode.

https://forum.doom9.org/showthread.php?t=176886

It's sad how many people still use CMD and how few people use PowerShell and Windows Terminal.

https://www.youtube.com/watch?v=8gw0rXPMMPE

edit:

Both Mulders GUI and the original GUI show the API parameter names only in XML view and not in text view, my GUI can show it in text view, it's searchable which is the most important feature and it supports High DPI.

edit2:

My standalone GUI does not yet support dev mode but the one in staxrip does.

edit3:

Demuxing with l-smash and ffms2 might not be the best way, especially when dealing with TS, which type of file do you have? There should be better demuxers for all type of files.

Last edited by stax76; 16th October 2019 at 18:05.
stax76 is offline   Reply With Quote
Old 16th October 2019, 17:58   #5  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 8,528
One or other of them defo uses total index, try out the muxing thing, you will get different results [see EDIT's].
I had sort of intended to try do an avisynth dll linking to Mediainfo dll, Tried compiling MI from source, dont think I managed to get it to work,
I thought it was a bit messy (source directories) and things just did not work [old VS2008 project files not maintained].

The 'total' index has entries but need use RAW and FULL to get at them (but not from CLI), forget what they are called though.

MIFO_LIB can extract ALL data, and if you make a mistake, and try to get something where CLI fails, will return the whole lot.

Here, Inform parameters extracted FULL, RAW, from some time in 2016, (~ v0.78), 10KB 7Z, expands to 101KB:- http://www.mediafire.com/file/dqunk8...meters.7z/file

No help required here thanks, I got way to much on my plate already, maybe I get a dll working one day (I really do want that for myself).

EDIT: Not sure, think hi-lited below might be the 'total index'.
Code:
General 
Count                     : Count of objects available in this stream
Status                    : bit field (0=IsAccepted, 1=IsFilled, 2=IsUpdated, 3=IsFinished)
StreamCount               : Count of streams of that kind available
StreamKind                : Stream type name
StreamKind/String         : Stream type name
StreamKindID              : Number of the stream (base=0)
StreamKindPos             : When multiple streams, number of the stream (base=1)
StreamOrder               : Stream order in the file, whatever is the kind of stream (base=0)
FirstPacketOrder          : Order of the first fully decodable packet met in the file, whatever is the kind of stream (base=0)
Inform                    : Last **Inform** call
ID                        : The ID for this stream in this file
EDIT: "Extract Whole Lot"
This post:- https://forum.doom9.org/showthread.p...21#post1760221
Code:
S = MIFO_Get(Fn,"",Full=True,Raw=True,Debug=DEBUG)SCROLL=True             # Extract Entire Info, Full Raw Parameters and data
Can extract EVERYTHING, for a media file. [Run the demo, uncomment that line, it will scroll the entire extracted text upwards for quite a long time]
The "SCROLL" thing at end of line is a sort of "Easter Egg", where user is supposed to get a surprise when uncommented and run.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 16th October 2019 at 18:27.
StainlessS is online now   Reply With Quote
Old 16th October 2019, 18:10   #6  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,502
I don't think you get this info from MediaInfo or do you see it here:

https://pastebin.com/NE9Dia8C

edit:

I don't think 'ID' will work for all file types, which file types do you work with?

edit2:

In TS files:

Code:
ID                       : 337
I have doubts that ffms2 and l-smash can handle TS well, will likely often get async audio playback, I would use dgdecnv, ts-doctor or remux to mkv with ffmpeg.

edit3:

AviSynth is not well suited for the stuff you do, have you ever considered VapourSynth? Maybe take a look at staxrip, it's the easiest way for making first steps with VapourSynth as it supports complex scripts like QTGMC and has both code editor and code preview, once you got a raw idea of what VapourSynth can do, you can learn how to use it with a real editor like Visual Studio Code.

Last edited by stax76; 16th October 2019 at 18:33.
stax76 is offline   Reply With Quote
Old 16th October 2019, 18:21   #7  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 8,528
I think that its blue below

Code:
Video
 
Count                    : 377
StreamCount              : 1
StreamKind               : Video
StreamKind/String        : Video
StreamKindID             : 0
StreamOrder              : 0
ID                       : 1
ID/String                : 1
UniqueID                 : 1
OK missed your edit, maybe its UniqueID [EDIT: NO Its NOT], but I thought was ID in files I was trying.

EDIT: I dont know if at all relevant, but your ID and my Count are both 377, bit of a coincidence. [Count, is I think number of data items extracted by mediaInfo for video stream]

EDIT: "which file types do you work with?"
All of them

EDIT: Might also be 0 relative StreamOrder. [although dont get an entry for type Menu].
from your pastebin post
Code:
Video
StreamOrder              : 0
ID                       : 1

Audio #1
StreamOrder              : 1
ID                       : 2

Audio #2
StreamOrder              : 2
ID                       : 3

Text #1
StreamOrder              : 3
ID                       : 4

Text #2
StreamOrder              : 4
ID                       : 5

Menu
Count                    : 104
StreamCount              : 1
StreamKind               : Menu
StreamKind/String        : Menu
StreamKindID             : 0
EDIT: If you mux multiple video and multiple audio in shuffled order, then MI returns them in all video + all audio, order, but I think at least one of ID/StreamOrder will be in unsorted order.

EDIT:
I wrote below in script when I was last working on this (7 aug 2019 EDIT: Actually that seems a bit too recent, maybe I just edited something in script in Aug), seem to be for LSMashVideoSource
Quote:
# ISO seem to find the V/A mux ordered track of the next stream of selectted type, if choose #3 video, and #3 track is audio then will return track 4 if that is video.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 16th October 2019 at 20:52.
StainlessS is online now   Reply With Quote
Old 16th October 2019, 20:06   #8  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,502
StreamOrder might be it.

In VapourSynth with Python you could access the mediainfo library directly with few lines code. Python is like VB.NET a good and easy language.

https://realpython.com
stax76 is offline   Reply With Quote
Old 29th March 2020, 02:31   #9  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,502
Version 2.0 is out, included are three advanced functions that are supposed to cover everything a PowerShell user could ask for.

It's super fast on the second run due to caching and due to the hardware accelerated WPF based Out-GridView.

https://github.com/stax76/Get-MediaInfo
stax76 is offline   Reply With Quote
Old 11th April 2020, 11:21   #10  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,502
3.0 is a bug fix release.

https://github.com/stax76/Get-MediaInfo
stax76 is offline   Reply With Quote
Old 11th April 2020, 12:26   #11  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 8,528
Cheers Stax, hope I get time to play with it some day.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is online now   Reply With Quote
Old 12th April 2020, 09:18   #12  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,502
Quote:
Originally Posted by StainlessS View Post
Cheers Stax, hope I get time to play with it some day.
Hello StainlessS, how do you show media info at the moment? Maybe try MediaInfo.NET. It can show a folder view powered by Get-MediaInfo and the PowerShell cmdlet Out-GridView. Other than that I only used Get-MediaInfo to help a staxrip power user to write a small script for a requested feature and I use it sometimes to find duplicates:

Code:
gci | gmi | select filename, duration, filesize | group duration | where { $_.count -gt 1 } | select -expand group | format-list

My tools need better documentation, so I improved the website today:

https://github.com/stax76/Get-MediaInfo


If you need PowerShell training please take a look here:

https://adamtheautomator.com/tag/powershell/


The most important PowerShell tools are the Windows Terminal that is available for Windows 10 and the Visual Studio Code extension.

I don't know why other people like the terminal, for me it was mpv and Windows Terminal that got me really interested and since then I use the terminal and powershell scripting all the time and really love it.
stax76 is offline   Reply With Quote
Old 12th April 2020, 12:14   #13  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 8,528
I dont often use MediaInfo other than to click on media file and view bare info on explorer status bar, only occasionally use MediaInfo full stuff,
I downed your GUI thing yesterday (probably got an older version somewhere, I down loads of stuff to have it accumulate in an inbox
which has been well overflowed for years, I got about 4 maybe 5 hundred avs dll's alone to sieve through, some in a dozen versions,
and little info on what version they are [ffms2 is a big sinner there]).

Thanx for the Powershell info, gotta get into that at some point, Python also would be on my todo list.
Windows 10, no thanx, I use it on Tablet/Laptop thingy but only in pub, dont want it on desktop.

More power to ya, and thanx again

EDIT: I had not realized it, but Powershell is available on linux.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 12th April 2020 at 15:15.
StainlessS is online now   Reply With Quote
Old 12th April 2020, 16:08   #14  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,502
PowerShell is unique because it's a hybrid between a command language such as windows batch and bash and a classic scripting language. In a classic language a function call most of the time looks like so:

DoSomething(aaa, bbb)

In powershell you can call a function like this but it gets you unexpected results, you have to call it like so:

DoSomething aaa bbb

So the syntax looks like a command line which makes of course sense for command language.

What makes PowerShell unique and powerful is that it's not only a command language but also a full-blown object-oriented dotnet language with full access to the dotnet ecosystem, so it's much better than bash, the reason why Linux does not have something better than bash is they simply use Python instead.

The downside is that PowerShell is difficult to master, the reasons are it's a very powerful tool and very different compared to classical languages, it was a struggle to reach the point where the struggle transitioned to confidence.

What makes it really important for me is that you can add extension/scripting support to a dotnet app effortlessly, look how simple it is:

https://github.com/staxrip/staxrip/b.../PowerShell.vb

https://github.com/stax76/mpv.net/bl.../PowerShell.cs

What's also nice is sometimes doing something with PowerShell is like 10 times easier than doing something with VB.NET or C#, so I use PowerShell internally more and more solving problems easily and elegantly.

https://github.com/stax76/mpv.net/bl...ommand.cs#L303

I hope you find time someday for powershell and I for python and few other languages.

Last edited by stax76; 12th April 2020 at 16:15.
stax76 is offline   Reply With Quote
Old 4th May 2020, 00:51   #15  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,502
Changes in Version 3.3:

- issue with some relative and network input paths fixed by using Convert-Path

- $ErrorActionPreference='Stop' removed because it doesn't make sense to dot source this in the profile because it's not the default

- MediaInfoNET.dll renamed to MediaInfoSharp.dll because Get-MediaInfo and MediaInfoNET.dll are used in MediaInfo.NET and there it caused a bug due to a namespace name clash, settings dialog cannot be opened after the Folder View was shown using Get-MediaInfo, new MediaInfo.NET version will be released soon

- improved website

- issue fixed loading MediaInfoSharp.dll, no longer relies on changing the process path env var.

https://github.com/stax76/Get-MediaInfo
stax76 is offline   Reply With Quote
Old 22nd September 2020, 17:40   #16  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,502
3.5 fixes an issue with files containing certain characters like brackets.


website:
https://github.com/stax76/Get-MediaInfo


powershellgallery/powershellget:

https://www.powershellgallery.com/pa.../Get-MediaInfo
stax76 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 13:17.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.