Changes of Revision 169

ffhevc.changes Changed
x
 
1
@@ -1,4 +1,20 @@
2
 -------------------------------------------------------------------
3
+Sat Oct 26 07:05:00 UTC 2019 - neutrino8@opensuse.org
4
+
5
+- Update to version 3.9.9
6
+* Renamed audio variable aid[i] to aidx[i] and moved it outside
7
+  of the if conditional that decides the audio codec. This
8
+  removes the same code in three places and now uses the
9
+  global aidx[i] variable
10
+* HE-AACv2 only supports 2 channels. Update the audio code
11
+  to reflect that
12
+* When running in batch mode, add a warning about automatic
13
+  audio metadata and offer an option to enable/disable it
14
+* Added -tmp option to MP4Box to store temp files in the
15
+  output directory
16
+* Some minor improvements to the audio options
17
+
18
+-------------------------------------------------------------------
19
 Fri Oct 25 05:31:00 UTC 2019 - neutrino8@opensuse.org
20
 
21
 - Update to version 3.9.8
22
ffhevc.spec Changed
10
 
1
@@ -17,7 +17,7 @@
2
 
3
 
4
 Name:           ffhevc
5
-Version:        3.9.8
6
+Version:        3.9.9
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.9.8.tar.gz/ChangeLog -> ffhevc-3.9.9.tar.gz/ChangeLog Changed
18
 
1
@@ -1,3 +1,16 @@
2
+2019-10-26 - ffhevc 3.9.9
3
+   * Renamed audio variable aid[i] to aidx[i] and moved it outside
4
+     of the if conditional that decides the audio codec. This
5
+     removes the same code in three places and now uses the
6
+     global aidx[i] variable
7
+   * HE-AACv2 only supports 2 channels. Update the audio code
8
+     to reflect that
9
+   * When running in batch mode, add a warning about automatic
10
+     audio metadata and offer an option to enable/disable it
11
+   * Added -tmp option to MP4Box to store temp files in the
12
+     output directory
13
+   * Some minor improvements to the audio options
14
+
15
 2019-10-25 - ffhevc 3.9.8
16
    * Removed M4V from the case statements for cover art.
17
      I confused it with ffx264 which supports M4V while
18
ffhevc-3.9.8.tar.gz/ffhevc -> ffhevc-3.9.9.tar.gz/ffhevc Changed
299
 
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.9.8
6
-# Date: 2019-10-25
7
+# Version: 3.9.9
8
+# Date: 2019-10-26
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.9.8"
17
+version="3.9.9"
18
 
19
 CFG="$HOME/.ffhevc"
20
 cfgversion="50"
21
@@ -2434,15 +2434,40 @@
22
    # support
23
    strict="-strict -2"
24
    
25
+   if [ ! -z "$batchmode" ]; then
26
+       echo
27
+       error "-> Due to current codebase limitations, automatic audio metadata"
28
+       error "   will be that of the first input file provided. If all input files"
29
+       error "   have the same audio properties (bit depth, sample rate, etc)"
30
+       error "   this won't be an issue. Usually, complete seasons of film series"
31
+       error "   have the same audio properties."
32
+       error "   Otherwise you may want to:"
33
+       echo
34
+       error "-> Disable auto metadata completely"
35
+       echo
36
+       error "-> Enable it but you will need to modify the batchfile yourself and"
37
+       error "   update the data to reflect the correct audio properties. Then"
38
+       error "   encode from there."
39
+       echo
40
+       printf "Disable Automatic Audio Metadata? [y/N]: "
41
+       read noautometa
42
+       if [ "$noautometa" = "y" -o "$noautometa" = "Y" ]; then
43
+           noaudmeta="1"
44
+       fi
45
+       echo
46
+   fi
47
+   
48
    for i in $(eval echo "{1..$ATRACKS}"); do
49
        audindex[i]="$(($i-1))"
50
        printf "Track $i: Specify the Audio Track to Encode or Copy [default is 0:1]: "
51
        read astream[i]
