Advertisement
shiftdot515

ffi // mostly awk calls to parse ffmpeg

Sep 5th, 2021
1,471
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.70 KB | None | 0 0
  1. #! /bin/bash
  2. ffmpeg="$1"
  3. tmp=/tmp/ffi.$$
  4. $ffmpeg -i "$2" 2> $tmp
  5. vcodec=`awk '/^  Stream.*: Video:/ { sub(",","",$4); print $4; }' $tmp`
  6. acodec=`awk '/^  Stream.*: Audio:/ { sub(",","",$4); print $4; }' $tmp`
  7. duration=`awk '/^  Duration: / { sub(",","",$2); print $2; }' $tmp`
  8. bitrate=`awk '/^  Duration: / {  print $6; }' $tmp`
  9. size=`ls -l "$2" | awk '{print $5}'`
  10. echo $vcodec\|$acodec\|$duration\|$bitrate\|$size
  11. #rm $tmp
  12. # I've collected ffmpegs from packages
  13. # and why collect broken links? once theyr proven useful
  14. #:tmp>:ff
  15. #   ffi    ffmpeg    ffmpeg.d  ffmpeg.i  ffmpeg.s  ffmpeg.x  ffmpeg.x2
  16. #0:tmp>:ff
  17. #fi ffmpeg *.AVI                    
  18. #mjpeg|pcm_s16le|00:06:36.6|14863|737006768
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement