~scriptsnginx
7 itemsDownload ./*

7 itemsDownload ./*

..
ana-stream-gst-rtmp-rtp-wpe.gensh
ana-stream-gst-rtmp-rtp.gensh
ana-stream-gst-srt-rtp.gensh
killrtmppush.sh
makethumb.sh
nginx.conf
pushrtmprtp.sh


nginxmakethumb.sh
41•  1 month ago•  DownloadRawClose
1 month ago•  41

{}
#/bin/bash
#ffmpeg -y -i "/tmp/rec/"$1".flv" -s 180x140 -vframes 1 $ANAWEB/img/ipcam/thumb.jpg


#timestamp=$(date +%s)

NAME="$1"

search_dir="/mnt/rec"
lastfile=""

ANAWEB="/home/amalie/analiestar.com"

###for entry in "$search_dir"/*
###do
###    ###rsync -u "$entry" "$ANAWEB/_files/ipcam/temp"
###
###    lastfile="$entry"
###done
#for entry in "$search_dir"/*; do; lastfile=$entry; done

#search_dir=/mnt/rec; for entry in "$search_dir"/*; do; $lastfile=$entry; done

DNAME="AnaGame"
DCOLOR="e0326d"
LINE=""

# rtc is just output directory for web stuff like images served
# set GENSH below to your active pipeline script for rtmp gstreamer
# to copy composition and apply same effect with ffmpeg snapshot

#if [ -f "$ANAWEB/rtc/anagamedata.log" ]; then
#    GDAT=$( cat "$ANAWEB/rtc/anagamedata.log" )
#
#    DNAME=$( echo "$GDAT" | jq -r '.name' )
#    DCOLOR=$( echo "$GDAT" | jq -r '.color' )
#    LINE=$( echo "$GDAT" | jq -r '.line' )
#    ACTIVE=$( echo "$GDAT" | jq -r '.active' )
#fi

TNOW=$( date '+%s' )
DIFF=$(( $TNOW-$ACTIVE ))

if [ "$NAME" = "game$LINE" ] && [ $DIFF -lt 60 ]; then
    lastfile="$search_dir/$NAME.flv"
    
    GENSH=$( cat "$ANAWEB/rtc/gstreamer-rtmp-rtp-mp4-reenc-game.gensh" )
    GAMMA=$( echo -n "$GENSH" | grep "gamma" | head -1 | sed 's/    ! gamma //' | cut -d' ' -f1 )
    SATURATION=$( echo -n "$GENSH" | grep "videobalance" | head -1 | sed 's/    ! videobalance //' | cut -d' ' -f1 )
    HUE=$( echo -n "$GENSH" | grep "videobalance" | head -1 | sed 's/    ! videobalance //' | cut -d' ' -f2 )
    CONTRAST=$( echo -n "$GENSH" | grep "videobalance" | head -1 | sed 's/    ! videobalance //' | cut -d' ' -f3 )
    BRIGHTNESS=$( echo -n "$GENSH" | grep "videobalance" | head -1 | sed 's/    ! videobalance //' | cut -d' ' -f4 )
    
    HUE=$( echo "$HUE" | cut -d= -f2 )
    echo "..$HUE*180.."
    NHUE=$( echo "$HUE*180" | bc -l | cut -d. -f1 )
    NHUE=$( echo "$NHUE*-1" | bc )
    echo "..$NHUE.."
    
    FILTER="eq=$GAMMA:$SATURATION:$CONTRAST:$BRIGHTNESS,hue=h=$NHUE:s=1"
    #:$BRIGHTNES S$HUE:

    # hue = -1 <> 1 = -180 <> 180
    # -0.50*180=
    #  0.50*180=
    
    ffmpeg -y -sseof -3 -i "$lastfile" -vf "$FILTER" -s 850x480 -update 1 -q:v 1 "$ANAWEB/rtc/imgs/"$DNAME"_"$DCOLOR"_full.jpg"
    
    cp "$ANAWEB/rtc/imgs/"$DNAME"_"$DCOLOR"_full.jpg" "$ANAWEB/img/anacam_snapshot.jpg"
    
    convert "$ANAWEB/rtc/imgs/"$DNAME"_"$DCOLOR"_full.jpg" -channel RGB -blur 2x2 "$ANAWEB/rtc/imgs/"$DNAME"_"$DCOLOR"_blur.jpg"
    #ffmpeg -y -sseof -3 -i "$lastfile" -s 840x480 -update 1 -q:v 1 "$ANAWEB/img/ipcam/thumb.jpg"
    
    convert -verbose "$ANAWEB/rtc/rtoverlay.png" \( +clone -alpha extract -write mpr:alpha +delete \) \( "$ANAWEB/rtc/imgs/"$DNAME"_"$DCOLOR"_blur.jpg" -alpha off -resize 420x237 \) -compose mathematics -define compose:args="1,0,0,.5" -composite mpr:alpha -alpha off -compose copy_opacity -composite "$ANAWEB/rtc/imgs/"$DNAME"_"$DCOLOR"_text.jpg"
    
    # copy last record?
    cp "$lastfile" "$ANAWEB/rtc/tmp/"
    
#    TNOW=$(date '+%s')
#    
#    echo "$lastfile\v""$DNAME""\v""$DCOLOR""\v$TNOW" > "$ANAWEB/rtc/lastgamerec.log"
#    
#    #mv "/mnt/rec/$1.flv" "$ANAWEB/_files/ipcam/temp/$1_$timestamp.flv"

else

    echo "not active broadcast skipping thumb"

fi

exit

Top
©twily.info 2013 - 2024
twily at twily dot info



2 158 917 visits
... ^ v