52
        test -z "${astream[i]}" && atrack[i]="0:1" || atrack[i]="${astream[i]}"
53
+       
54
+       audmap[i]="-map ${atrack[i]}"
55
+       
56
        printf "Track $i: Specify the 3-letter Language Code for Metadata [press 'Enter' to skip]: "
57
        read alang[i]
58
        test ! -z "${alang[i]}" && audlang[i]="-metadata:s:a:${audindex[i]} language=${alang[i]}"
59
-       audmap[i]="-map ${atrack[i]}"
60
    done
61
    
62
    if [ -z "$DEFAULT_AUD_CODEC" ]; then
63
@@ -2566,14 +2591,14 @@
64
            flac)
65
            acdc[i]="flac"
66
            acdcmeta[i]="FLAC"
67
-           abropts[i]="0-12"
68
+           abropts[i]="0(low)-12(high)"
69
            abrdef[i]="5"
70
            skiptfs="1"
71
            ;;
72
            alac)
73
            acdc[i]="alac"
74
            acdcmeta[i]="ALAC"
75
-           abropts[i]="0-12"
76
+           abropts[i]="0(low)-12(high)"
77
            abrdef[i]="5"
78
            skiptfs="1"
79
            ;;
80
@@ -2638,13 +2663,14 @@
81
            esac
82
        done
83
        
84
+       aidx[i]="$(($(echo "${atrack[i]}" | awk -F: '{print $2}')-1))"
85
+       test "${aidx[i]}" = "-1" && aidx[i]="0"
86
+       
87
        if [ "${acodec[i]}" != "copy" ]; then
88
-           aid[i]="$(($(echo "${atrack[i]}" | awk -F: '{print $2}')-1))"
89
-           test "${aid[i]}" = "-1" && aid[i]="0"
90
-           GETAUDBD[i]="$($FFPROBE -i "$input" -v quiet -select_streams a:${aid[i]} -show_entries stream=bits_per_raw_sample -of default=noprint_wrappers=1:nokey=1 | tail -1)"
91
+           GETAUDBD[i]="$($FFPROBE -i "$input" -v quiet -select_streams a:${aidx[i]} -show_entries stream=bits_per_raw_sample -of default=noprint_wrappers=1:nokey=1 | tail -1)"
92
            if [ ! -z "${GETAUDBD[i]}" ]; then
93
                case "${GETAUDBD[i]}" in
94
-                   [1-9]*) abdmeta[i]=", ${GETAUDBD[i]} bits src" ;;
95
+                   [1-9]*) abdmeta[i]=", ${GETAUDBD[i]} bits input" ;;
96
                esac
97
            fi
98
            case "${acodec[i]}" in
99
@@ -2719,15 +2745,20 @@
100
                dts)                    chanrange[i]="1/2/4/5/6"; defchan[i]="6" ;;
101
                fdk*)
102
                case "${aacprof[i]}" in
103
-                   aac_low|aac_he|aac_ld)      chanrange[i]="1-8"; defchan[i]="8" ;;
104
-                   *)              chanrange[i]="1-2"; defchan[i]="2" ;;
105
+                   aac_he_v2)          true ;;
106
+                   *)              chanrange[i]="1-8"; defchan[i]="8" ;;
107
                esac
108
                ;;
109
            esac
110
            
111
-           printf "Track $i: How many Channels to Encode? [${chanrange[i]} - default is ${defchan[i]}]: "
112
-           read achan[i]
113
-           test -z "${achan[i]}" && ach[i]="${defchan[i]}" || ach[i]="${achan[i]}"
114
+           case "${aacprof[i]}" in
115
+               aac_he_v2)  ach[i]="2" ;;
116
+               ""|*)
117
+               printf "Track $i: How many Channels to Encode? [${chanrange[i]} - default is ${defchan[i]}]: "
118
+               read achan[i]
119
+               test -z "${achan[i]}" && ach[i]="${defchan[i]}" || ach[i]="${achan[i]}"
120
+               ;;
121
+           esac
122
            case "${acodec[i]}" in
