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
 
stax76's Avatar
 
Join Date: Jun 2002
Location: Chamber 36
Posts: 5,855
Get-MediaInfo - getting MediaInfo properties with PowerShell

Visit the project site at:

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


Last edited by stax76; 16th October 2019 at 22:47.
stax76 is offline   Reply With Quote
Old 16th October 2019, 10:24   #2  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: Chamber 36
Posts: 5,855
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 10:34.
stax76 is offline   Reply With Quote
Old 16th October 2019, 14:36   #3  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,207
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 20:05.
StainlessS is offline   Reply With Quote
Old 16th October 2019, 18:32   #4  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: Chamber 36
Posts: 5,855
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 19:05.
stax76 is offline   Reply With Quote
Old 16th October 2019, 18:58   #5  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,207
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 19:27.
StainlessS is offline   Reply With Quote
Old 16th October 2019, 19:10   #6  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: Chamber 36
Posts: 5,855
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 19:33.
stax76 is offline   Reply With Quote
Old 16th October 2019, 19:21   #7  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,207
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 21:52.
StainlessS is offline   Reply With Quote
Old 16th October 2019, 21:06   #8  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: Chamber 36
Posts: 5,855
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
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 10:29.


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