• 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
    

      

  • 相关阅读:
    CentOS 6.3 从0开始配置防火墙规则
    ppt删除所有墨迹注释
    生日、毕业与大学的回忆
    20171201-构建之法:现代软件工程-阅读笔记
    软件工程课程总结
    课后作业-阅读任务-阅读提问-4
    Forward团队-爬虫豆瓣top250项目-项目总结
    Forward团队-爬虫豆瓣top250项目-最终程序
    课后作业-阅读任务-阅读提问-3
    20171117-构建之法:现代软件工程-阅读笔记
  • 原文地址:https://www.cnblogs.com/morganh/p/9100835.html
Copyright © 2020-2023  润新知