Easily Detect Video ColorSpace with ffmpeg and Python on Ubuntu

import pexpect, sysdef get_colorspace(path):
re_PS1 = 'bash-[.0-9]+[$#] $'
proc = pexpect.spawn('bash --norc')
if len(sys.argv) != 1:
proc.logfile_read = sys.stdout
proc.expect(re_PS1)
proc.sendline("ffmpeg -i " + path)
proc.expect(re_PS1)
#print(proc.before) # print ffmpeg output
if "709" in str(proc.before):
return "709"
elif "2020" in str(proc.before):
return "2020"
else:
return "unknown"
proc.sendline('exit')
proc.expect(pexpect.EOF)
proc.close()

--

--

--

XR Developer at HookBang | https://github.com/sitting-duck

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Redshift : Enhance performance by choosing right distribution keys

Interesting Trends have seen on Stack Overflow Survey 2019

What makes Laravel the fastest development framework?

Service Mesh : Istio and Kiali Setup

𝗪𝗵𝘆 𝗱𝗶𝗴𝗶𝘁𝗮𝗹 𝗺𝗮𝗻𝘂𝗳𝗮𝗰𝘁𝘂𝗿𝗶𝗻𝗴 𝗮𝗹𝗹𝗼𝘄𝘀 𝘆𝗼𝘂 𝘁𝗼 𝗰𝗿𝗲𝗮𝘁𝗲 𝗺𝗼𝗿𝗲…

Day 05: Back to blocks and going to space

osome7 customer care number/8584892730//8584892730/osome7 customer care…

6 small things that let you become a better Flutter developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ashley Tharp

Ashley Tharp

XR Developer at HookBang | https://github.com/sitting-duck

More from Medium

Install Miniconda (Conda) and Python

Write a Python program using Anaconda Prompt or terminal

Set up python environment (with TensorFlow) on M1 Mac

How to install pyenv+pipenv in ubuntu and use multiple versions of python and its suites