Skip to content

Instantly share code, notes, and snippets.

@luxedo
Created May 15, 2019 17:08
Show Gist options
  • Save luxedo/81e092a9e0819ac424812543c4c19ceb to your computer and use it in GitHub Desktop.
Save luxedo/81e092a9e0819ac424812543c4c19ceb to your computer and use it in GitHub Desktop.
Outputs the maximum resolution of `/dev/video0`
v4l2-ctl -d /dev/video0 --list-formats-ext | grep Size | sed 's/.*[^0-9]\([0-9]\+x[0-9]\+\)[^0-9]\?.*/\1/' | sort | uniq |python3 -c "import fileinput;res = [line.split('x') for line in fileinput.input()];res = [(int(r[0]), int(r[1]), int(r[0])*int(r[1])) for r in res];res=sorted(res, key=lambda x: -x[2]);print(res[0][0:2])"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment