Python 2.7 mediainfo --inform outputs full info rather than one string

Tandy Freeman

Using the following in powershell produces the expected output of 01:22:02:03:

 MediaInfo --Language=raw --Full --Inform="Video;%Duration/String4%" filename

My following python 2.7 script always gives the full mediainfo output with every piece of metadata, not just the Duration String that I specified.. I've tried escaping the semi colons but it has no effect. What am I doing wrong?

import sys
import subprocess
filename = sys.argv[1]
test = subprocess.check_output(['MediaInfo', '--Language=raw', '--Full', '--inform="Video;%Duration/String4%"', filename])
print test
bbayles

Lose the double-quotes in the --Inform argument. I can reproduce your problem with this code:

import subprocess

args =  [
    'mediainfo',
    '--Language=raw',
    '--Full',
    '--inform="Video;%Duration/String4%"',
    'tests/reference.mp4'
]

bad_output = subprocess.check_output(args)
line_count_bad = len(bad_output.splitlines())

args[3] = args[3].replace('"', '')

good_output = subprocess.check_output(args)
line_count_good = len(good_output.splitlines())

print(line_count_bad, line_count_good, sep='\t')
print(good_output)

The output is:

204 1
b'00:00:07:08\n'

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Python 2.7 mediainfo --inform outputs full info rather than one string

From Dev

Getting String info from another java class rather than the same one

From Dev

Splitting an array remains as array of one item rather than a string

From Dev

Make 'interact' use IPython console, rather than standard Python one?

From Dev

Python: How to demand a string as input rather than a specific value

From Dev

How to show full results, rather than matched text from regex searches in python

From Dev

Rails active admin csv outputs all results rather than selected

From Dev

Rails active admin csv outputs all results rather than selected

From Dev

How to update in one line rather than multiple?

From Dev

using a for loop rather than a large if statement to append info via jQuery

From Dev

Angular2 Animations: Toggle State Triggers on Every *ngFor Rather Than The One Clicked

From Dev

One string, two rawurlencode outputs

From Dev

Use local copy of python package rather than the one installed in site-packages

From Dev

Why does Python recognise this UTF-8 character as two characters rather than one

From Dev

How to link python to the manually compiled OpenSSL rather than the system's one

From Dev

How do I get python to search text for one word in a list rather than all the words in a list?

From Dev

Python: How to unpack dictionary keys as separate items rather than one item

From Dev

Validating a string rather than character set

From Dev

freemarker display ${..} as html rather than string

From Dev

Use sed on a string variable rather than a file

From Dev

Evaluate value of observable as a variable rather than a string

From Dev

param identified as a string rather than a file

From Dev

how to capture a video in specific part rather than full screen in iOS

From Dev

How to read buffered data as it arrives rather than when the buffer is full?

From Dev

Display the full country name rather than country code in WooCommerce?

From Dev

split() in python3 not returning value as expected(spliting the whole string character wise rather than space wise)

From Dev

Multiply by 0.5 rather than divide by 2

From Dev

In the regularization,why we use θ^2 rather than θ?

From Dev

Why is one date string bigger than than the other in Python?

Related Related

  1. 1

    Python 2.7 mediainfo --inform outputs full info rather than one string

  2. 2

    Getting String info from another java class rather than the same one

  3. 3

    Splitting an array remains as array of one item rather than a string

  4. 4

    Make 'interact' use IPython console, rather than standard Python one?

  5. 5

    Python: How to demand a string as input rather than a specific value

  6. 6

    How to show full results, rather than matched text from regex searches in python

  7. 7

    Rails active admin csv outputs all results rather than selected

  8. 8

    Rails active admin csv outputs all results rather than selected

  9. 9

    How to update in one line rather than multiple?

  10. 10

    using a for loop rather than a large if statement to append info via jQuery

  11. 11

    Angular2 Animations: Toggle State Triggers on Every *ngFor Rather Than The One Clicked

  12. 12

    One string, two rawurlencode outputs

  13. 13

    Use local copy of python package rather than the one installed in site-packages

  14. 14

    Why does Python recognise this UTF-8 character as two characters rather than one

  15. 15

    How to link python to the manually compiled OpenSSL rather than the system's one

  16. 16

    How do I get python to search text for one word in a list rather than all the words in a list?

  17. 17

    Python: How to unpack dictionary keys as separate items rather than one item

  18. 18

    Validating a string rather than character set

  19. 19

    freemarker display ${..} as html rather than string

  20. 20

    Use sed on a string variable rather than a file

  21. 21

    Evaluate value of observable as a variable rather than a string

  22. 22

    param identified as a string rather than a file

  23. 23

    how to capture a video in specific part rather than full screen in iOS

  24. 24

    How to read buffered data as it arrives rather than when the buffer is full?

  25. 25

    Display the full country name rather than country code in WooCommerce?

  26. 26

    split() in python3 not returning value as expected(spliting the whole string character wise rather than space wise)

  27. 27

    Multiply by 0.5 rather than divide by 2

  28. 28

    In the regularization,why we use θ^2 rather than θ?

  29. 29

    Why is one date string bigger than than the other in Python?

HotTag

Archive