123
                ac3|eac3)
124
                case "${ach[i]}" in
125
@@ -2761,15 +2792,7 @@
126
                ;;
127
                fdk*)
128
                case "${aacprof[i]}" in
129
-                   aac_he_v2)
130
-                   case "${ach[i]}" in
131
-                       1|2) true ;;
132
-                       *)
133
-                       error "-> HE-AACv2 supports only 1-2 channels!"
134
-                       exit 1
135
-                       ;;
136
-                   esac
137
-                   ;;
138
+                   aac_he_v2) true ;;
139
                    *)
140
                    case "${ach[i]}" in
141
                        [1-6]|8) true ;;
142
@@ -2884,25 +2907,30 @@
143
                esac
144
                ;;
145
                fdk*)
146
-               echo " 0 -> Mono     4 -> 5.0"
147
-               echo " 1 -> Stereo   5 -> 5.1"
148
-               echo " 2 -> 3.0      6 -> 7.1"
149
-               echo " 3 -> 4.0      7 -> 7.1(wide)"
150
-               echo
151
-               printf "Track $i: Specify the Audio Channel Layout [default is 6]: "
152
-               read achanlayout[i]
153
-               case "${achanlayout[i]}" in
154
-                   0)  achlayout[i]="mono"; achmeta[i]=" Mono" ;;
155
-                   1)  achlayout[i]="stereo"; achmeta[i]=" Stereo" ;;
156
-                   2)  achlayout[i]="3.0"; achmeta[i]=" 3.0" ;;
157
-                   3)  achlayout[i]="4.0"; achmeta[i]=" 4.0" ;;
158
-                   4)  achlayout[i]="5.0"; achmeta[i]=" 5.0" ;;
159
-                   5)  achlayout[i]="5.1"; achmeta[i]=" 5.1" ;;
160
-                   6|"")   achlayout[i]="7.1"; achmeta[i]=" 7.1" ;;
161
-                   7)  achlayout[i]="7.1(wide)"; achmeta[i]=" 7.1(wide)" ;;
162
+               case "${aacprof[i]}" in
163
+                   aac_he_v2)  achlayout[i]="stereo"; achmeta[i]=" Stereo" ;;
164
                    *)
165
-                   error "-> Invalid option!"
166
-                   exit 1
167
+                   echo " 0 -> Mono     4 -> 5.0"
168
+                   echo " 1 -> Stereo   5 -> 5.1"
169
+                   echo " 2 -> 3.0      6 -> 7.1"
170
+                   echo " 3 -> 4.0      7 -> 7.1(wide)"
171
+                   echo
172
+                   printf "Track $i: Specify the Audio Channel Layout [default is 6]: "
173
+                   read achanlayout[i]
174
+                   case "${achanlayout[i]}" in
175
+                       0)  achlayout[i]="mono"; achmeta[i]=" Mono" ;;
176
+                       1)  achlayout[i]="stereo"; achmeta[i]=" Stereo" ;;
177
+                       2)  achlayout[i]="3.0"; achmeta[i]=" 3.0" ;;
178
+                       3)  achlayout[i]="4.0"; achmeta[i]=" 4.0" ;;
179
+                       4)  achlayout[i]="5.0"; achmeta[i]=" 5.0" ;;
180
+                       5)  achlayout[i]="5.1"; achmeta[i]=" 5.1" ;;
181
+                       6|"")   achlayout[i]="7.1"; achmeta[i]=" 7.1" ;;
182
+                       7)  achlayout[i]="7.1(wide)"; achmeta[i]=" 7.1(wide)" ;;
183
+                       *)
184
+                       error "-> Invalid option!"
185
+                       exit 1
186
+                       ;;
187
+                   esac
188
                    ;;
189
                esac
190
                ;;
191
@@ -3114,7 +3142,7 @@
192
                    echo
193
                    green "-> Track $i: detecting audio sample rate..."
194
                    sleep 1
195
-                   GETAUDSR[i]="$($FFPROBE -i "$input" -v quiet -select_streams a:${aid[i]} -show_entries stream=sample_rate -of default=noprint_wrappers=1:nokey=1 | tail -1)"
196
+                   GETAUDSR[i]="$($FFPROBE -i "$input" -v quiet -select_streams a:${aidx[i]} -show_entries stream=sample_rate -of default=noprint_wrappers=1:nokey=1 | tail -1)"
197
                    if [ ! -z "${GETAUDSR[i]}" ]; then
198
                        green "-> Track $i: detected ${GETAUDSR[i]} Hz"
199
                    else
200
@@ -3312,13 +3340,13 @@
201
            fi
202
            
203
            if [ -z "${audhz[i]}" ]; then
204
-               GETAUDSR[i]="$($FFPROBE -i "$input" -v quiet -select_streams a:${aid[i]} -show_entries stream=sample_rate -of default=noprint_wrappers=1:nokey=1 | tail -1)"
205
+               GETAUDSR[i]="$($FFPROBE -i "$input" -v quiet -select_streams a:${aidx[i]} -show_entries stream=sample_rate -of default=noprint_wrappers=1:nokey=1 | tail -1)"
206
                case "${GETAUDSR[i]}" in
207
                    [1-9]*) ahzmeta[i]=", ${GETAUDSR[i]} Hz" ;;
208
                esac
209
            fi
210
            
211
-           audmeta[i]="-metadata:s:a:${audindex[i]} title=\"${acdcmeta[i]}${achmeta[i]}${abtrmeta[i]}${abdmeta[i]}${ahzmeta[i]}\""
212
+           audmeta[i]="-metadata:s:a:${audindex[i]} title=\"${acdcmeta[i]}${achmeta[i]}${abtrmeta[i]}${ahzmeta[i]}${abdmeta[i]}\""
213
            audchan[i]="-ac:a:${audindex[i]} ${ach[i]} -channel_layout:a:${audindex[i]} \"${achlayout[i]}\""
214
            
215
            afilters[i]="$(echo "${aresample[i]}${anormalize[i]}${avolume[i]}$atempo" | sed 's|,$||')"
216
@@ -3326,19 +3354,15 @@
217
            test ! -z "${afilters[i]}" && audfilters[i]="-filter:a:${audindex[i]} ${afilters[i]}"
218
        else
219
            if [ -z "$batchmode" ]; then
220
-               aid[i]="$(($(echo "${atrack[i]}" | awk -F: '{print $2}')-1))"
221
-               test "${aid[i]}" = "-1" && aid[i]="0"
222
-               
223
-               GETAUDCDC[i]="$($FFPROBE -i "$input" -v quiet -select_streams a:${aid[i]} -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 | tail -1)"
224
-               
225
+               GETAUDCDC[i]="$($FFPROBE -i "$input" -v quiet -select_streams a:${aidx[i]} -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 | tail -1)"
226
                if [ ! -z "${GETAUDCDC[i]}" ]; then
227
-                   GETAUDBTR[i]="$($FFPROBE -i "$input" -v quiet -select_streams a:${aid[i]} -show_entries stream=bit_rate -of default=noprint_wrappers=1:nokey=1 | tail -1)"
228
-                   GETAUDBD[i]="$($FFPROBE -i "$input" -v quiet -select_streams a:${aid[i]} -show_entries stream=bits_per_raw_sample -of default=noprint_wrappers=1:nokey=1 | tail -1)"
229
-                   GETAUDSR[i]="$($FFPROBE -i "$input" -v quiet -select_streams a:${aid[i]} -show_entries stream=sample_rate -of default=noprint_wrappers=1:nokey=1 | tail -1)"
230
-                   GETAUDCL[i]="$($FFPROBE -i "$input" -v quiet -select_streams a:${aid[i]} -show_entries stream=channel_layout -of default=noprint_wrappers=1:nokey=1 | tail -1)"
231
+                   GETAUDBTR[i]="$($FFPROBE -i "$input" -v quiet -select_streams a:${aidx[i]} -show_entries stream=bit_rate -of default=noprint_wrappers=1:nokey=1 | tail -1)"
232
+                   GETAUDBD[i]="$($FFPROBE -i "$input" -v quiet -select_streams a:${aidx[i]} -show_entries stream=bits_per_raw_sample -of default=noprint_wrappers=1:nokey=1 | tail -1)"
233
+                   GETAUDSR[i]="$($FFPROBE -i "$input" -v quiet -select_streams a:${aidx[i]} -show_entries stream=sample_rate -of default=noprint_wrappers=1:nokey=1 | tail -1)"
234
+                   GETAUDCL[i]="$($FFPROBE -i "$input" -v quiet -select_streams a:${aidx[i]} -show_entries stream=channel_layout -of default=noprint_wrappers=1:nokey=1 | tail -1)"
235
                    
