Changes of Revision 18
ffx264.changes
Changed
x
1
2
-------------------------------------------------------------------
3
+Mon Nov 14 09:18:00 UTC 2016 - neutrino8@opensuse.org
4
+
5
+- Update to version 3.1.7
6
+ * Set default amount of subtitles to 1 instead of exiting when no
7
+ value is given
8
+ * Allow the user to choose the amount of audio tracks he wants at
9
+ run time instead of requiring it to be set in the config file.
10
+ This removes config file var MAX_AUD_TRACKS and bumps up version
11
+ to 27
12
+ * Renamed array variables audmapval and submapval to audindex and
13
+ subindex since we're not mapping but specifying the audio/sub
14
+ index id with these vars
15
+ * Fixed a possible case where audio params weren't cleared in
16
+ case the nosound option was chosen
17
+
18
+-------------------------------------------------------------------
19
Sun Nov 13 11:36:00 UTC 2016 - neutrino8@opensuse.org
20
21
- Update to version 3.1.6
22
ffx264.spec
Changed
10
1
2
3
4
Name: ffx264
5
-Version: 3.1.6
6
+Version: 3.1.7
7
Release: 0
8
Summary: A small shell script for encoding to H.264 with ffmpeg
9
License: GPL-2.0+
10
ffx264-3.1.6.tar.gz/ChangeLog -> ffx264-3.1.7.tar.gz/ChangeLog
Changed
19
1
2
+2016-11-14 - ffx264 3.1.7
3
+ * Set default amount of subtitles to 1 instead of exiting when no
4
+ value is given
5
+ * Allow the user to choose the amount of audio tracks he wants at
6
+ run time instead of requiring it to be set in the config file.
7
+ This removes config file var MAX_AUD_TRACKS and bumps up version
8
+ to 27
9
+ * Renamed array variables audmapval and submapval to audindex and
10
+ subindex since we're not mapping but specifying the audio/sub
11
+ index id with these vars
12
+ * Fixed a possible case where audio params weren't cleared in
13
+ case the nosound option was chosen
14
+ * A few other small tweaks
15
+
16
2016-11-13 - ffx264 3.1.6
17
* Added support for batch encoding mode, to be activated with the
18
new -b option. It's used to encode directories with video files
19
ffx264-3.1.6.tar.gz/ffx264 -> ffx264-3.1.7.tar.gz/ffx264
Changed
559
1
2
#
3
# Small script to encode to H.264/AVC video using FFmpeg and libx264.
4
# Author: Grozdan "microchip" Nikolov <neutrino8@opensuse.org>
5
-# Version: 3.1.6
6
-# Date: 2016-11-13
7
+# Version: 3.1.7
8
+# Date: 2016-11-14
9
#
10
# ffx264 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
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.1.6"
17
+version="3.1.7"
18
19
CFG="$HOME/.ffx264"
20
-cfgversion="26"
21
+cfgversion="27"
22
23
genconfig_func() {
24
cat<<EOF>>"$CFG"
25
26
AUD_VOLUME="y"
27
AUD_RESAMPLE="y"
28
29
-# Max amount of audio tracks to support
30
-# Any non-zero value will do. Set it
31
-# to "auto" to ask for as many as
32
-# detected audio tracks
33
-MAX_AUD_TRACKS="2"
34
-
35
# Enable subtitles support?
36
# Note: not all containers support
37
# all types of subs!
38
39
esac
40
done
41
42
-if [ ! -z "$PRSTFILE" ]; then
43
- if [ ! -z "$vpreset" -o ! -z "$vtune" ]; then
44
- if [ ! -z "$(grep '^X264PARAMS' "$PRSTFILE")" ]; then
45
- echo
46
- error "-> x264 presets/tune profiles are mutually exclusive with custom presets!"
47
- echo
48
- error "-> If you want to use a custom configuration file, don't add or comment"
49
- error " out the X264PARAMS variable in it. Then you can use the built-in"
50
- error " presets/tuning with that file."
51
- echo
52
- exit 1
53
- fi
54
- fi
55
-else
56
+if [ ! -z "$vtune" ]; then
57
if [ -z "$vpreset" ]; then
58
- if [ -f "$CFG" -a -z "$(grep '^X264PARAMS' "$CFG")" ]; then
59
- echo
60
- error "-> The X264PARAMS variable is commented out"
61
- error " or missing from '$CFG'"
62
- echo
63
- error "-> Regenerating config file!"
64
- rm -f "$CFG"
65
- genconfig_func
66
- echo
67
- fi
68
+ error "-> Tune profiles require a preset to be used!"
69
+ error "-> Use: $(basename $0) -h"
70
+ exit 1
71
fi
72
fi
73
74
75
source "$CFG"
76
fi
77
78
-test ! -z "$PRSTFILE" && source "$PRSTFILE"
79
+if [ ! -z "$PRSTFILE" ]; then
80
+ if [ ! -z "$vpreset" ]; then
81
+ if [ ! -z "$(grep '^X264PARAMS' "$PRSTFILE")" ]; then
82
+ error "-> x264 presets/tune profiles are mutually exclusive with custom presets!"
83
+ error "-> If you want to use a custom configuration file, don't add or comment"
84
+ error " out the X264PARAMS variable in it. Then you can use the built-in"
85
+ error " presets/tuning with that file."
86
+ echo
87
+ exit 1
88
+ fi
89
+ else
90
+ if [ -z "$(grep '^X264PARAMS' "$PRSTFILE")" ]; then
91
+ error "-> The X264PARAMS variable is commented out or missing in your file!"
92
+ error "-> Please at least add to the file: X264PARAMS=\"ref=4\" (for example)"
93
+ echo
94
+ exit 1
95
+ fi
96
+ fi
97
+ source "$PRSTFILE"
98
+else
99
+ if [ -z "$vpreset" ]; then
100
+ if [ -f "$CFG" -a -z "$(grep '^X264PARAMS' "$CFG")" ]; then
101
+ error "-> The X264PARAMS variable is commented out"
102
+ error " or missing in '$CFG'"
103
+ error "-> Regenerating config file!"
104
+ echo
105
+ rm -f "$CFG"
106
+ genconfig_func
107
+ fi
108
+ fi
109
+fi
110
111
if [ ! -z "$FFMPEG" ]; then
112
if [ ! -x "$FFMPEG" ]; then
113
114
video_subtitles_func() {
115
case "$1" in
116
infile)
117
- printf "How many Subtitles to Copy?: "
118
+ printf "How many Subtitles to Copy? [0-inf - default is 1]: "
119
read subcp
120
case "$subcp" in
121
+ 0) SUBCP="0" ;;
122
[1-9]*) SUBCP="$subcp" ;;
123
- ""|*)
124
- error "-> Invalid or no value given!"
125
+ "") SUBCP="1" ;;
126
+ *)
127
+ error "-> Invalid value!"
128
exit 1
129
;;
130
esac
131
- for i in $(eval echo "{1..$SUBCP}"); do
132
- submapval[i]="$(($i-1))"
133
- printf "Sub $i: Specify a Subtitle to Copy [example: 0:2]: "
134
- read subnr[i]
135
- if [ ! -z "${subnr[i]}" ]; then
136
- printf "Sub $i: Specify the 3-letter Language Code for Metadata [press 'Enter' to skip]: "
137
- read slang[i]
138
- if [ ! -z "${slang[i]}" ]; then
139
- sublang[i]="-metadata:s:s:${submapval[i]} language=${slang[i]}"
140
+ if [ "$SUBCP" != "0" ]; then
141
+ for i in $(eval echo "{1..$SUBCP}"); do
142
+ subindex[i]="$(($i-1))"
143
+ printf "Sub $i: Specify a Subtitle to Copy [example: 0:2]: "
144
+ read subnr[i]
145
+ if [ ! -z "${subnr[i]}" ]; then
146
+ printf "Sub $i: Specify the 3-letter Language Code for Metadata [press 'Enter' to skip]: "
147
+ read slang[i]
148
+ if [ ! -z "${slang[i]}" ]; then
149
+ sublang[i]="-metadata:s:s:${subindex[i]} language=${slang[i]}"
150
+ fi
151
+ subcopy[i]="-map ${subnr[i]} -c:s:${subindex[i]} copy ${sublang[i]}"
152
+ # Workaround for an ffmpeg disposition issue
153
+ # where in some cases it sets subsequent tracks
154
+ # as default.
155
+ test "$i" = "1" && sdis="default" || sdis="none"
156
+ subdis[i]="-disposition:s:${subindex[i]} $sdis"
157
+ else
158
+ error "-> No value given!"
159
+ exit 1
160
fi
161
- subcopy[i]="-map ${subnr[i]} -c:s:${submapval[i]} copy ${sublang[i]}"
162
- # Workaround for an ffmpeg disposition issue
163
- # where in some cases it sets subsequent tracks
164
- # as default.
165
- test "$i" = "1" && sdis="default" || sdis="none"
166
- subdis[i]="-disposition:s:${submapval[i]} $sdis"
167
- else
168
- error "-> No value given!"
169
- exit 1
170
- fi
171
- done
172
+ done
173
+ fi
174
test "$subopt" = "2" && echo
175
;;
176
ext)
177
178
esac
179
done
180
fi
181
- printf "How many External Subtitles to Add?: "
182
+ printf "How many External Subtitles to Add? [0-inf - default is 1]: "
183
read subext
184
case "$subext" in
185
+ 0) SUBEXT="0" ;;
186
[1-9]*) SUBEXT="$subext" ;;
187
- ""|*)
188
- error "-> Invalid or no value given!"
189
+ "") SUBEXT="1" ;;
190
+ *)
191
+ error "-> Invalid value!"
192
exit 1
193
;;
194
esac
195
- for i in $(eval echo "{1..$SUBEXT}"); do
196
- test ! -z "${submapval[*]}" && submap[i]="$((${submapval[-1]}+$i))" || submap[i]="$(($i-1))"
197
- printf "Sub $i: Specify the Subtitle File: "
198
- read -e sub[i]
199
- if [ ! -f "${sub[i]}" ]; then
200
- error "-> No such file!"
201
- exit 1
202
- else
203
- printf "Sub $i: Specify the 3-letter Language Code for Metadata [press 'Enter' to skip]: "
204
- read slng[i]
205
- if [ ! -z "${slng[i]}" ]; then
206
- sublng[i]="-metadata:s:s:${submap[i]} language=${slng[i]}"
207
- fi
208
- EXTSUBS[i]="-i \"${sub[i]}\""
209
- if [ ! -z "${submapval[*]}" ]; then
210
- sdispo="none"
211
+ if [ "$SUBEXT" != "0" ]; then
212
+ for i in $(eval echo "{1..$SUBEXT}"); do
213
+ test ! -z "${subindex[*]}" && subidx[i]="$((${subindex[-1]}+$i))" || subidx[i]="$(($i-1))"
214
+ printf "Sub $i: Specify the Subtitle File: "
215
+ read -e subfile[i]
216
+ if [ ! -f "${subfile[i]}" ]; then
217
+ error "-> No such file!"
218
+ exit 1
219
else
220
- test "$i" = "1" && sdispo="default" || sdispo="none"
221
+ printf "Sub $i: Specify the 3-letter Language Code for Metadata [press 'Enter' to skip]: "
222
+ read slng[i]
223
+ if [ ! -z "${slng[i]}" ]; then
224
+ sublng[i]="-metadata:s:s:${subidx[i]} language=${slng[i]}"
225
+ fi
226
+ EXTSUBS[i]="-i \"${subfile[i]}\""
227
+ if [ ! -z "${subindex[*]}" ]; then
228
+ sdispo="none"
229
+ else
230
+ test "$i" = "1" && sdispo="default" || sdispo="none"
231
+ fi
232
+ subdispo[i]="-disposition:s:${subidx[i]} $sdispo"
233
+ subcpy[i]="-map $i:0 -c:s:${subidx[i]} copy ${sublng[i]}"
234
fi
235
- subdispo[i]="-disposition:s:${submap[i]} $sdispo"
236
- subcpy[i]="-map $i:0 -c:s:${submap[i]} copy ${sublng[i]}"
237
- fi
238
- done
239
+ done
240
+ fi
241
;;
242
esac
243
}
244
245
sleep 1
246
AUDTRKS="$($FFPROBE -i "$input" 2>&1 | grep 'Stream #' | grep 'Audio' | sed 's| ||g')"
247
if [ ! -z "$AUDTRKS" ]; then
248
- green "$AUDTRKS"
249
ATRKS="$(echo "$AUDTRKS" | wc -l)"
250
+ green "$AUDTRKS"
251
+ echo
252
+ green "-> Detected $ATRKS audio tracks"
253
else
254
error "-> Could not detect any audio tracks!"
255
- ATRKS="0"
256
fi
257
echo
258
259
-if [ "$MAX_AUD_TRACKS" = "auto" ]; then
260
- test "$ATRKS" = "0" && MAX_AUD_TRACKS="1" || MAX_AUD_TRACKS="$ATRKS"
261
-fi
262
+printf "How many Audio Tracks to Encode or Copy? [0-inf - default is 1]: "
263
+read atracks
264
+case "$atracks" in
265
+ 0) audparams[1]="-an"; ATRACKS="0" ;;
266
+ [1-9]*) ATRACKS="$atracks" ;;
267
+ "") ATRACKS="1" ;;
268
+ *)
269
+ error "-> Invalid value!"
270
+ exit 1
271
+ ;;
272
+esac
273
274
-for i in $(eval echo "{1..$MAX_AUD_TRACKS}"); do
275
- audmapval[i]="$(($i-1))"
276
- if [ "$i" = "1" -a "$ATRKS" != "0" ]; then
277
- defaudtrk="default is 0:1"
278
- else
279
- defaudtrk="press 'Enter' to skip"
280
- fi
281
- printf "Track $i: Specify the Audio Track to Encode or Copy [$defaudtrk]: "
282
- read astream[i]
283
- if [ -z "${astream[1]}" -a "$ATRKS" != "0" ]; then
284
- astream[1]="0:1"
285
- fi
286
- if [ ! -z "${astream[i]}" ]; then
287
+if [ "$ATRACKS" != "0" ]; then
288
+ for i in $(eval echo "{1..$ATRACKS}"); do
289
+ audindex[i]="$(($i-1))"
290
+ printf "Track $i: Specify the Audio Track to Encode or Copy [default is 0:1]: "
291
+ read astream[i]
292
+ test -z "${astream[i]}" && atrack[i]="0:1" || atrack[i]="${astream[i]}"
293
printf "Track $i: Specify the 3-letter Language Code for Metadata [press 'Enter' to skip]: "
294
read alang[i]
295
if [ ! -z "${alang[i]}" ]; then
296
- audlang[i]="-metadata:s:a:${audmapval[i]} language=${alang[i]}"
297
+ audlang[i]="-metadata:s:a:${audindex[i]} language=${alang[i]}"
298
fi
299
- fi
300
-done
301
-
302
-test -z "$(echo "${astream[*]}" | sed 's| ||g')" && audparams[1]="-an"
303
-
304
-if [ "${audparams[1]}" != "-an" ]; then
305
+ audmap[i]="-map ${atrack[i]}"
306
+ done
307
+
308
echo
309
brown " Available Audio Codecs"
310
brown " ~~~~~~~~~~~~~~~~~~~~~~"
311
312
echo " PCM -----> Channels Support: 8 (ffmpeg max)"
313
echo " COPY ----> Channels Support: depends on audio codec"
314
echo " NOSOUND -> Channels Support: N/A"
315
-fi
316
-
317
-for i in $(eval echo "{1..$MAX_AUD_TRACKS}"); do
318
- if [ ! -z "${astream[i]}" ]; then
319
+
320
+ for i in $(eval echo "{1..$ATRACKS}"); do
321
echo
322
- audmap[i]="-map ${astream[i]}"
323
-
324
# Workaround for an ffmpeg disposition issue
325
# where in some cases it flags subsequent
326
# tracks as default.
327
test "$i" = "1" && adis="default" || adis="none"
328
- auddis[i]="-disposition:a:${audmapval[i]} $adis"
329
+ auddis[i]="-disposition:a:${audindex[i]} $adis"
330
331
printf "Track $i: Specify the Audio Codec [default is AC3]: "
332
read acodec[i]
333
334
fi
335
;;
336
nosound)
337
- audparams[1]="-an"
338
- abitrate[1]="0"
339
# nosound takes precedence so
340
# clear any audio options given
341
- if [ $i -ge 2 ]; then
342
- for t in $(eval echo "{2..$MAX_AUD_TRACKS}"); do
343
- audparams[t]=
344
- auddis[t]=
345
- done
346
- fi
347
+ for t in $(eval echo "{1..$ATRACKS}"); do
348
+ audparams[t]=
349
+ auddis[t]=
350
+ done
351
+ echo
352
+ error "-> NOSOUND chosen. Clearing all other audio options!"
353
+ audparams[1]="-an"
354
+ abitrate[1]="0"
355
break
356
;;
357
*)
358
359
exit 1
360
;;
361
esac
362
- audprofile[i]="-profile:a:${audmapval[i]} ${aacprof[i]} -afterburner:a:${audmapval[i]} 1"
363
+ audprofile[i]="-profile:a:${audindex[i]} ${aacprof[i]} -afterburner:a:${audindex[i]} 1"
364
;;
365
flac)
366
printf "Track $i: Specify the FLAC Compression Level [${abropts[i]} - default is ${abrdef[i]}]: "
367
read abr[i]
368
test -z "${abr[i]}" && acomplevel[i]="${abrdef[i]}" || acomplevel[i]="${abr[i]}"
369
- audcomplevel[i]="-compression_level:a:${audmapval[i]} ${acomplevel[i]}"
370
+ audcomplevel[i]="-compression_level:a:${audindex[i]} ${acomplevel[i]}"
371
abtrmeta[i]="@ CL ${acomplevel[i]}"
372
;;
373
pcm)
374
375
printf "Track $i: Specify the Audio Bitrate in kbps [${abropts[i]} - default is ${abrdef[i]}]: "
376
read abr[i]
377
test -z "${abr[i]}" && abitrate[i]="${abrdef[i]}k" || abitrate[i]="${abr[i]}k"
378
- audbtr[i]="-b:a:${audmapval[i]} ${abitrate[i]}"
379
+ audbtr[i]="-b:a:${audindex[i]} ${abitrate[i]}"
380
abtrmeta[i]="@ $(echo "${abitrate[i]}" | sed 's|k||') kbps"
381
;;
382
esac
383
384
;;
385
esac
386
387
- audmeta[i]="-metadata:s:a:${audmapval[i]} title=\"${ameta[i]} ${achmeta[i]} ${abtrmeta[i]}\""
388
- audchan[i]="-ac:a:${audmapval[i]} ${ach[i]} -channel_layout:a:${audmapval[i]} \"${chlayout[i]}\""
389
+ audmeta[i]="-metadata:s:a:${audindex[i]} title=\"${ameta[i]} ${achmeta[i]} ${abtrmeta[i]}\""
390
+ audchan[i]="-ac:a:${audindex[i]} ${ach[i]} -channel_layout:a:${audindex[i]} \"${chlayout[i]}\""
391
392
if [ "$AUD_NORMALIZE" = "y" ]; then
393
printf "Track $i: Normalize the Audio Volume? [y/N]: "
394
395
echo
396
green "-> Track $i: detecting audio sample rate..."
397
sleep 1
398
- aid[i]="$(($(echo "${astream[i]}" | awk -F: '{print $2}')-1))"
399
+ aid[i]="$(($(echo "${atrack[i]}" | awk -F: '{print $2}')-1))"
400
ASR[i]="$($FFPROBE -i "$input" -show_streams -select_streams a:${aid[i]} 2>&1 | sed -n 's|^sample_rate=||p')"
401
if [ ! -z "${ASR[i]}" ]; then
402
green "-> Track $i: detected ${ASR[i]} Hz"
403
404
405
afilters[i]="$(echo "${aresample[i]}${anormalize[i]}${avolume[i]}$atempo" | sed 's|,$||')"
406
407
- test ! -z "${afilters[i]}" && audfilters[i]="-filter:a:${audmapval[i]} ${afilters[i]}"
408
+ test ! -z "${afilters[i]}" && audfilters[i]="-filter:a:${audindex[i]} ${afilters[i]}"
409
fi
410
411
- audparams[i]="${audmap[i]} -c:a:${audmapval[i]} ${acdc[i]} ${audprofile[i]} ${audcomplevel[i]} ${audbtr[i]} ${audchan[i]} ${audfilters[i]} ${audlang[i]} ${audmeta[i]}"
412
-
413
- fi
414
-done
415
+ audparams[i]="${audmap[i]} -c:a:${audindex[i]} ${acdc[i]} ${audprofile[i]} ${audcomplevel[i]} ${audbtr[i]} ${audchan[i]} ${audfilters[i]} ${audlang[i]} ${audmeta[i]}"
416
+ done
417
+fi
418
419
if [ ! -z "$skipsetpts" ]; then
420
echo
421
422
error "-> Skipping bitrate calculation!"
423
else
424
# Audio copy, get bitrate
425
- for i in $(eval echo "{1..$MAX_AUD_TRACKS}"); do
426
+ for i in $(eval echo "{1..$ATRACKS}"); do
427
if [ "${acodec[i]}" = "copy" ]; then
428
- aid[i]="$(($(echo "${astream[i]}" | awk -F: '{print $2}')-1))"
429
+ aid[i]="$(($(echo "${atrack[i]}" | awk -F: '{print $2}')-1))"
430
abtr[i]="$($FFPROBE -i "$input" -show_streams -select_streams a:${aid[i]} 2>&1 | sed -n 's|^bit_rate=||p')"
431
case "${abtr[i]}" in
432
[1-9]*) abitrate[i]="$((${abtr[i]}/1000))" ;;
433
434
;;
435
esac
436
437
-test "$METADATA" = "n" && MDATA="-map_metadata -1"
438
-
439
-test "$CHAPS" = "n" && CHPS="-map_chapters -1"
440
-
441
-vidfilters="$(echo "$deinterlace$crop$deblock$denoise$scale$rotate$setpts$fps" | sed 's|,$||')"
442
-
443
-test ! -z "$vidfilters" && vfilters="-vf $vidfilters"
444
-
445
-test ! -z "$vpreset" && X264PARAMS=":force-cfr=1:threads=auto$colorprim$interlaced $vpreset" || X264PARAMS=":$X264PARAMS$colorprim"
446
-
447
-test ! -z "$COMMENT" && METACOMMENT="-metadata comment=\"$COMMENT\""
448
-
449
# Small counter :)
450
counter_func() {
451
for i in 5 4 3 2 1 0; do
452
453
454
455
if [ -z "$batchmode" ]; then
456
- OUTFILE="$(dirname "$OUTPUT")/$(basename "${OUTPUT%.*}" | sed 's| |_|g')"
457
+ OUTFILE="$(dirname "$OUTPUT")/$(basename "${OUTPUT%.*}" | sed 's| |_|g').sh"
458
else
459
- OUTFILE="$(dirname "$OUTPUT")/$(basename $0)_batch$$"
460
+ OUTFILE="$(dirname "$OUTPUT")/$(basename $0)_batch$$.sh"
461
input="\$i"
462
fi
463
464
+test "$METADATA" = "n" && MDATA="-map_metadata -1"
465
+
466
+test "$CHAPS" = "n" && CHPS="-map_chapters -1"
467
+
468
+vidfilters="$(echo "$deinterlace$crop$deblock$denoise$scale$rotate$setpts$fps" | sed 's|,$||')"
469
+
470
+test ! -z "$vidfilters" && vfilters="-vf $vidfilters"
471
+
472
+test ! -z "$vpreset" && X264PARAMS=":force-cfr=1:threads=auto$colorprim$interlaced $vpreset $vtune" || X264PARAMS=":$X264PARAMS$colorprim"
473
+
474
+test ! -z "$COMMENT" && METACOMMENT="-metadata comment=\"$COMMENT\""
475
+
476
encoder_func() {
477
case "$1" in
478
1p|crf)
479
480
OPTS2="${audparams[*]} ${auddis[*]} ${subcopy[*]} ${subcpy[*]} ${subdis[*]} ${subdispo[*]} $strict $movflags $METACOVER \"$OUTPUT\""
481
;;
482
2p)
483
- passone="stats=\"$OUTFILE.log\":pass=1:bitrate=$vbitrate"
484
- passtwo="stats=\"$OUTFILE.log\":pass=2:bitrate=$vbitrate"
485
+ passone="stats=\"${OUTFILE%.*}.log\":pass=1:bitrate=$vbitrate"
486
+ passtwo="stats=\"${OUTFILE%.*}.log\":pass=2:bitrate=$vbitrate"
487
OPTS1="-map 0:0"
488
OPTS2="-an -f null -y /dev/null"
489
OPTS3="${EXTSUBS[*]} -map 0:0 -disposition:v:0 default $ofps $annexb $NOSUBS $MDATA $CHPS $METATITLE $METAGENRE $METAYEAR $METACOMMENT $vfilters $sws"
490
OPTS4="${audparams[*]} ${auddis[*]} ${subcopy[*]} ${subcpy[*]} ${subdis[*]} ${subdispo[*]} $strict $movflags $METACOVER \"$OUTPUT\""
491
;;
492
esac
493
- echo "nice -n $NICE $FFMPEG -i \"$input\" $OPTS1 -c:v libx264 -x264opts $pmode$passone$X264PARAMS $vtune $OPTS2"
494
+ echo "nice -n $NICE $FFMPEG -i \"$input\" $OPTS1 -c:v libx264 -x264opts $pmode$passone$X264PARAMS $OPTS2"
495
case "$1" in
496
2p)
497
echo
498
- echo "nice -n $NICE $FFMPEG -i \"$input\" $OPTS3 -c:v libx264 -x264opts $passtwo$X264PARAMS $vtune $OPTS4"
499
+ echo "nice -n $NICE $FFMPEG -i \"$input\" $OPTS3 -c:v libx264 -x264opts $passtwo$X264PARAMS $OPTS4"
500
;;
501
esac
502
}
503
504
-echo "#!/usr/bin/env bash" > "$OUTFILE.sh"
505
-echo "" >> "$OUTFILE.sh"
506
+echo "#!/usr/bin/env bash" > "$OUTFILE"
507
+echo "" >> "$OUTFILE"
508
if [ ! -z "$batchmode" ]; then
509
- echo "$CHDIR" >> "$OUTFILE.sh"
510
- echo "" >> "$OUTFILE.sh"
511
- echo "$FORLOOP_START" >> "$OUTFILE.sh"
512
- echo "$CHKFILE_START" >> "$OUTFILE.sh"
513
+ echo "$CHDIR" >> "$OUTFILE"
514
+ echo "" >> "$OUTFILE"
515
+ echo "$FORLOOP_START" >> "$OUTFILE"
516
+ echo "$CHKFILE_START" >> "$OUTFILE"
517
fi
518
-encoder_func $encmode >> "$OUTFILE.sh"
519
-echo "" >> "$OUTFILE.sh"
520
+encoder_func $encmode >> "$OUTFILE"
521
+echo "" >> "$OUTFILE"
522
if [ ! -z "$extracon" ]; then
523
- echo "grn() { echo -e \"\e[1;32m\$1\e[0;39;49m\"; }" >> "$OUTFILE.sh"
524
- echo "red() { echo -e \"\e[1;31m\$1\e[0;39;49m\"; }" >> "$OUTFILE.sh"
525
+ echo "green() { echo -e \"\e[1;32m\$1\e[0;39;49m\"; }" >> "$OUTFILE"
526
+ echo "red() { echo -e \"\e[1;31m\$1\e[0;39;49m\"; }" >> "$OUTFILE"
527
for i in $extracon; do
528
- echo "" >> "$OUTFILE.sh"
529
- echo "echo" >> "$OUTFILE.sh"
530
- echo "grn \"-> Converting to $i...\"" >> "$OUTFILE.sh"
531
- echo "" >> "$OUTFILE.sh"
532
+ echo "" >> "$OUTFILE"
533
+ echo "echo" >> "$OUTFILE"
534
+ echo "green \"-> Remuxing to $i...\"" >> "$OUTFILE"
535
+ echo "" >> "$OUTFILE"
536
case "$i" in
537
- avi|m2ts|mts|ts) echo "$FFMPEG -i \"$OUTPUT\" -map 0 -c copy -bsf:v h264_mp4toannexb \"${OUTPUT%.*}.$i\" >/dev/null 2>&1" >> "$OUTFILE.sh" ;;
538
- *) echo "$FFMPEG -i \"$OUTPUT\" -map 0 -c copy \"${OUTPUT%.*}.$i\" >/dev/null 2>&1" >> "$OUTFILE.sh" ;;
539
+ avi|m2ts|mts|ts) echo "$FFMPEG -i \"$OUTPUT\" -map 0 -c copy -bsf:v h264_mp4toannexb \"${OUTPUT%.*}.$i\" >/dev/null 2>&1" >> "$OUTFILE" ;;
540
+ *) echo "$FFMPEG -i \"$OUTPUT\" -map 0 -c copy \"${OUTPUT%.*}.$i\" >/dev/null 2>&1" >> "$OUTFILE" ;;
541
esac
542
- echo "test \"\$?\" = \"0\" && grn \"-> Done\" || red \"-> Failed!\"" >> "$OUTFILE.sh"
543
+ echo "test \"\$?\" = \"0\" && green \"-> Done\" || red \"-> Failed!\"" >> "$OUTFILE"
544
done
545
- echo "echo" >> "$OUTFILE.sh"
546
+ echo "echo" >> "$OUTFILE"
547
fi
548
if [ ! -z "$batchmode" ]; then
549
- echo "$CHKFILE_END" >> "$OUTFILE.sh"
550
- echo "$FORLOOP_END" >> "$OUTFILE.sh"
551
+ echo "$CHKFILE_END" >> "$OUTFILE"
552
+ echo "$FORLOOP_END" >> "$OUTFILE"
553
fi
554
-chmod +x "$OUTFILE.sh"
555
+chmod +x "$OUTFILE"
556
557
-source "$OUTFILE.sh"
558
+source "$OUTFILE"
559