8

bash script : is it possible to recognize video format from files (to batch extract audio from them)?

view full story
linux-howto

http://askubuntu.com – I have written a little bash script to extract audio from video files in batch mode. Sound is extracted from each mp4 file to flac format using avconv (and the flac codec). #!/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 It works fine, but I would like to improve it. The script only detects mp4 format. Is it possible to recognize a video file with a command (instead of testing each video format) ? Thank you for advices. (HowTos)