Changes of Revision 30

ffhevc.changes Changed
x
 
1
@@ -1,4 +1,13 @@
2
 -------------------------------------------------------------------
3
+Thu Jan 05 11:35:00 UTC 2017 - neutrino8@opensuse.org
4
+
5
+- Update to version 3.0.8
6
+  * Support per-file auto-cropping when running in batch mode
7
+  * Use internally full paths for input and output
8
+  * Add a test case for output directory to the script that gets
9
+    sourced for encoding
10
+
11
+-------------------------------------------------------------------
12
 Wed Jan 04 13:02:00 UTC 2017 - neutrino8@opensuse.org
13
 
14
 - Update to version 3.0.7
15
ffhevc.spec Changed
10
 
1
@@ -17,7 +17,7 @@
2
 
3
 
4
 Name:           ffhevc
5
-Version:        3.0.7
6
+Version:        3.0.8
7
 Release:        0
8
 Summary:        A small shell script for encoding to H.265/HEVC with ffmpeg
9
 License:        GPL-2.0+
10
ffhevc-3.0.7.tar.gz/ChangeLog -> ffhevc-3.0.8.tar.gz/ChangeLog Changed
11
 
1
@@ -1,3 +1,9 @@
2
+2017-01-05 - ffhevc 3.0.8
3
+   * Support per-file auto-cropping when running in batch mode
4
+   * Use internally full paths for input and output
5
+   * Add a test case for output directory to the script that gets
6
+     sourced for encoding
7
+   
8
 2017-01-04 - ffhevc 3.0.7
9
    * Use readlink to get the full path to the cover art image. Fixes
10
      an issue when running in batch mode
11
ffhevc-3.0.7.tar.gz/README -> ffhevc-3.0.8.tar.gz/README Changed
9
 
1
@@ -14,3 +14,7 @@
2
 
3
 Run 'ffhevc -h' in a console to see a list of supported parameters
4
 or read the man page (man ffhevc).
5
+
6
+Donations:
7
+
8
+PayPal address: neutrino8@gmail.com
9
ffhevc-3.0.7.tar.gz/ffhevc -> ffhevc-3.0.8.tar.gz/ffhevc Changed
168
 
1
@@ -2,8 +2,8 @@
2
 #
3
 # Small script to encode to H.265/HEVC video using FFmpeg and libx265.
4
 # Author: Grozdan "microchip" Nikolov <neutrino8@opensuse.org>
5
-# Version: 3.0.7
6
-# Date: 2017-01-04
7
+# Version: 3.0.8
8
+# Date: 2017-01-05
9
 #
10
 # ffhevc is free software ; you can redistribute it and/or modify
11
 # it under the terms of the GNU General Public License as published by
12
@@ -24,7 +24,7 @@
13
 brown() { echo -e "\e[0;33m$1\e[0;39;49m"; }
14
 error() { echo -e "\e[1;31m$1\e[0;39;49m"; }
15
 
16
-version="3.0.7"
17
+version="3.0.8"
18
 
19
 CFG="$HOME/.ffhevc"
20
 cfgversion="33"
21
@@ -414,15 +414,21 @@
22
    exit 1
23
 fi
24
 
25
+input="$(readlink -f "$input")"
26
+
27
 if [ ! -z "$batchmode" ]; then
28
    OUTPUT="$OUTDIR/$(basename $0)_$$"
29
    printf "Specify the Output Directory [default is $OUTPUT]: "
30
    read -e output
31
-   test -z "$output" && OUTPUT="$OUTPUT/\$i" || OUTPUT="$output/\$i"
32
-   mkdir -p "$(dirname "$OUTPUT")" 2>/dev/null
33
-   if [ $? != 0 ]; then
34
-       error "-> Could not create the output directory!"
35
-       exit 1
36
+   if [ -z "$output" ]; then
37
+       OUTPUT="$OUTPUT/\$i"
38
+   else
39
+       mkdir -p "$(dirname "$output/\$i")" 2>/dev/null
40
+       if [ $? != 0 ]; then
41
+           error "-> Could not create the output directory!"
42
+           exit 1
43
+       fi
44
+       OUTPUT="$(readlink -f "$output/\$i")"
45
    fi
46
 else
47
    printf "Specify a Name for the Output: "
48
@@ -437,7 +443,7 @@
49
            error "-> Could not create the output directory!"
50
            exit 1
51
        fi
52
-       OUTPUT="$output"
53
+       OUTPUT="$(readlink -f "$output")"
54
    else
55
        OUTPUT="$OUTDIR/$output"
56
    fi
57
@@ -838,35 +844,45 @@
58
 # Used by cropping and bitrate
59
 # calc for target file size
60
 video_length_func() {
61
-   VLENGTH="$($FFPROBE -i "$input" -v error -select_streams v:0 -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 | awk -F. '{print $1}')"
62
+   case "$1" in
63
+       file)   VLENGTH="$($FFPROBE -i "$input" -v error -select_streams v:0 -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 | awk -F. '{print $1}')" ;;
64
+       batch)  echo "VLENGTH=\"\$($FFPROBE -i \"\$i\" -v error -select_streams v:0 -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 | awk -F. '{print \$1}')\"" ;;
65
+   esac
66
 }
67
 
68
 if [ "$AUTOCROP" = "y" ]; then
