I already script that a several time and I think it's will be a good time to take a note and save a bit my mind for the next time !
When we use ffmpeg in some complex script in which we pipe decoded frame into another process i.e an encoder, it's really useful to get all input video and audio info. But from the ffmpeg -i output there is several regular expression that you can use:
- Extract widthxheigth:
- Extract frame-rate:
- Split RESINFO into Width and Heigth
HEIGHT=`echo $RESINFO | grep -oP '\K[0-9]+$'`
Feel free to comment and add request/proposal if you think that there is a better/other way to do it !