Changes of Revision 15
ffx264.changes
Changed
x
1
2
-------------------------------------------------------------------
3
+Thu Nov 10 21:15:00 UTC 2016 - neutrino8@opensuse.org
4
+
5
+- Update to version 3.1.4
6
+ * Check if name of input file matches that of output file and warn
7
+ and exit. Requires the realpath utility
8
+ * Added support for the m2ts, mts, ts and flv containers
9
+ * Merged the code that checks if an audio codec is supported by a
10
+ container with that that checks for additional output containers.
11
+ Removes code duplication and maintainability
12
+ * Update to the audio sample rates. Sync them with
13
+ ffmpeg -h encoder=<encoder>
14
+ * Restrict TrueHD channels to 2, 5 and 6 as that's what the encoder
15
+ currently supports
16
+ * Updated the README file
17
+
18
+-------------------------------------------------------------------
19
Wed Nov 09 07:00:00 UTC 2016 - neutrino8@opensuse.org
20
21
- Update to version 3.1.3
22
ffx264.spec
Changed
10
1
2
3
4
Name: ffx264
5
-Version: 3.1.3
6
+Version: 3.1.4
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.3.tar.gz/ChangeLog -> ffx264-3.1.4.tar.gz/ChangeLog
Changed
17
1
2
+2016-11-10 - ffx264 3.1.4
3
+ * Check if name of input file matches that of output file and warn
4
+ and exit. Requires the realpath utility
5
+ * Added support for the m2ts, mts, ts and flv containers
6
+ * Merged the code that checks if an audio codec is supported by a
7
+ container with that that checks for additional output containers.
8
+ Removes code duplication and maintainability
9
+ * Update to the audio sample rates. Sync them with ffmpeg -h encoder=<encoder>
10
+ * Restrict TrueHD channels to 2, 5 and 6 as that's what the encoder
11
+ currently supports
12
+ * Updated the README file
13
+
14
2016-11-09 - ffx264 3.1.3
15
* Renamed config var CON to CONFMT. Updates config file version to 25
16
* Reduced some duplication in the audio codec checks for the container
17
ffx264-3.1.3.tar.gz/README -> ffx264-3.1.4.tar.gz/README
Changed
10
1
2
- it supports cover art for the MKV container.
3
- it supports the x264 presets and tune profiles.
4
- it supports custom written preset files.
5
-- it can output to more than one container.
6
+- it can output to more than one container format.
7
8
Parameters:
9
10
ffx264-3.1.3.tar.gz/ffx264 -> ffx264-3.1.4.tar.gz/ffx264
Changed
459
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.3
6
-# Date: 2016-11-09
7
+# Version: 3.1.4
8
+# Date: 2016-11-10
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.3"
17
+version="3.1.4"
18
19
CFG="$HOME/.ffx264"
20
cfgversion="25"
21
22
23
CONFMT="$(echo "$CONFMT" | tr '[:upper:]' '[:lower:]')"
24
25
+ OUTPUT="$OUTPUT.$CONFMT"
26
+
27
+ if [ -x "$(which realpath 2>/dev/null)" ]; then
28
+ if [ "$(realpath -s "$input")" = "$(realpath -s "$OUTPUT")" ]; then
29
+ error "-> Input file matches output file!"
30
+ exit 1
31
+ fi
32
+ fi
33
+
34
+ if [ -e "$OUTPUT" ]; then
35
+ echo
36
+ error "-> Renaming existing file to '$OUTPUT.old'"
37
+ echo
38
+ mv -f "$OUTPUT" "$OUTPUT.old"
39
+ fi
40
+
41
case "$CONFMT" in
42
- mp4|m4v|mov) movflags="-movflags +faststart" ;;
43
- avi) annexb="-bsf:v h264_mp4toannexb" ;;
44
- mkv) true ;;
45
+ mp4|m4v|mov) movflags="-movflags +faststart" ;;
46
+ avi|m2ts|mts|ts) annexb="-bsf:v h264_mp4toannexb" ;;
47
+ mkv|flv) true ;;
48
*)
49
error "-> H.264 video not supported by chosen container!"
50
- error "-> Supported containers are: mkv, mp4, mov, m4v and avi"
51
+ error "-> Supported containers are: mkv, mp4, mov, m4v, m2ts, mts, ts, flv and avi"
52
error "-> Check your config file, if needed, in '$CFG'"
53
exit 1
54
;;
55
56
printf "Output to Additional Container Formats? [y/N]: "
57
read acf
58
if [ "$acf" = "y" -o "$acf" = "Y" ]; then
59
- printf "Specify the Container Formats [example: mp4,mov,avi - press 'Enter' to skip]: "
60
+ printf "Specify the Container Formats [example: mp4,m2ts,mov - press 'Enter' to skip]: "
61
read econ
62
test ! -z "$econ" && extracon="$(echo "$econ" | sed 's|,| |g' | tr '[:upper:]' '[:lower:]')"
63
if [ ! -z "$extracon" ]; then
64
container_func() {
65
case "$1" in
66
- mp4|mov|m4v|avi)
67
+ mp4|mov|m4v|avi|flv)
68
green "-> Note: additional container $i supports the following audio codecs:"
69
;;
70
esac
71
case "$1" in
72
- mp4) green "-> ac3|eac3|dts|aac|fdk-aac|mp3|vorbis|copy|nosound" ;;
73
- mov) green "-> ac3|eac3|dts|aac|fdk-aac|mp3|vorbis|flac|copy|nosound" ;;
74
- m4v) green "-> ac3|aac|fdk-aac|copy|nosound" ;;
75
- avi) green "-> ac3|eac3|dts|aac|fdk-aac|mp3|vorbis|pcm|flac|copy|nosound" ;;
76
+ mp4) green "-> ac3|eac3|dts|aac|fdk-aac|mp3|vorbis|copy|nosound" ;;
77
+ mov) green "-> ac3|eac3|dts|aac|fdk-aac|mp3|vorbis|flac|copy|nosound" ;;
78
+ m4v) green "-> ac3|aac|fdk-aac|copy|nosound" ;;
79
+ avi) green "-> ac3|eac3|dts|aac|fdk-aac|mp3|vorbis|pcm|flac|copy|nosound" ;;
80
+ flv) green "-> aac|fdk-aac|mp3|copy|nosound" ;;
81
other)
82
error "-> H.264 video not supported by the $i container!"
83
- error "-> Supported containers are: mkv, mp4, mov, m4v and avi"
84
+ error "-> Supported containers are: mkv, mp4, mov, m4v, m2ts, mts, ts, flv and avi"
85
echo
86
exit 1
87
;;
88
89
fi
90
echo
91
case "$i" in
92
- mkv) green "-> Note: additional container $i supports all the audio codecs" ;;
93
+ mkv|m2ts|mts|ts)
94
+ green "-> Note: additional container $i supports all the audio codecs"
95
+ ;;
96
+ flv)
97
+ container_func flv
98
+ error "-> Note: you may need to resample the audio to 44100, 22050 or 11025 Hz!"
99
+ ;;
100
mp4) container_func mp4 ;;
101
mov) container_func mov ;;
102
m4v) container_func m4v ;;
103
104
fi
105
fi
106
107
- OUTPUT="$OUTPUT.$CONFMT"
108
-
109
- test -e "$OUTPUT" && mv -f "$OUTPUT" "$OUTPUT.old"
110
-
111
METATITLE="-metadata title=\"$(basename "${OUTPUT%.*}")\" -metadata:s:v:0 title=\"$(basename "${OUTPUT%.*}")\""
112
fi
113
114
115
;;
116
esac
117
118
- case "$CONFMT" in
119
- mp4)
120
- case "${acodec[i]}" in
121
- pcm|opus|flac|truehd) asupport[i]="0" ;;
122
- esac
123
- ;;
124
- mov)
125
- case "${acodec[i]}" in
126
- pcm|opus|truehd) asupport[i]="0" ;;
127
- esac
128
- ;;
129
- m4v)
130
- case "${acodec[i]}" in
131
- eac3|dts|vorbis|flac|pcm|opus|truehd) asupport[i]="0" ;;
132
- esac
133
- ;;
134
- avi)
135
- case "${acodec[i]}" in
136
- opus|truehd) asupport[i]="0" ;;
137
- esac
138
- ;;
139
- esac
140
-
141
- if [ ! -z "${asupport[i]}" ]; then
142
- error "-> ${acodec[i]} audio is not supported by the $CONFMT container!"
143
- error "-> Check your config file, if needed, in '$CFG'"
144
+ conerror_func() {
145
+ test -z "${acodec[i]}" && audcodec[i]="ac3" || audcodec[i]="${acodec[i]}"
146
+ if [ ! -z "$extracon" ]; then
147
+ error "-> Additional container $c does not support ${audcodec[i]} audio!"
148
+ else
149
+ error "-> The $c container does not support ${audcodec[i]} audio!"
150
+ error "-> Check your config file, if needed, in '$CFG'"
151
+ fi
152
+ error "-> See: https://en.wikipedia.org/wiki/Comparison_of_video_container_formats"
153
exit 1
154
- fi
155
+ }
156
+
157
+ # mkv/m2ts/mts/ts are missing from the list since they
158
+ # support all the audio codecs supported by the script
159
+ for c in $CONFMT $extracon; do
160
+ case "$c" in
161
+ mp4)
162
+ case "${acodec[i]}" in
163
+ pcm|opus|flac|truehd) conerror_func ;;
164
+ esac
165
+ ;;
166
+ mov)
167
+ case "${acodec[i]}" in
168
+ pcm|opus|truehd) conerror_func ;;
169
+ esac
170
+ ;;
171
+ m4v)
172
+ case "${acodec[i]}" in
173
+ eac3|dts|vorbis|flac|pcm|opus|truehd) conerror_func ;;
174
+ esac
175
+ ;;
176
+ avi)
177
+ case "${acodec[i]}" in
178
+ opus|truehd) conerror_func ;;
179
+ esac
180
+ ;;
181
+ flv)
182
+ case "${acodec[i]}" in
183
+ ac3|eac3|dts|vorbis|flac|opus|truehd|"") conerror_func ;;
184
+ esac
185
+ ;;
186
+ esac
187
+ done
188
189
if [ "${acodec[i]}" != "copy" ]; then
190
case "${acodec[i]}" in
191
192
esac
193
194
case "${acodec[i]}" in
195
- ac3|eac3|truehd|dts|"") chanrange[i]="1-6"; defchan[i]="6" ;;
196
+ ac3|eac3|"") chanrange[i]="1-6"; defchan[i]="6" ;;
197
aac|opus|vorbis|flac|pcm) chanrange[i]="1-8"; defchan[i]="8" ;;
198
mp3) chanrange[i]="1-2"; defchan[i]="2" ;;
199
+ truehd) chanrange[i]="2/5/6"; defchan[i]="6" ;;
200
+ dts) chanrange[i]="1/2/4/5/6"; defchan[i]="6" ;;
201
fdk*)
202
case "${aacprof[i]}" in
203
aac_low|aac_he) chanrange[i]="1-8"; defchan[i]="8" ;;
204
205
esac
206
207
case "${acodec[i]}" in
208
- ac3|eac3|truehd|"")
209
+ ac3|eac3|"")
210
case "${ach[i]}" in
211
[1-6]) true ;;
212
*)
213
case "${acodec[i]}" in
214
ac3|"") error "-> AC-3 supports only 1-6 channels!" ;;
215
eac3) error "-> E-AC-3 encoder in ffmpeg supports only 1-6 channels!" ;;
216
- truehd) error "-> TrueHD encoder in ffmpeg supports only 1-6 channels!" ;;
217
esac
218
exit 1
219
;;
220
esac
221
;;
222
+ truehd)
223
+ case "${ach[i]}" in
224
+ 2|5|6) true ;;
225
+ *)
226
+ error "-> TrueHD encoder in ffmpeg supports only 2, 5 and 6 channels!"
227
+ exit 1
228
+ ;;
229
+ esac
230
+ ;;
231
dts)
232
case "${ach[i]}" in
233
1|2|4|5|6) true ;;
234
235
error "-> Track $i: could not detect the audio sample rate!"
236
fi
237
echo
238
+ brown " Supported Sample Rates"
239
+ brown " ~~~~~~~~~~~~~~~~~~~~~~"
240
case "${acodec[i]}" in
241
- mp3|ac3|eac3|dts|"")
242
- brown " Supported Sample Rates"
243
- brown " ~~~~~~~~~~~~~~~~~~~~~~"
244
+ ac3|eac3|"")
245
echo " 0 -> 32000 Hz"
246
echo " 1 -> 44100 Hz"
247
echo " 2 -> 48000 Hz"
248
249
;;
250
esac
251
;;
252
- aac|fdk*|flac)
253
- brown " Supported Sample Rates"
254
- brown " ~~~~~~~~~~~~~~~~~~~~~~"
255
- echo " 0 -> 8000 Hz 5 -> 24000 Hz 10 -> 88200 Hz"
256
- echo " 1 -> 11025 Hz 6 -> 32000 Hz 11 -> 96000 Hz"
257
+ mp3|dts)
258
+ echo " 0 -> 8000 Hz 5 -> 24000 Hz"
259
+ echo " 1 -> 11025 Hz 6 -> 32000 Hz"
260
echo " 2 -> 12000 Hz 7 -> 44100 Hz"
261
echo " 3 -> 16000 Hz 8 -> 48000 Hz"
262
- echo " 4 -> 22050 Hz 9 -> 64000 Hz"
263
+ echo " 4 -> 22050 Hz"
264
echo
265
printf "Track $i: Specify the Audio Sample Rate option [default is 8]: "
266
read arate[i]
267
268
6) audhz[i]="32000" ;;
269
7) audhz[i]="44100" ;;
270
8|"") audhz[i]="48000" ;;
271
- 9) audhz[i]="64000" ;;
272
- 10) audhz[i]="88200" ;;
273
- 11) audhz[i]="96000" ;;
274
+ *)
275
+ error "-> Invalid option!"
276
+ exit 1
277
+ ;;
278
+ esac
279
+ ;;
280
+ aac|fdk*)
281
+ echo " 0 -> 7350 Hz 5 -> 22050 Hz 10 -> 64000 Hz"
282
+ echo " 1 -> 8000 Hz 6 -> 24000 Hz 11 -> 88200 Hz"
283
+ echo " 2 -> 11025 Hz 7 -> 32000 Hz 12 -> 96000 Hz"
284
+ echo " 3 -> 12000 Hz 8 -> 44100 Hz"
285
+ echo " 4 -> 16000 Hz 9 -> 48000 Hz"
286
+ echo
287
+ printf "Track $i: Specify the Audio Sample Rate option [default is 9]: "
288
+ read arate[i]
289
+ case "${arate[i]}" in
290
+ 0) audhz[i]="7350" ;;
291
+ 1) audhz[i]="8000" ;;
292
+ 2) audhz[i]="11025" ;;
293
+ 3) audhz[i]="12000" ;;
294
+ 4) audhz[i]="16000" ;;
295
+ 5) audhz[i]="22050" ;;
296
+ 6) audhz[i]="24000" ;;
297
+ 7) audhz[i]="32000" ;;
298
+ 8) audhz[i]="44100" ;;
299
+ 9|"") audhz[i]="48000" ;;
300
+ 10) audhz[i]="64000" ;;
301
+ 11) audhz[i]="88200" ;;
302
+ 12) audhz[i]="96000" ;;
303
+ *)
304
+ error "-> Invalid option!"
305
+ exit 1
306
+ ;;
307
+ esac
308
+ ;;
309
+ flac)
310
+ echo " 0 -> 8000 Hz 4 -> 32000 Hz 8 -> 96000 Hz"
311
+ echo " 1 -> 16000 Hz 5 -> 44100 Hz 9 -> 176400 Hz"
312
+ echo " 2 -> 22050 Hz 6 -> 48000 Hz 10 -> 192000 Hz"
313
+ echo " 3 -> 24000 Hz 7 -> 88200 Hz"
314
+ echo
315
+ printf "Track $i: Specify the Audio Sample Rate option [default is 6]: "
316
+ read arate[i]
317
+ case "${arate[i]}" in
318
+ 0) audhz[i]="8000" ;;
319
+ 1) audhz[i]="16000" ;;
320
+ 2) audhz[i]="22050" ;;
321
+ 3) audhz[i]="24000" ;;
322
+ 4) audhz[i]="32000" ;;
323
+ 5) audhz[i]="44100" ;;
324
+ 6|"") audhz[i]="48000" ;;
325
+ 7) audhz[i]="88200" ;;
326
+ 8) audhz[i]="96000" ;;
327
+ 9) audhz[i]="176400" ;;
328
+ 10) audhz[i]="192000" ;;
329
*)
330
error "-> Invalid option!"
331
exit 1
332
333
esac
334
;;
335
opus)
336
- brown " Supported Sample Rates"
337
- brown " ~~~~~~~~~~~~~~~~~~~~~~"
338
- echo " 0 -> 8000 Hz 5 -> 24000 Hz"
339
- echo " 1 -> 11025 Hz 6 -> 32000 Hz"
340
- echo " 2 -> 12000 Hz 7 -> 44100 Hz"
341
- echo " 3 -> 16000 Hz 8 -> 48000 Hz"
342
- echo " 4 -> 22050 Hz "
343
+ echo " 0 -> 8000 Hz"
344
+ echo " 1 -> 12000 Hz"
345
+ echo " 2 -> 16000 Hz"
346
+ echo " 3 -> 24000 Hz "
347
+ echo " 4 -> 48000 Hz"
348
echo
349
- printf "Track $i: Specify the Audio Sample Rate option [default is 8]: "
350
+ printf "Track $i: Specify the Audio Sample Rate option [default is 4]: "
351
read arate[i]
352
case "${arate[i]}" in
353
0) audhz[i]="8000" ;;
354
- 1) audhz[i]="11025" ;;
355
- 2) audhz[i]="12000" ;;
356
- 3) audhz[i]="16000" ;;
357
- 4) audhz[i]="22050" ;;
358
- 5) audhz[i]="24000" ;;
359
- 6) audhz[i]="32000" ;;
360
- 7) audhz[i]="44100" ;;
361
- 8|"") audhz[i]="48000" ;;
362
+ 1) audhz[i]="12000" ;;
363
+ 2) audhz[i]="16000" ;;
364
+ 3) audhz[i]="24000" ;;
365
+ 4|"") audhz[i]="48000" ;;
366
+ *)
367
+ error "-> Invalid option!"
368
+ exit 1
369
+ ;;
370
+ esac
371
+ ;;
372
+ truehd)
373
+ echo " 0 -> 44100 Hz 3 -> 96000 Hz "
374
+ echo " 1 -> 48000 Hz 4 -> 176400 Hz"
375
+ echo " 2 -> 88200 Hz 5 -> 192000 Hz"
376
+ echo
377
+ printf "Track $i: Specify the Audio Sample Rate option [default is 1]: "
378
+ read arate[i]
379
+ case "${arate[i]}" in
380
+ 0) audhz[i]="44100" ;;
381
+ 1|"") audhz[i]="48000" ;;
382
+ 2) audhz[i]="88200" ;;
383
+ 3) audhz[i]="96000" ;;
384
+ 4) audhz[i]="176400" ;;
385
+ 5) audhz[i]="192000" ;;
386
*)
387
error "-> Invalid option!"
388
exit 1
389
;;
390
esac
391
;;
392
- vorbis|pcm|truehd)
393
- brown " Supported Sample Rates"
394
- brown " ~~~~~~~~~~~~~~~~~~~~~~"
395
+ vorbis|pcm)
396
echo " 0 -> 8000 Hz 5 -> 24000 Hz 10 -> 88200 Hz"
397
echo " 1 -> 11025 Hz 6 -> 32000 Hz 11 -> 96000 Hz"
398
echo " 2 -> 12000 Hz 7 -> 44100 Hz 12 -> 176400 Hz"
399
400
fi
401
done
402
403
-if [ ! -z "$extracon" ]; then
404
- conerror_func() {
405
- error "-> Additional container $i does not support ${acodec[a]} audio!"
406
- error "-> See: https://en.wikipedia.org/wiki/Comparison_of_video_container_formats#Formats_supported"
407
- exit 1
408
- }
409
- for i in $extracon; do
410
- case "$i" in
411
- # MKV is missing from the list since it supports
412
- # all the supported audio codecs by the script
413
- mp4)
414
- for a in $(eval echo "{1..$MAX_AUD_TRACKS}"); do
415
- case "${acodec[a]}" in
416
- pcm|opus|flac|truehd) conerror_func ;;
417
- esac
418
- done
419
- ;;
420
- mov)
421
- for a in $(eval echo "{1..$MAX_AUD_TRACKS}"); do
422
- case "${acodec[a]}" in
423
- pcm|opus|truehd) conerror_func ;;
424
- esac
425
- done
426
- ;;
427
- m4v)
428
- for a in $(eval echo "{1..$MAX_AUD_TRACKS}"); do
429
- case "${acodec[a]}" in
430
- eac3|dts|vorbis|flac|pcm|opus|truehd) conerror_func ;;
431
- esac
432
- done
433
- ;;
434
- avi)
435
- for a in $(eval echo "{1..$MAX_AUD_TRACKS}"); do
436
- case "${acodec[a]}" in
437
- opus|truehd) conerror_func ;;
438
- esac
439
- done
440
- ;;
441
- esac
442
- done
443
-fi
444
-
445
if [ ! -z "$skipsetpts" ]; then
446
echo
447
error "-> FPS conversion with the 'setpts' and 'atempo' filters has"
448
449
echo "grn \"-> Converting to $i...\"" >> "$OUTFILE.sh"
450
echo "" >> "$OUTFILE.sh"
451
case "$i" in
452
- avi) echo "$FFMPEG -i \"$OUTPUT\" -map 0 -c copy -bsf:v h264_mp4toannexb \"${OUTPUT%.*}.$i\" >/dev/null 2>&1" >> "$OUTFILE.sh" ;;
453
- *) echo "$FFMPEG -i \"$OUTPUT\" -map 0 -c copy \"${OUTPUT%.*}.$i\" >/dev/null 2>&1" >> "$OUTFILE.sh" ;;
454
+ avi|m2ts|mts|ts) echo "$FFMPEG -i \"$OUTPUT\" -map 0 -c copy -bsf:v h264_mp4toannexb \"${OUTPUT%.*}.$i\" >/dev/null 2>&1" >> "$OUTFILE.sh" ;;
455
+ *) echo "$FFMPEG -i \"$OUTPUT\" -map 0 -c copy \"${OUTPUT%.*}.$i\" >/dev/null 2>&1" >> "$OUTFILE.sh" ;;
456
esac
457
echo "test \"\$?\" = \"0\" && grn \"-> Done\" || red \"-> Failed!\"" >> "$OUTFILE.sh"
458
done
459