You are not logged in.

#1 2018-01-22 17:10:37

john-soda
Member
Registered: 2017-05-20
Posts: 14

[SOLVED] - Mediainfo: specified template file is ignored

I try to use mediainfo CLi.
I'm not able to use the template feature.
The usual command is:

 mediainfo --Output=[xxx;]Text FileName.mp4

The command for using a template is:

mediainfo --Output=file://$HOME/.config/mediainfo/template.txt *.mkv

But it never uses the template.

I realized that when I use mediainfo without a template,  I always have to use quotation marks for the output option,

mediainfo --Output="Video;%Duration%" *.mp4

otherwise it does not work. But in the help docs and in every forum they use no quotation marks for the output options.

If I try to call the template, mediainfo reacts like there is no output option at all, it doesn't matter if I use quotation marks or not.

Now I suspect that the Output Option are somehow misinterpreted and therefore the template is not called.

I don't know what to do?

John

Last edited by john-soda (2018-01-23 14:00:59)

Offline

#2 2018-01-22 22:12:47

ayekat
Member
Registered: 2011-01-17
Posts: 1,634

Re: [SOLVED] - Mediainfo: specified template file is ignored

If you didn't put the quotes there, it would be interpreted by the shell (not Konsole¹) as follows:

mediainfo --Output=Video
%Duration% *.mp4

That is because the shell treats the semicolon (;) as a command separator (you can put multiple commands on the same line separated by semicolons).

I don't know what the first command on its own does, but probably not what you expect it to do. And for the second command, the leading % has a special meaning as well, and the shell will try to do some background job handling with it (and fail).

Unfortunately, I don't know mediainfo or what you mean exactly with "templates" (and you haven't put any links to "every forum" or the "help docs"), but if I read the following description right,

mediainfo --Output=[xxx;]Text FileName.mp4

then it takes exactly one .mp4 file as argument, whereas you specify potentially multiple (or zero) files with your wildcard *.mp4 (and I don't know what effect that has). Maybe try narrowing down your issue by executing the command with a single file .mp4 file.

_____
¹ Konsole is a terminal emulator, i.e. a program that imitates a text terminal, providing a user interface to the text-based applications running inside. One of those applications is the shell, a command line interpreter where you execute commands.


pkgs │ hacks │ cfg │ blag

Offline

#3 2018-01-23 11:40:46

john-soda
Member
Registered: 2017-05-20
Posts: 14

Re: [SOLVED] - Mediainfo: specified template file is ignored

ayekat wrote:

If you didn't put the quotes there, it would be interpreted by the shell (not Konsole¹) as follows:

mediainfo --Output=Video
%Duration% *.mp4

That is because the shell treats the semicolon (;) as a command separator (you can put multiple commands on the same line separated by semicolons).

I thought the shell interprets everything after

 -- 

as an Option and everything after

--Option=

as the argument of the option until a blank follows.
But, thank you very much for explaining it to me!

ayekat wrote:

I don't know what the first command on its own does, but probably not what you expect it to do. And for the second command, the leading % has a special meaning as well, and the shell will try to do some background job handling with it (and fail).

Unfortunately, I don't know mediainfo or what you mean exactly with "templates"

A template means, a file where all output arguments  are listed and their formatting.

ayekat wrote:

(and you haven't put any links to "every forum" or the "help docs"), but if I read the following description right,

with help docs I meant

 mediainfo -h

and

mediainfo --Help-Output

With forum I meant Mediainfo Sourceforge Discussion  and Stackoverflow

ayekat wrote:
mediainfo --Output=[xxx;]Text FileName.mp4

then it takes exactly one .mp4 file as argument, whereas you specify potentially multiple (or zero) files with your wildcard *.mp4 (and I don't know what effect that has). Maybe try narrowing down your issue by executing the command with a single file .mp4 file.

I tried it before with only one specific file without wildcards.

ayekat wrote:

_____
¹ Konsole is a terminal emulator, i.e. a program that imitates a text terminal, providing a user interface to the text-based applications running inside. One of those applications is the shell, a command line interpreter where you execute commands.

Offline

#4 2018-01-23 12:47:41

ayekat
Member
Registered: 2011-01-17
Posts: 1,634

Re: [SOLVED] - Mediainfo: specified template file is ignored

OK, I guess I can see more or less how it works.
So now your issue is that if you specify a template file, it is ignored?

Could you please post the command you run? (also, check that the template file actually exists and the path is correct)


pkgs │ hacks │ cfg │ blag

Offline

#5 2018-01-23 13:43:15

john-soda
Member
Registered: 2017-05-20
Posts: 14

Re: [SOLVED] - Mediainfo: specified template file is ignored

ayekat wrote:

OK, I guess I can see more or less how it works.
So now your issue is that if you specify a template file, it is ignored?

Correct!

ayekat wrote:

Could you please post the command you run? (also, check that the template file actually exists and the path is correct)

mediainfo --Output="file://home/john-soda/try1.txt" *.mp4
mediainfo --Output=file://home/john-soda/try1.txt *.mp4

Tried both.
File exists. Path is correct. Permissions are 777.

the content of try1.txt is the code from this post
Developer himself


Thanks very much for your help!

Last edited by john-soda (2018-01-23 13:52:03)

Offline

#6 2018-01-23 13:58:11

john-soda
Member
Registered: 2017-05-20
Posts: 14

Re: [SOLVED] - Mediainfo: specified template file is ignored

OK problem solved. I have to add a third /.

It works with following command

mediainfo --Output=file:///home/john-soda/try1.txt *.mp4

Thanks very much for your help!!!

Where can I learn more about the shell syntax? Do you have a link for me maybe?

Last edited by john-soda (2018-01-23 14:03:26)

Offline

#7 2018-01-23 14:13:50

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,525
Website

Re: [SOLVED] - Mediainfo: specified template file is ignored

If you actually used $HOME as you indicated in your previous posts, it would have the third slash (as $HOME starts with a slash).

This is why we expect that, in support threads, you post your complete command and output.

As to learning about your shell, google.  But for bash, this is probably the best you could find:
http://mywiki.wooledge.org/BashGuide


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB