输入 #2 不会淡入的命令(这可以正常工作,但我需要使其淡入)。
time ffmpeg -hide_banner -y -loop 1 -t 21 -i 6e81d7a2e2979f10c531af8276d8136f.jpg -loop 1 -t 9 -i b28fd2813e9384353710402a9a450cd7.jpg -i bad861c0fd5f6a1e73b582749a56852b.jpg.png -t 29 -ss -1 -i 1633189093.mp3 -preset ultrafast -crf 18 -filter_complex " [3:a]afade=t=out:st=24:d=5[a]; [0:v]\n' +
' scale=878:494\n' +
' :force_original_aspect_ratio=decrease,\n' +
' pad=\n' +
' width=878\n' +
' :height=494\n' +
' :x=(ow-iw)/2\n' +
' :y=(oh-ih)/2\n' +
' :color=0x000000,\n' +
' setsar=1[image0];\n' +
' [1:v]\n' +
' scale=878:494\n' +
' :force_original_aspect_ratio=decrease,\n' +
' pad=\n' +
' width=878\n' +
' :height=494\n' +
' :x=(ow-iw)/2\n' +
' :y=(oh-ih)/2\n' +
' :color=0x000000,\n' +
' setsar=1[image1];\n' +
' [image0][image1]\n' +
' xfade=transition=fade\n' +
' :duration=1\n' +
` :offset=20[video]; [video]fade=in:0:25[video]; [video]split=2[base][blurred]; [blurred]boxblur=luma_radius=5:luma_power=1[blurred]; [blurred]fade=type=in:start_time=1:duration=2:alpha=1[blurred-with-fadein]; [base][blurred-with-fadein]overlay[video]; [video]drawbox= x=0 :y=0 :w=iw :h=ih :[email protected] :t='fill' :enable='between(t,3,29)'[video]; [2:v]scale=-2:247:force_original_aspect_ratio=increase[scaledCoverPhoto]; [video][scaledCoverPhoto]overlay=:x=w/2:y=(H-h)/2 , subtitles=intro-INTRO-subtitle.ass:fontsdir=../../preview/fonts, format=yuv420p, scale=-2:494 " -shortest -map "[a]" -format hls -sn -hls_time 5 -strict -2 -vsync 2 -bufsize 1200k -hls_list_size 0 -g 4 -r 25 output/index.m3u8
我需要输入 #2 的命令在第 6 秒淡入,持续 1 秒(但它不起作用)
time ffmpeg -hide_banner -y -loop 1 -t 21 -i 6e81d7a2e2979f10c531af8276d8136f.jpg -loop 1 -t 9 -i b28fd2813e9384353710402a9a450cd7.jpg -i bad861c0fd5f6a1e73b582749a56852b.jpg.png -t 29 -ss -1 -i 1633189093.mp3 -preset ultrafast -crf 18 -filter_complex " [3:a]afade=t=out:st=24:d=5[a]; [0:v]\n' +
' scale=878:494\n' +
' :force_original_aspect_ratio=decrease,\n' +
' pad=\n' +
' width=878\n' +
' :height=494\n' +
' :x=(ow-iw)/2\n' +
' :y=(oh-ih)/2\n' +
' :color=0x000000,\n' +
' setsar=1[image0];\n' +
' [1:v]\n' +
' scale=878:494\n' +
' :force_original_aspect_ratio=decrease,\n' +
' pad=\n' +
' width=878\n' +
' :height=494\n' +
' :x=(ow-iw)/2\n' +
' :y=(oh-ih)/2\n' +
' :color=0x000000,\n' +
' setsar=1[image1];\n' +
' [image0][image1]\n' +
' xfade=transition=fade\n' +
' :duration=1\n' +
` :offset=20[video]; [video]fade=in:0:25[video]; [video]split=2[base][blurred]; [blurred]boxblur=luma_radius=5:luma_power=1[blurred]; [blurred]fade=type=in:start_time=1:duration=2:alpha=1[blurred-with-fadein]; [base][blurred-with-fadein]overlay[video]; [video]drawbox= x=0 :y=0 :w=iw :h=ih :[email protected] :t='fill' :enable='between(t,3,29)'[video]; [2:v]scale=-2:247:force_original_aspect_ratio=increase,format=rgba,fade=in:st=6:d=1:alpha=1[scaledCoverPhoto]; [video][scaledCoverPhoto]overlay=:x=w/2:y=(H-h)/2 , subtitles=intro-INTRO-subtitle.ass:fontsdir=../../preview/fonts, format=yuv420p, scale=-2:494 " -shortest -map "[a]" -format hls -sn -hls_time 5 -strict -2 -vsync 2 -bufsize 1200k -hls_list_size 0 -g 4 -r 25 output/index.m3u8
输入 #2 没有淡入淡出,完全没有显示。我做错了什么?我花了好几个小时进行研究和试验。
请注意,第二条命令与第一条命令不同,只是通过添加的这一行format=rgba,fade=in:st=6:d=1:alpha=1
。
非常感谢!
第二条命令输出:
"Input #0, image2, from '6e81d7a2e2979f10c531af8276d8136f.jpg':\n" +
' Duration: 00:00:00.04, start: 0.000000, bitrate: 3201 kb/s\n' +
' Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 878x494 [SAR 96:96 DAR 439:247], 25 fps, 25 tbr, 25 tbn, 25 tbc\n' +
"Input #1, image2, from 'b28fd2813e9384353710402a9a450cd7.jpg':\n" +
' Duration: 00:00:00.04, start: 0.000000, bitrate: 6376 kb/s\n' +
' Stream #1:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 878x494 [SAR 96:96 DAR 439:247], 25 fps, 25 tbr, 25 tbn, 25 tbc\n' +
"Input #2, png_pipe, from 'bad861c0fd5f6a1e73b582749a56852b.jpg.png':\n" +
' Duration: N/A, bitrate: N/A\n' +
' Stream #2:0: Video: png, rgb24(pc), 431x514 [SAR 3779:3779 DAR 431:514], 25 fps, 25 tbr, 25 tbn, 25 tbc\n' +
'[mp3 @ 0x7fbaea819800] invalid concatenated file detected - using bitrate for duration\n' +
'[mp3 @ 0x7fbaea819800] Estimating duration from bitrate, this may be inaccurate\n' +
'1633189093.mp3: could not seek to position -0.975\n' +
"Input #3, mp3, from '1633189093.mp3':\n" +
' Metadata:\n' +
' encoder : Lavf58.76.100\n' +
' Duration: 00:14:57.93, start: 0.025057, bitrate: 128 kb/s\n' +
' Stream #3:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s\n' +
' Metadata:\n' +
' encoder : Lavf\n' +
'[Parsed_subtitles_18 @ 0x7fbae8f1c940] libass API version: 0x1501000\n' +
'[Parsed_subtitles_18 @ 0x7fbae8f1c940] libass source: tarball: 0.15.1\n' +
'[Parsed_subtitles_18 @ 0x7fbae8f1c940] Shaper: FriBidi 1.0.10 (SIMPLE) HarfBuzz-ng 2.8.2 (COMPLEX)\n' +
"[Parsed_subtitles_18 @ 0x7fbae8f1c940] Loading font file '../../preview/fonts/quicksand-bold.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbae8f1c940] Loading font file '../../preview/fonts/fjallaone-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbae8f1c940] Loading font file '../../preview/fonts/signika-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbae8f1c940] Loading font file '../../preview/fonts/lato-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbae8f1c940] Loading font file '../../preview/fonts/philosopher-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbae8f1c940] Loading font file '../../preview/fonts/quicksand-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbae8f1c940] Loading font file '../../preview/fonts/gentiumbasic-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbae8f1c940] Loading font file '../../preview/fonts/mavenpro-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbae8f1c940] Loading font file '../../preview/fonts/comingsoon-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbae8f1c940] Loading font file '../../preview/fonts/overlock-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbae8f1c940] Loading font file '../../preview/fonts/tangerine-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbae8f1c940] Loading font file '../../preview/fonts/gentiumbasic-italic.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbae8f1c940] Loading font file '../../preview/fonts/alegreya-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbae8f1c940] Loading font file '../../preview/fonts/dancingscript-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbae8f1c940] Loading font file '../../preview/fonts/courgette-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbae8f1c940] Loading font file '../../preview/fonts/opensans-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbae8f1c940] Loading font file '../../preview/fonts/lora-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbae8f1c940] Loading font file '../../preview/fonts/pontanosans-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbae8f1c940] Loading font file '../../preview/fonts/cambo-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbae8f1c940] Loading font file '../../preview/fonts/cantataone-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbae8f1c940] Loading font file '../../preview/fonts/greatvibes-regular.ttf'\n" +
'[Parsed_subtitles_18 @ 0x7fbae8f1c940] Using font provider coretext\n' +
"[Parsed_subtitles_18 @ 0x7fbae8f1c940] Track has custom format line(s). 'ScaledBorderAndShadow' will default to 'yes'.\n" +
"[Parsed_subtitles_18 @ 0x7fbae8f1c940] Track has custom format line(s). 'ScaledBorderAndShadow' will default to 'yes'.\n" +
'Codec AVOption format (set pixel type) specified for output file #0 (output/index.m3u8) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.\n' +
'Stream mapping:\n' +
' Stream #0:0 (mjpeg) -> scale\n' +
' Stream #1:0 (mjpeg) -> scale\n' +
' Stream #2:0 (png) -> scale\n' +
' Stream #3:0 (mp3float) -> afade\n' +
' scale -> Stream #0:0 (libx264)\n' +
' afade -> Stream #0:1 (aac)\n' +
'Press [q] to stop, [?] for help\n' +
'[Parsed_subtitles_18 @ 0x7fbaeb014340] libass API version: 0x1501000\n' +
'[Parsed_subtitles_18 @ 0x7fbaeb014340] libass source: tarball: 0.15.1\n' +
'[Parsed_subtitles_18 @ 0x7fbaeb014340] Shaper: FriBidi 1.0.10 (SIMPLE) HarfBuzz-ng 2.8.2 (COMPLEX)\n' +
"[Parsed_subtitles_18 @ 0x7fbaeb014340] Loading font file '../../preview/fonts/quicksand-bold.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbaeb014340] Loading font file '../../preview/fonts/fjallaone-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbaeb014340] Loading font file '../../preview/fonts/signika-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbaeb014340] Loading font file '../../preview/fonts/lato-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbaeb014340] Loading font file '../../preview/fonts/philosopher-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbaeb014340] Loading font file '../../preview/fonts/quicksand-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbaeb014340] Loading font file '../../preview/fonts/gentiumbasic-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbaeb014340] Loading font file '../../preview/fonts/mavenpro-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbaeb014340] Loading font file '../../preview/fonts/comingsoon-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbaeb014340] Loading font file '../../preview/fonts/overlock-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbaeb014340] Loading font file '../../preview/fonts/tangerine-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbaeb014340] Loading font file '../../preview/fonts/gentiumbasic-italic.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbaeb014340] Loading font file '../../preview/fonts/alegreya-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbaeb014340] Loading font file '../../preview/fonts/dancingscript-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbaeb014340] Loading font file '../../preview/fonts/courgette-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbaeb014340] Loading font file '../../preview/fonts/opensans-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbaeb014340] Loading font file '../../preview/fonts/lora-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbaeb014340] Loading font file '../../preview/fonts/pontanosans-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbaeb014340] Loading font file '../../preview/fonts/cambo-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbaeb014340] Loading font file '../../preview/fonts/cantataone-regular.ttf'\n" +
"[Parsed_subtitles_18 @ 0x7fbaeb014340] Loading font file '../../preview/fonts/greatvibes-regular.ttf'\n" +
'[Parsed_subtitles_18 @ 0x7fbaeb014340] Using font provider coretext\n' +
"[Parsed_subtitles_18 @ 0x7fbaeb014340] Track has custom format line(s). 'ScaledBorderAndShadow' will default to 'yes'.\n" +
"[Parsed_subtitles_18 @ 0x7fbaeb014340] Track has custom format line(s). 'ScaledBorderAndShadow' will default to 'yes'.\n" +
'[swscaler @ 0x7fbad8390000] deprecated pixel format used, make sure you did set range correctly\n' +
'[swscaler @ 0x7fbad8598000] deprecated pixel format used, make sure you did set range correctly\n' +
'[libx264 @ 0x7fbaec009000] VBV bufsize set but maxrate unspecified, ignored\n' +
'[libx264 @ 0x7fbaec009000] using SAR=1/1\n' +
'[libx264 @ 0x7fbaec009000] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2\n' +
'[libx264 @ 0x7fbaec009000] profile Constrained Baseline, level 3.1, 4:2:0, 8-bit\n' +
'[libx264 @ 0x7fbaec009000] 264 - core 163 r3060 5db6aa6 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=15 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=4 keyint_min=1 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=18.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0\n' +
"Output #0, hls, to 'output/index.m3u8':\n" +
' Metadata:\n' +
' encoder : Lavf58.76.100\n' +
' Stream #0:0: Video: h264, yuv420p(tv, bt470bg/unknown/unknown, progressive), 878x494 [SAR 1:1 DAR 439:247], q=2-31, 25 fps, 90k tbn (default)\n' +
' Metadata:\n' +
' encoder : Lavc58.134.100 libx264\n' +
' Side data:\n' +
' cpb: bitrate max/min/avg: 0/0/0 buffer size: 1200000 vbv_delay: N/A\n' +
' Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s (default)\n' +
' Metadata:\n' +
' encoder : Lavc58.134.100 aac\n' +
"frame= 1 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed= 0x \rframe= 33 fps=0.0 q=14.0 size=N/A time=00:00:01.23 bitrate=N/A speed=2.44x \rframe= 75 fps= 74 q=11.0 size=N/A time=00:00:02.90 bitrate=N/A speed=2.87x \rframe= 110 fps= 72 q=11.0 size=N/A time=00:00:04.29 bitrate=N/A speed=2.83x \r[hls @ 0x7fbaec008a00] Opening 'output/index0.ts' for writing\n" +
"[hls @ 0x7fbaec008a00] Opening 'output/index.m3u8.tmp' for writing\n" +
'frame= 146 fps= 72 q=11.0 size=N/A time=00:00:05.76 bitrate=N/A speed=2.85x \r[Parsed_subtitles_18 @ 0x7fbaeb014340] fontselect: (Arial, 400, 0) -> /System/Library/Fonts/Supplemental/Arial.ttf, -1, ArialMT\n' +
'[Parsed_subtitles_18 @ 0x7fbaeb014340] fontselect: (Open Sans, 400, 0) -> OpenSans-Regular, 0, OpenSans-Regular\n' +
'[Parsed_subtitles_18 @ 0x7fbaeb014340] fontselect: (Greate Vibes, 400, 0) -> /System/Library/Fonts/Helvetica.ttc, -1, Helvetica\n' +
"frame= 173 fps= 69 q=13.0 size=N/A time=00:00:06.85 bitrate=N/A speed=2.71x \rframe= 201 fps= 66 q=13.0 size=N/A time=00:00:07.94 bitrate=N/A speed=2.61x \rframe= 230 fps= 65 q=11.0 size=N/A time=00:00:09.10 bitrate=N/A speed=2.56x \rframe= 258 fps= 63 q=11.0 size=N/A time=00:00:10.21 bitrate=N/A speed=2.51x \r[hls @ 0x7fbaec008a00] Opening 'output/index1.ts' for writing\n" +
"[hls @ 0x7fbaec008a00] Opening 'output/index.m3u8.tmp' for writing\n" +
"frame= 287 fps= 63 q=10.0 size=N/A time=00:00:11.40 bitrate=N/A speed=2.49x \rframe= 314 fps= 62 q=11.0 size=N/A time=00:00:12.47 bitrate=N/A speed=2.45x \rframe= 342 fps= 61 q=11.0 size=N/A time=00:00:13.60 bitrate=N/A speed=2.43x \rframe= 372 fps= 61 q=15.0 size=N/A time=00:00:14.79 bitrate=N/A speed=2.42x \r[hls @ 0x7fbaec008a00] Opening 'output/index2.ts' for writing\n" +
"[hls @ 0x7fbaec008a00] Opening 'output/index.m3u8.tmp' for writing\n" +
"frame= 402 fps= 61 q=11.0 size=N/A time=00:00:16.00 bitrate=N/A speed=2.42x \rframe= 436 fps= 61 q=15.0 size=N/A time=00:00:17.34 bitrate=N/A speed=2.44x \rframe= 471 fps= 62 q=10.0 size=N/A time=00:00:18.74 bitrate=N/A speed=2.46x \rframe= 505 fps= 62 q=17.0 size=N/A time=00:00:20.11 bitrate=N/A speed=2.47x \r[hls @ 0x7fbaec008a00] Opening 'output/index3.ts' for writing\n" +
"[hls @ 0x7fbaec008a00] Opening 'output/index.m3u8.tmp' for writing\n" +
"frame= 536 fps= 62 q=17.0 size=N/A time=00:00:21.34 bitrate=N/A speed=2.47x \rframe= 572 fps= 62 q=17.0 size=N/A time=00:00:22.78 bitrate=N/A speed=2.49x \rframe= 608 fps= 63 q=17.0 size=N/A time=00:00:24.22 bitrate=N/A speed=2.51x \rframe= 636 fps= 63 q=17.0 size=N/A time=00:00:25.38 bitrate=N/A speed= 2.5x \r[hls @ 0x7fbaec008a00] Opening 'output/index4.ts' for writing\n" +
"[hls @ 0x7fbaec008a00] Opening 'output/index.m3u8.tmp' for writing\n" +
"frame= 665 fps= 62 q=15.0 size=N/A time=00:00:26.51 bitrate=N/A speed=2.48x \rframe= 694 fps= 62 q=13.0 size=N/A time=00:00:27.68 bitrate=N/A speed=2.47x \r[hls @ 0x7fbaec008a00] Opening 'output/index5.ts' for writing\n" +
"[hls @ 0x7fbaec008a00] Opening 'output/index.m3u8.tmp' for writing\n" +
'frame= 725 fps= 62 q=-1.0 Lsize=N/A time=00:00:29.00 bitrate=N/A speed=2.48x \n' +
'video:6428kB audio:436kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown\n' +
'[libx264 @ 0x7fbaec009000] frame I:182 Avg QP:10.92 size: 32343\n' +
'[libx264 @ 0x7fbaec009000] frame P:543 Avg QP:13.83 size: 1280\n' +
'[libx264 @ 0x7fbaec009000] mb I I16..4: 100.0% 0.0% 0.0%\n' +
'[libx264 @ 0x7fbaec009000] mb P I16..4: 4.7% 0.0% 0.0% P16..4: 9.4% 0.0% 0.0% 0.0% 0.0% skip:85.9%\n' +
'[libx264 @ 0x7fbaec009000] coded y,uvDC,uvAC intra: 77.6% 37.0% 27.4% inter: 3.1% 2.5% 0.0%\n' +
'[libx264 @ 0x7fbaec009000] i16 v,h,dc,p: 27% 30% 9% 34%\n' +
'[libx264 @ 0x7fbaec009000] i8c dc,h,v,p: 54% 24% 16% 6%\n' +
'[libx264 @ 0x7fbaec009000] kb/s:1815.52\n' +
'[aac @ 0x7fbaec012a00] Qavg: 1057.250\n' +
'\n' +
'real\t0m11.791s\n' +
'user\t0m13.176s\n' +
'sys\t0m0.540s'