2013. április 2., kedd

Fotók rendezése EXIF információk alapján

Használat:

sudo apt-get install imagemagick
csop-exif-lite.sh /media/lemez/FOTOMAPPA/

#!/bin/bash
# Bash script to automatically sort photos into folders based on EXIF data for Ubuntu Linux - Lite version by GW (v2013-04-02)
# Original script source:
# http://mikebeach.org/2011/12/10/bash-script-to-automatically-sort-photos-into-folders-based-on-exif-data-for-ubuntu-linux/
# ----------------------------------------------------
# Warning! This script is just a PoC, use with care!
# ----------------------------------------------------

TARGETFOLDER="$1"
if [[ "$TARGETFOLDER" == "" ]]; then
    echo "Please specify the target (source) folder to sort."
    exit
fi

FILETYPES=("*.jpg" "*.jpeg" "*.png" "*.tif" "*.tiff" "*.gif" "*.xcf")

for x in "${FILETYPES[@]}"; do
 # Check for the presence of imagemagick and the identify command.
 # Assuming its valid and working if found.
 I=`which identify`
 if [ "$I" == "" ]; then
     echo "The 'identify' command is missing or not available."
    echo "Is imagemagick installed?"
    exit 1
 fi;

 echo "Scanning for $x..."
 # FIXME? Eliminate problems (if any) with unusual characters in filenames.

cd $1


result=`echo $1 | tail -c 2`
if [[ "$result" != "/" ]]
then
    echo "Trailing / (slash) required for path! Exiting."
    exit 1
fi


mkdir $1other
mkdir $1bin

 for file in `find $1 -maxdepth 1 -iname "$x"`; do
    #  echo "Item is: $file"
     
    identify -verbose $file | grep "exif:DateTime:" | awk -F\  '{print $2}' | sed s/:/-/g | { read mydate;
    if [[ $mydate == "" ]];
    then
        mv -i "$file" "$1other" ; echo "MOVE $file TO $1other " ;
    else
        mymonth=`echo "$mydate" | cut -c 1-7` ; echo "--- Month: $mymonth " ; mkdir $1$mymonth 2>/dev/null ;
        echo " DATE: $mydate MOVE ITEM: $file TO: $1$mymonth/$mydate ";
        mkdir "$1$mymonth/$mydate" 2>/dev/null ; mv -i "$file" "$1$mymonth/$mydate";

        if [[ $? -ne 0 ]];
            then mv -i "$file" "$1bin"; echo "MOVE $file TO $1bin " ;
        fi ;

    fi ; } 
      done
 echo "... end of $x"
done;

Convert MP4 videos to XVID AVI with avconv (ffmpeg)

MP4 videók XVID AVI formátumra konvertálása Linux terminálból:


avconv -y -i 'input.mp4' -threads auto \
-c:v mpeg4 -q:v 5 -vtag XVID -f avi -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300 \
-c:a libmp3lame -ac 2 -q:a 3 -ar 44100 \
"output.avi"

Ezek a csomagok is kellhetnek:

sudo apt-get install libavcodec53 
sudo apt-get install libmp3lame0
sudo apt-get install ubuntu-restricted-extras