I've been digging through the mplayer/mencoder and ffmpeg documentation and I can't seem to come up with anything. I'm not especially picky as to the output format as I can use a regular expression to pull it out, I just can't seem to get the data in the first place.
相关问题
- Is shmid returned by shmget() unique across proces
- how to get running process information in java?
- How to create PNG images with more than 72dpi usin
- Error building gcc 4.8.3 from source: libstdc++.so
- Why should we check WIFEXITED after wait in order
To return only the Width and Height mediainfo is an excellent tool.
mediainfo --Inform="Video;%Width%" Videofile && mediainfo --Inform="Video;%Height%" Videofile will do exactly that, no more, no less, for a vast array of supported video files.
There is a long list of useful
Inform=
parameters which you can obtain with the commandmediainfo --Info-Parameters
If you want the output in standard WidthXHeight format use
Width=$(mediainfo --Inform="Video;%Width%" Video.File)&& Height=$(mediainfo --Inform="Video;%Height%" Video.File)&&echo $Width"X"$Height
There's a bash script here that you could easily modify to meet your needs.
Sources:
Adding an Overlay Using FFMPEG With Minimal Re-Encoding
http://manpages.ubuntu.com/manpages/xenial/man1/mediainfo.1.html
whiptail: How to redirect output to environment variable?
How to concatenate string variables in Bash
Use
ffprobe
:Example output:
See FFprobe Documentation and FFmpeg Wiki: FFprobe Tips for more info.
If you are just interested in the resolution:
It works also on Windows. This is running right now on my PC to build an index of all files: