title: bash script : test for video files failed
body: <p>I have written a little bash script to extract audio from video files in batch mode. </p>
  
  <p>Sound is extracted from each mp4 file to flac format using avconv (and the flac codec).</p>
  
  <pre><code>#!/bin/sh
  #
  # Batch conversion of audio extraction from video
  
  FOLDER_SRC="/home/Me/Music/TestBatchConv"
  
  for myvid in $(find ${FOLDER_SRC} | grep mp4)
  do
  avconv -i $myvid -acodec flac "${myvid}.flac"
  done
  
  exit 0
  </code></pre>
  
  <p>It works fine, but I would like to improve it.</p>
  
  <p>How do I test if the file is a video ?
  I tried something like</p>
  
  <pre><code>for myvid in $(find ${FOLDER_SRC})
  do
      if [ file -i $myvid | grep video ]
          then avconv -i $myvid -acodec flac "${myvid}.flac"
      fi
  done
  </code></pre>
  
  <p>but i cant get it done (yes i am new to this).</p>
  
  <p>Any help appreciated.</p>