[FFmpeg-user] Making conditional statements with FFMPEG

Jim Shupert jshupert at pps-inc.com
Thu Apr 30 15:30:19 CEST 2015



On 4/30/2015 8:22 AM, Chris Zecco wrote:
> Thanks Moritz,
>
> Would I enter this right into my command prompt, or would I create a separate file to run this statement from? I keep getting an error saying "File unexpected at this time". Apologies for any ignorance. I am new to using the command window, though I do have coding experience in php and java (though I am not sure that will help here). Thanks!
You might find it beneficial to have 1 dir in your home dir that you 
keep scripts
and add something like this

SrcDir=/media/BlahBlahpathtoVideoSourceFiles
cd $SrcDir

it will then "do" all in the dir BlahBlahpathtoVideoSourceFiles
>
> ---snip---
> #!/bin/sh
SrcDir=/media/BlahBlahpathtoVideoSourceFiles
cd $SrcDir
>
> for file in *; do
>    SIZE=`stat -c %s "$file"`
>    if [ $SIZE -gt 209715200 ]; then # > 200 MiB
>      COMPRESSION_V="-b:v 1500k"
>    elif [ $SIZE -ge 104857600 ]; then # >= 100 MiB
>      COMPRESSION_V="-b:v 1100k"
>    else # < 100 MiB
>      COMPRESSION_V="-b:v 555k"
>    fi
>
>    ffmpeg -i "$file" $COMPRESSION_V -b:a 128k "$file".new.extensio
> done
> ---snip---
>



More information about the ffmpeg-user mailing list