Changes of Revision 8
ffx264.changes
Changed
x
1
2
-------------------------------------------------------------------
3
+Sat Nov 05 10:56:00 UTC 2016 - neutrino8@opensuse.org
4
+
5
+- Update to version 3.0.9
6
+ * Use a single var, $ofps, to set the output FPS for both
7
+ deinterlace bobbing and FPS conversion
8
+ * Use new $bob var to indicate that we do bobbing and use that
9
+ var to disable FPS conversion
10
+ * Renamed $fp var in video_deinterlace_func() to $fpar
11
+ * Print a warning message that FPS conversion gets disabled if
12
+ the user chooses audio copy
13
+ * Added support for the FDK-AAC audio codec. Requires ffmpeg
14
+ to be compiled with libfdk-aac support
15
+ * Support FPS conversion with the 'fps' filter
16
+ * Some minor code optimizations
17
+
18
+-------------------------------------------------------------------
19
Fri Nov 04 10:43:00 UTC 2016 - neutrino8@opensuse.org
20
21
- Update to version 3.0.8
22
ffx264-3.0.8.tar.gz/ChangeLog -> ffx264-3.0.9.tar.gz/ChangeLog
Changed
18
1
2
+2016-11-05 - ffx264 3.0.9
3
+ * Use a single var, $ofps, to set the output FPS for both deinterlace
4
+ bobbing and FPS conversion
5
+ * Use new $bob var to indicate that we do bobbing and use that
6
+ var to disable FPS conversion
7
+ * Renamed $fp var in video_deinterlace_func() to $fpar
8
+ * Print a warning message that FPS conversion gets disabled if
9
+ the user chooses audio copy
10
+ * Added support for the FDK-AAC audio codec. Requires ffmpeg
11
+ to be compiled with libfdk-aac support
12
+ * Support FPS conversion with the 'fps' filter
13
+ * Some minor code optimizations
14
+
15
2016-11-04 - ffx264 3.0.8
16
* Bugfix: the scale variable was used twice for different things
17
causing an overwrite of the scale filter parameters, which
18
ffx264-3.0.8.tar.gz/ffx264 -> ffx264-3.0.9.tar.gz/ffx264
Changed
341
1
2
#
3
# Small script to encode to H.264/AVC video using FFmpeg and libx264.
4
# Author: Grozdan "microchip" Nikolov <neutrino8@gmail.com>
5
-# Version: 3.0.8
6
-# Date: 2016-11-04
7
+# Version: 3.0.9
8
+# Date: 2016-11-05
9
# License: GNU GPLv2+
10
11
green() { echo -e "\e[1;32m$1\e[0;39;49m"; }
12
brown() { echo -e "\e[0;33m$1\e[0;39;49m"; }
13
error() { echo -e "\e[1;31m$1\e[0;39;49m"; }
14
15
-version="3.0.8"
16
+version="3.0.9"
17
18
CFG="$HOME/.ffx264"
19
cfgversion="24"
20
21
printf "Specify the Field Parity of the Input File [tff/bff - default is tff]: "
22
read par
23
case "$par" in
24
- t*|T*|"") fp="tff" ;;
25
- b*|B*) fp="bff" ;;
26
+ t*|T*|"") fpar="tff" ;;
27
+ b*|B*) fpar="bff" ;;
28
*)
29
error "-> Invalid option!"
30
exit 1
31
32
esac
33
fi
34
case "$1" in
35
- ofps) test ! -z "$fp" && deinterlace="yadif=1,mcdeint=mode=medium:parity=$fp:qp=10,framestep=step=2," || deinterlace="yadif=0," ;;
36
- bob) test ! -z "$fp" && deinterlace="yadif=1,mcdeint=mode=medium:parity=$fp:qp=10," || deinterlace="yadif=1," ;;
37
+ ofps) test ! -z "$fpar" && deinterlace="yadif=1,mcdeint=mode=medium:parity=$fpar:qp=10,framestep=step=2," || deinterlace="yadif=0," ;;
38
+ bob) test ! -z "$fpar" && deinterlace="yadif=1,mcdeint=mode=medium:parity=$fpar:qp=10," || deinterlace="yadif=1," ;;
39
esac
40
}
41
42
43
video_fps_func
44
FPS1="$(cat "$FPSOUT" | sed -n 's|r_frame_rate=||p' | awk -F/ '{print $1}')"
45
FPS2="$(cat "$FPSOUT" | sed -n 's|r_frame_rate=||p' | awk -F/ '{print $2}')"
46
+ OFPS="$(($FPS1*2))/$FPS2"
47
rm -f "$FPSOUT"
48
echo
49
green "-> Detected $FPS1/$FPS2 FPS"
50
- green "-> Setting output FPS to: $(($FPS1*2))/$FPS2"
51
+ green "-> Setting output FPS to: $OFPS"
52
echo
53
- fps="-r $(($FPS1*2))/$FPS2"
54
+ ofps="-r $OFPS"
55
video_deinterlace_func bob
56
+ bob="1"
57
;;
58
*)
59
error "-> Invalid option!"
60
61
if [ "$VID_FPS_CONVERT" = "y" ]; then
62
# Not supported with interlaced encoding
63
# and deinterlacing with a bobber
64
- if [ -z "$interlaced" -a -z "$fp" ]; then
65
+ if [ -z "$interlaced" -a -z "$bob" ]; then
66
printf "Do an NTSC <-> PAL or NTSC <-> NTSC FPS conversion? [y/N]: "
67
read fpscon
68
if [ "$fpscon" = "y" -o "$fpscon" = "Y" ]; then
69
70
esac
71
echo
72
if [ -z "$skipfps" ]; then
73
+ brown " FPS Conversion Filters"
74
+ brown " ~~~~~~~~~~~~~~~~~~~~~~"
75
+ echo " 0 -> fps (converts by duplicating/dropping of frames)"
76
+ echo " 1 -> setpts + atempo (converts by PTS + audio speedup/down)"
77
+ echo
78
+ printf "Specify the FPS conversion method [default is 0]: "
79
+ read fcm
80
+ case "$fcm" in
81
+ 0|1|"") true ;;
82
+ *)
83
+ error "-> Invalid option!"
84
+ exit 1
85
+ ;;
86
+ esac
87
+ echo
88
brown " NTSC <-> PAL and NTSC <-> NTSC FPS Conversion"
89
brown " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
90
echo " 0 --> 23.976 FPS (24000/1001) to 24 FPS"
91
92
read fpsopt
93
case "$fpsopt" in
94
0)
95
- setpts="setpts=23976/24000*PTS,"
96
- atempo="atempo=1.001001001,"
97
+ case "$fcm" in
98
+ 0|"") fps="fps=fps=24," ;;
99
+ 1) setpts="setpts=23976/24000*PTS,"; atempo="atempo=1.001001001," ;;
100
+ esac
101
ofps="-r 24/1"
102
;;
103
1)
104
- setpts="setpts=23976/25000*PTS,"
105
- atempo="atempo=1.04270937604270937604,"
106
+ case "$fcm" in
107
+ 0|"") fps="fps=fps=25," ;;
108
+ 1) setpts="setpts=23976/25000*PTS,"; atempo="atempo=1.04270937604270937604," ;;
109
+ esac
110
ofps="-r 25/1"
111
;;
112
2)
113
- setpts="setpts=23976/29970*PTS,"
114
- atempo="atempo=1.25,"
115
+ case "$fcm" in
116
+ 0|"") fps="fps=fps=30000/1001," ;;
117
+ 1) setpts="setpts=23976/29970*PTS,"; atempo="atempo=1.25," ;;
118
+ esac
119
ofps="-r 30000/1001"
120
;;
121
3)
122
- setpts="setpts=24000/23976*PTS,"
123
- atempo="atempo=0.999,"
124
+ case "$fcm" in
125
+ 0|"") fps="fps=fps=24000/1001," ;;
126
+ 1) setpts="setpts=24000/23976*PTS,"; atempo="atempo=0.999," ;;
127
+ esac
128
ofps="-r 24000/1001"
129
;;
130
4)
131
- setpts="setpts=24000/25000*PTS,"
132
- atempo="atempo=1.04166666667,"
133
+ case "$fcm" in
134
+ 0|"") fps="fps=fps=25," ;;
135
+ 1) setpts="setpts=24000/25000*PTS,"; atempo="atempo=1.04166666667," ;;
136
+ esac
137
ofps="-r 25/1"
138
;;
139
5)
140
- setpts="setpts=24000/29970*PTS,"
141
- atempo="atempo=1.24875,"
142
+ case "$fcm" in
143
+ 0|"") fps="fps=fps=30000/1001," ;;
144
+ 1) setpts="setpts=24000/29970*PTS,"; atempo="atempo=1.24875," ;;
145
+ esac
146
ofps="-r 30000/1001"
147
;;
148
6)
149
- setpts="setpts=25000/23976*PTS,"
150
- atempo="atempo=0.95904,"
151
+ case "$fcm" in
152
+ 0|"") fps="fps=fps=24000/1001," ;;
153
+ 1) setpts="setpts=25000/23976*PTS,"; atempo="atempo=0.95904," ;;
154
+ esac
155
ofps="-r 24000/1001"
156
;;
157
7)
158
- setpts="setpts=25000/24000*PTS,"
159
- atempo="atempo=0.96,"
160
+ case "$fcm" in
161
+ 0|"") fps="fps=fps=24," ;;
162
+ 1) setpts="setpts=25000/24000*PTS,"; atempo="atempo=0.96," ;;
163
+ esac
164
ofps="-r 24/1"
165
;;
166
8)
167
- setpts="setpts=25000/29970*PTS,"
168
- atempo="atempo=1.1988,"
169
+ case "$fcm" in
170
+ 0|"") fps="fps=fps=30000/1001," ;;
171
+ 1) setpts="setpts=25000/29970*PTS,"; atempo="atempo=1.1988," ;;
172
+ esac
173
ofps="-r 30000/1001"
174
;;
175
9)
176
- setpts="setpts=29970/23976*PTS,"
177
- atempo="atempo=0.8,"
178
+ case "$fcm" in
179
+ 0|"") fps="fps=fps=24000/1001," ;;
180
+ 1) setpts="setpts=29970/23976*PTS,"; atempo="atempo=0.8," ;;
181
+ esac
182
ofps="-r 24000/1001"
183
;;
184
10)
185
- setpts="setpts=29970/24000*PTS,"
186
- atempo="atempo=0.800800800801,"
187
+ case "$fcm" in
188
+ 0|"") fps="fps=fps=24," ;;
189
+ 1) setpts="setpts=29970/24000*PTS,"; atempo="atempo=0.800800800801," ;;
190
+ esac
191
ofps="-r 24/1"
192
;;
193
11)
194
- setpts="setpts=29970/25000*PTS,"
195
- atempo="atempo=0.83416750083416750083,"
196
+ case "$fcm" in
197
+ 0|"") fps="fps=fps=25," ;;
198
+ 1) setpts="setpts=29970/25000*PTS,"; atempo="atempo=0.83416750083416750083," ;;
199
+ esac
200
ofps="-r 25/1"
201
;;
202
"")
203
204
echo " EAC3 ----> Channels Support: 6 (encoder max)"
205
echo " DTS -----> Channels Support: 6 (codec max)"
206
echo " AAC -----> Channels Support: 8 (ffmpeg max)"
207
+ echo " FDK-AAC -> Channels Support: 8 (ffmpeg max)"
208
echo " Opus ----> Channels Support: 8 (ffmpeg max)"
209
echo " Vorbis --> Channels Support: 8 (ffmpeg max)"
210
echo " MP3 -----> Channels Support: 2 (codec max)"
211
212
abropts[i]="32-512"
213
abrdef[i]="448"
214
;;
215
+ fdk-aac)
216
+ acdc[i]="libfdk_aac"
217
+ abropts[i]="8-512"
218
+ abrdef[i]="448"
219
+ ;;
220
mp3)
221
acdc[i]="libmp3lame"
222
ameta[i]="MP3"
223
224
# We only clear the video filter and fps here. No need to
225
# also clear the audio filter since it never reaches the
226
# below $afilters filter chain.
227
- setpts=
228
- ofps=
229
+ # Exception is the 'fps' filter, which seems to work fine
230
+ # with audio copy and doesn't introduce any A/V desync,
231
+ # according to my testing
232
+ if [ ! -z "$setpts" ]; then
233
+ skipsetpts="1"
234
+ setpts=
235
+ ofps=
236
+ fi
237
;;
238
nosound)
239
audparams[1]="-an"
240
241
if [ "${acodec[i]}" != "copy" ]; then
242
if [ "${acodec[i]}" != "flac" ]; then
243
if [ "${acodec[i]}" != "pcm" ]; then
244
+ if [ "${acodec[i]}" = "fdk-aac" ]; then
245
+ printf "Track $i: Which AAC Profile to Use? [LC/HE/HEv2 - default is LC]: "
246
+ read aprof[i]
247
+ case "${aprof[i]}" in
248
+ lc|LC|"") ameta[i]="LC-AAC"; aacprof[i]="aac_low" ;;
249
+ he|HE) ameta[i]="HE-AACv1"; aacprof[i]="aac_he" ;;
250
+ hev2|HEv2|HEV2) ameta[i]="HE-AACv2"; aacprof[i]="aac_he_v2" ;;
251
+ *)
252
+ error "- Invalid AAC profile!"
253
+ exit 1
254
+ ;;
255
+ esac
256
+ audprofile[i]="-profile:a:${audmapval[i]} ${aacprof[i]} -afterburner:a:${audmapval[i]} 1"
257
+
258
+ fi
259
printf "Track $i: Specify the Audio Bitrate in kbps [${abropts[i]} - default is ${abrdef[i]}]: "
260
read abr[i]
261
test -z "${abr[i]}" && abitrate[i]="${abrdef[i]}k" || abitrate[i]="${abr[i]}k"
262
263
ac3|eac3|dts|"") chanrange[i]="1-6"; defchan[i]="6" ;;
264
aac|opus|vorbis|flac|pcm) chanrange[i]="1-8"; defchan[i]="8" ;;
265
mp3) chanrange[i]="1-2"; defchan[i]="2" ;;
266
+ fdk-aac)
267
+ case "${aacprof[i]}" in
268
+ aac_low|aac_he) chanrange[i]="1-8"; defchan[i]="8" ;;
269
+ *) chanrange[i]="1-2"; defchan[i]="2" ;;
270
+ esac
271
+ ;;
272
esac
273
printf "Track $i: How many Channels to Encode? [${chanrange[i]} - default is ${defchan[i]}]: "
274
read achan[i]
275
276
;;
277
esac
278
;;
279
+ fdk-aac)
280
+ case "${aacprof[i]}" in
281
+ aac_he_v2)
282
+ case "${ach[i]}" in
283
+ 1|2) true ;;
284
+ *)
285
+ error "-> HE-AACv2 supports only 1-2 channels!"
286
+ exit 1
287
+ ;;
288
+ esac
289
+ ;;
290
+ esac
291
+ ;;
292
mp3)
293
case "${ach[i]}" in
294
1|2) true ;;
295
296
fi
297
fi
298
299
- audparams[i]="${audmap[i]} -c:a:${audmapval[i]} ${acdc[i]} ${audbtr[i]} ${audchan[i]} ${audfilters[i]} ${audlang[i]} ${audmeta[i]}"
300
+ audparams[i]="${audmap[i]} -c:a:${audmapval[i]} ${acdc[i]} ${audprofile[i]} ${audbtr[i]} ${audchan[i]} ${audfilters[i]} ${audlang[i]} ${audmeta[i]}"
301
302
fi
303
done
304
305
+if [ ! -z "$skipsetpts" ]; then
306
+ echo
307
+ error "-> FPS conversion with the 'setpts' and 'atempo' filters has"
308
+ error " been disabled as it is incompatible with audio stream copy!"
309
+fi
310
+
311
case "$mode" in
312
1p|2p)
313
# Haven't found a reliable way to make it work with
314
315
316
test "$CHAPS" = "n" && CHPS="-map_chapters -1"
317
318
-vidfilters="$(echo "$deinterlace$crop$deblock$denoise$scale$rotate$setpts" | sed 's|,$||')"
319
+vidfilters="$(echo "$deinterlace$crop$deblock$denoise$scale$rotate$setpts$fps" | sed 's|,$||')"
320
321
test ! -z "$vidfilters" && vfilters="-vf $vidfilters"
322
323
324
case "$1" in
325
1p|crf)
326
test "$mode" = "1p" && pmode="bitrate=$vbitrate" || pmode="crf=$CRF"
327
- OPTS1="-map 0:0 -disposition:v:0 default $fps $ofps $NOSUBS $MDATA $CHPS $METATITLE $METAGENRE $METAYEAR $METACOMMENT $vfilters $sws"
328
+ OPTS1="-map 0:0 -disposition:v:0 default $ofps $NOSUBS $MDATA $CHPS $METATITLE $METAGENRE $METAYEAR $METACOMMENT $vfilters $sws"
329
OPTS2="${audparams[*]} ${auddis[*]} ${subcopy[*]} ${subdis[*]} $strict $movflags $METACOVER \"$OUTPUT\""
330
;;
331
2p)
332
333
passtwo="stats=\"$OUTFILE.log\":pass=2:bitrate=$vbitrate"
334
OPTS1="-map 0:0"
335
OPTS2="-an -f null -y /dev/null"
336
- OPTS3="-map 0:0 -disposition:v:0 default $fps $ofps $NOSUBS $MDATA $CHPS $METATITLE $METAGENRE $METAYEAR $METACOMMENT $vfilters $sws"
337
+ OPTS3="-map 0:0 -disposition:v:0 default $ofps $NOSUBS $MDATA $CHPS $METATITLE $METAGENRE $METAYEAR $METACOMMENT $vfilters $sws"
338
OPTS4="${audparams[*]} ${auddis[*]} ${subcopy[*]} ${subdis[*]} $strict $movflags $METACOVER \"$OUTPUT\""
339
;;
340
esac
341