zoukankan      html  css  js  c++  java
  • 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
    

      

  • 相关阅读:
    华为P20 无法投屏到电视
    configuration error – unknown item ‘umask’ (notify administrator)
    oracle不支持update from的语法
    SQL Server 中update的小计
    sqlplus连接oracle数据库--密码含特殊字符
    redhat 7.6安装oracle 11gR2遇到两个问题
    ORA-15032 ORA-15028
    ORA-07391 sftopen error unable to open text file
    ORA-01017 invalid username/password logon denied
    Oracle CRS/GI 进程介绍
  • 原文地址:https://www.cnblogs.com/morganh/p/9100835.html
Copyright © 2011-2022 走看看