• ffprobe dump info (width x height) calculate the average awk 使用shell变量


    $ ./ffprobe -i 16228144511_5BGT526.jpg
    ffprobe version 3.4.2-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2007-2018 the FFmpeg developers
    built with gcc 6.3.0 (Debian 6.3.0-18) 20170516
    configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
    libavutil 55. 78.100 / 55. 78.100
    libavcodec 57.107.100 / 57.107.100
    libavformat 57. 83.100 / 57. 83.100
    libavdevice 57. 10.100 / 57. 10.100
    libavfilter 6.107.100 / 6.107.100
    libswscale 4. 8.100 / 4. 8.100
    libswresample 2. 9.100 / 2. 9.100
    libpostproc 54. 7.100 / 54. 7.100
    Input #0, image2, from '16228144511_5BGT526.jpg':
    Duration: 00:00:00.04, start: 0.000000, bitrate: 532 kb/s
    Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 92x46 [SAR 1:1 DAR 2:1], 25 tbr, 25 tbn, 25 tbc

    $ ./ffprobe -i 16228144511_5BGT526.jpg 2>&1 |grep SAR |cut -d "x" -f 1 |cut -d "," -f 4 |cut -d "  " -f 2

    92

    $ ./ffprobe -i 16228144511_5BGT526.jpg 2>&1 |grep SAR |cut -d "x" -f 2 |cut -d "  " -f 1
    46

    $ cat ffprobe_height.sh
    #!/bin/sh
    jpgs=`ls ./51k_data/*.jpg`
    for eachfile in $jpgs
    do
    ./ffprobe -i $eachfile 2>&1 |grep SAR |cut -d "x" -f 2 |cut -d " " -f 1
    done

    $ cat ffprobe_width.sh
    #!/bin/sh
    jpgs=`ls ./51k_data/*.jpg`
    for eachfile in $jpgs
    do
    ./ffprobe -i $eachfile 2>&1 |grep SAR |cut -d "x" -f 1 |cut -d "," -f 4 |cut -d " " -f 2
    done

    $ cat ffprobe_calculate.sh

    #!/bin/sh
     ./ffprobe_width.sh > width.txt
     ./ffprobe_height.sh > height.txt
    
     width=`cat width.txt |wc -l`
     height=`cat height.txt |wc -l`
    
     awk -v n1=$width 'BEGIN{sum1=0}{sum1+=$1}END{print sum1/n1}' width.txt
     awk -v n2=$height 'BEGIN{sum2=0}{sum2+=$1}END{print sum2/n2}' height.txt
    

      

  • 相关阅读:
    vue之v-on
    垂直居中下
    垂直居中上
    vue之v-for
    vue之v-if和v-show
    vue之v-model
    vue之v-bind
    数学---目录
    【数学】证明题
    【计算机网络】应用层
  • 原文地址:https://www.cnblogs.com/morganh/p/9100835.html
Copyright © 2020-2023  润新知