236
                    get_audio_profile_func() {
237
-                       GETAUDPROF[i]="$($FFPROBE -i "$input" -v quiet -select_streams a:${aid[i]} -show_entries stream=profile -of default=noprint_wrappers=1:nokey=1 | tail -1)"
238
+                       GETAUDPROF[i]="$($FFPROBE -i "$input" -v quiet -select_streams a:${aidx[i]} -show_entries stream=profile -of default=noprint_wrappers=1:nokey=1 | tail -1)"
239
                    }
240
                    
241
                    case "${GETAUDCDC[i]}" in
242
@@ -3383,7 +3407,7 @@
243
                            mono)   achmeta[i]=" Mono" ;;
244
                            stereo) achmeta[i]=" Stereo" ;;
245
                            unknown|N/A|"")
246
-                           GETAUDCH[i]="$($FFPROBE -i "$input" -v quiet -select_streams a:${aid[i]} -show_entries stream=channels -of default=noprint_wrappers=1:nokey=1 | tail -1)"
247
+                           GETAUDCH[i]="$($FFPROBE -i "$input" -v quiet -select_streams a:${aidx[i]} -show_entries stream=channels -of default=noprint_wrappers=1:nokey=1 | tail -1)"
248
                            case "${GETAUDCH[i]}" in
249
                                1)  achmeta[i]=" Mono" ;;
250
                                2)  achmeta[i]=" Stereo" ;;
251
@@ -3408,12 +3432,17 @@
252
                    case "${GETAUDSR[i]}" in
253
                        [1-9]*) asrmeta[i]=", ${GETAUDSR[i]} Hz" ;;
254
                    esac
255
-                   audmeta[i]="-metadata:s:a:${audindex[i]} title=\"${GETAUDCDC[i]}${achmeta[i]}${abtrmeta[i]}${abdmeta[i]}${asrmeta[i]}\""
256
+                   audmeta[i]="-metadata:s:a:${audindex[i]} title=\"${GETAUDCDC[i]}${achmeta[i]}${abtrmeta[i]}${asrmeta[i]}${abdmeta[i]}\""
257
                fi
258
            fi
259
        fi
260
        
261
-       audparams[i]="${audmap[i]} -c:a:${audindex[i]} ${acdc[i]} ${audprofile[i]} ${audcomplevel[i]} ${audbtr[i]} ${audchan[i]} ${audbd[i]} ${auddialnorm[i]} ${audfilters[i]} ${audlang[i]} ${audmeta[i]} ${auddispo[i]}"
262
+       if [ -z "$noaudmeta" ]; then
263
+           audparams[i]="${audmap[i]} -c:a:${audindex[i]} ${acdc[i]} ${audprofile[i]} ${audcomplevel[i]} ${audbtr[i]} ${audchan[i]} ${audbd[i]} ${auddialnorm[i]} ${audfilters[i]} ${audlang[i]} ${audmeta[i]} ${auddispo[i]}"
264
+       else
265
+           audparams[i]="${audmap[i]} -c:a:${audindex[i]} ${acdc[i]} ${audprofile[i]} ${audcomplevel[i]} ${audbtr[i]} ${audchan[i]} ${audbd[i]} ${auddialnorm[i]} ${audfilters[i]} ${audlang[i]} ${auddispo[i]}"
266
+       fi
267
+
268
    done