69
-   echo
70
-   green "-> Detecting crop values..."
71
-   video_length_func
72
-   if [ -z "$VLENGTH" -o "$VLENGTH" = "N/A" ]; then
73
-       vlength="300"
74
-   else
75
-       vlength="$VLENGTH"
76
-   fi
77
-   CROPVAL="$($FFMPEG -ss $(($vlength/2)) -i "$input" -map 0:0 -vf cropdetect=24:4 -frames:v 1000 -f null - 2>&1 | awk '/crop/ {print $NF}' | awk -F= '{print $2}' | tail -1)"
78
-   if [ ! -z "$CROPVAL" ]; then
79
-       green "-> Found crop values: $CROPVAL"
80
+   if [ ! -z "$batchmode" ]; then
81
+       printf "Auto-Crop the Input Files? [y/N]: "
82
+       read autocrop
83
+       CROPVAL="\$($FFMPEG -ss \$((\$VLENGTH/2)) -i \"\$i\" -map 0:0 -vf cropdetect=24:4 -frames:v 1000 -f null - 2>&1 | awk '/crop/ {print \$NF}' | awk -F= '{print \$2}' | tail -1)"
84
+       crop="crop=\$CROPVAL,"
85
    else
86
-       error "-> Could not find the crop values!"
87
-       CDEF="???"
88
-   fi
89
-   echo
90
-   printf "Specify the Crop Values [default is $CROPVAL$CDEF]: "
91
-   read cropval
92
-   if [ ! -z "$CDEF" -a -z "$cropval" ]; then
93
        echo
94
-       error "-> No crop values provided!"
95
-       error "-> Skipping!"
96
+       green "-> Detecting crop values..."
97
+       video_length_func file
98
+       if [ -z "$VLENGTH" -o "$VLENGTH" = "N/A" ]; then
99
+           vlength="300"
100
+       else
101
+           vlength="$VLENGTH"
102
+       fi
103
+       CROPVAL="$($FFMPEG -ss $(($vlength/2)) -i "$input" -map 0:0 -vf cropdetect=24:4 -frames:v 1000 -f null - 2>&1 | awk '/crop/ {print $NF}' | awk -F= '{print $2}' | tail -1)"
104
+       if [ ! -z "$CROPVAL" ]; then
105
+           green "-> Found crop values: $CROPVAL"
106
+       else
107
+           error "-> Could not find the crop values!"
108
+           CDEF="???"
109
+       fi
110
        echo
111
-   else
112
-       test -z "$cropval" && crop="crop=$CROPVAL," || crop="crop=$cropval,"
113
+       printf "Specify the Crop Values [default is $CROPVAL$CDEF]: "
114
+       read cropval
115
+       if [ ! -z "$CDEF" -a -z "$cropval" ]; then
116
+           echo
117
+           error "-> No crop values provided!"
118
+           error "-> Skipping!"
119
+           echo
120
+       else
121
+           test -z "$cropval" && crop="crop=$CROPVAL," || crop="crop=$cropval,"
122
+       fi
123
    fi
124
 else
125
    printf "Specify the Crop Values [press 'Enter' to skip]: "
126
@@ -1863,7 +1879,7 @@
127
            printf "Specify the Target File Size in MiB [default is 5120]: "
128
            read tsize
129
            test -z "$tsize" && target="5120" || target="$tsize"
130
-           video_length_func
131
+           video_length_func file
132
            if [ -z "$VLENGTH" -o "$VLENGTH" = "N/A" ]; then
133
                echo
134
                error "-> Could not detect the video length!"
135
@@ -1994,17 +2010,30 @@
136
 
137
 echo "#!/usr/bin/env bash" > "$OUTFILE"
138
 echo "" >> "$OUTFILE"
139
+echo "green() { echo -e \"\e[1;32m\$1\e[0;39;49m\"; }" >> "$OUTFILE"
140
+echo "red() { echo -e \"\e[1;31m\$1\e[0;39;49m\"; }" >> "$OUTFILE"
141
+echo "" >> "$OUTFILE"
142
+echo "test ! -d \"\$(dirname \"$OUTFILE\")\" && mkdir -p \"\$(dirname \"$OUTFILE\")\"" >> "$OUTFILE"
143
+echo "" >> "$OUTFILE"
144
 if [ ! -z "$batchmode" ]; then
145
    echo "$CHDIR" >> "$OUTFILE"
146
    echo "" >> "$OUTFILE"
147
    echo "$FORLOOP_START" >> "$OUTFILE"
148
    echo "$CHKFILE_START" >> "$OUTFILE"
149
+   if [ "$autocrop" = "y" -o "$autocrop" = "Y" ]; then
150
+       echo "" >> "$OUTFILE"
151
+       echo "echo" >> "$OUTFILE"
152
+       echo "green \"-> Detecting crop values for '\$(basename \"\$i\")'...\"" >> "$OUTFILE"
153
+       echo "echo" >> "$OUTFILE"
154
+       echo "" >> "$OUTFILE"
155
+       video_length_func batch >> "$OUTFILE"
156
+       echo "CROPVAL=\"$CROPVAL\"" >> "$OUTFILE"
157
+       echo "" >> "$OUTFILE"
158
+   fi
159
 fi
160
 encoder_func $encmode >> "$OUTFILE"
161
 echo "" >> "$OUTFILE"
162
 if [ ! -z "$remuxcon" ]; then
163
-   echo "green() { echo -e \"\e[1;32m\$1\e[0;39;49m\"; }" >> "$OUTFILE"
164
-   echo "red() { echo -e \"\e[1;31m\$1\e[0;39;49m\"; }" >> "$OUTFILE"
165
    for i in $remuxcon; do
166
        echo "" >> "$OUTFILE"
167
        echo "echo" >> "$OUTFILE"
168