269
 fi
270
 
271
@@ -3461,8 +3490,7 @@
272
                # Audio copy, get bitrate
273
                for i in $(eval echo "{1..$ATRACKS}"); do
274
                    if [ "${acodec[i]}" = "copy" ]; then
275
-                       aid[i]="$(($(echo "${atrack[i]}" | awk -F: '{print $2}')-1))"
276
-                       abtr[i]="$($FFPROBE -i "$input" -v quiet -select_streams a:${aid[i]} -show_entries stream=bit_rate -of default=noprint_wrappers=1:nokey=1 | tail -1)"
277
+                       abtr[i]="$($FFPROBE -i "$input" -v quiet -select_streams a:${aidx[i]} -show_entries stream=bit_rate -of default=noprint_wrappers=1:nokey=1 | tail -1)"
278
                        case "${abtr[i]}" in
279
                            [1-9]*) abitrate[i]="$((${abtr[i]}/1000))" ;;
280
                            ""|*)   abitrate[i]="0" ;;
281
@@ -3613,7 +3641,7 @@
282
        esac
283
        echo "echo" >> "$OUTFILE"
284
        echo "green \"-> Adding cover image...\"" >> "$OUTFILE"
285
-       echo "$MP4BOX -add \"$OUTPUT\"$color -itags cover=\"$(readlink -e "$cover")\":name=\"$(basename "${OUTPUT%.*}")\":genre=\"$genre\":created=\"$year\":comment=\"$COMMENT\" -mpeg4 -new \"${OUTPUT%.*}_COVER_$$.$CONFMT\" >/dev/null 2>&1" >> "$OUTFILE"
286
+       echo "$MP4BOX -add \"$OUTPUT\"$color -itags cover=\"$(readlink -e "$cover")\":name=\"$(basename "${OUTPUT%.*}")\":genre=\"$genre\":created=\"$year\":comment=\"$COMMENT\" -tmp \"$(dirname "$OUTPUT")\" -mpeg4 -new \"${OUTPUT%.*}_COVER_$$.$CONFMT\" >/dev/null 2>&1" >> "$OUTFILE"
287
        echo "RET=\$?" >> "$OUTFILE"
288
        echo "test \"\$RET\" = \"0\" && green \"-> Done\" || red \"-> Failed!\"" >> "$OUTFILE"
289
        echo "if [ \"\$RET\" = \"0\" ]; then" >> "$OUTFILE"
290
@@ -3657,7 +3685,7 @@
291
                echo "" >> "$OUTFILE"
292
                echo "echo" >> "$OUTFILE"
293
                echo "green \"-> Adding cover image...\"" >> "$OUTFILE"
294
-               echo "$MP4BOX -add \"${OUTPUT%.*}.$i\"$color -itags cover=\"$(readlink -e "$cover")\":name=\"$(basename "${OUTPUT%.*}")\":genre=\"$genre\":created=\"$year\":comment=\"$COMMENT\" -mpeg4 -new \"${OUTPUT%.*}_COVER_$$.$i\" >/dev/null 2>&1" >> "$OUTFILE"
295
+               echo "$MP4BOX -add \"${OUTPUT%.*}.$i\"$color -itags cover=\"$(readlink -e "$cover")\":name=\"$(basename "${OUTPUT%.*}")\":genre=\"$genre\":created=\"$year\":comment=\"$COMMENT\" -tmp \"$(dirname "$OUTPUT")\" -mpeg4 -new \"${OUTPUT%.*}_COVER_$$.$i\" >/dev/null 2>&1" >> "$OUTFILE"
296
                echo "RET=\$?" >> "$OUTFILE"
297
                echo "test \"\$RET\" = \"0\" && green \"-> Done\" || red \"-> Failed!\"" >> "$OUTFILE"
298
                echo "if [ \"\$RET\" = \"0\" ]; then" >> "$OUTFILE"
299