我正在为 YouTube 制作将静态图像与 MP3 文件相结合的视频。出于某种原因,一些视频损坏(在下面的示例中 15 秒后)并导致灰屏。这是ffmpeg
我使用的命令:
ffmpeg.exe -loop 1 -i frame0043.png -i tts.mp3 -acodec copy -shortest -vf "subtitles=subs.srt:force_style='FontName=Poppins,FontSize=36,Bold=1',scale=1920:1080" video.mp4"
输出如下:
built with gcc 10.3.0 (Rev5, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
libavutil 57. 7.100 / 57. 7.100
libavcodec 59. 9.101 / 59. 9.101
libavformat 59. 5.100 / 59. 5.100
libavdevice 59. 0.101 / 59. 0.101
libavfilter 8. 9.100 / 8. 9.100
libswscale 6. 1.100 / 6. 1.100
libswresample 4. 0.100 / 4. 0.100
libpostproc 56. 0.100 / 56. 0.100
Input #0, png_pipe, from 'frame0028.png':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: png, rgb24(pc), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 25 tbn
[mp3 @ 000002c0a30b2980] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from 'tts.mp3':
Duration: 00:05:01.46, start: 0.000000, bitrate: 160 kb/s
Stream #1:0: Audio: mp3, 24000 Hz, mono, fltp, 160 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[Parsed_subtitles_0 @ 000002c0a33cdf00] libass API version: 0x1502000
[Parsed_subtitles_0 @ 000002c0a33cdf00] libass source: commit: 0.15.2-11-g4c3ace7cdcc740652331dbd57cc500b4ad50be81
[Parsed_subtitles_0 @ 000002c0a33cdf00] Shaper: FriBidi 1.0.11 (SIMPLE) HarfBuzz-ng 3.0.0 (COMPLEX)
[Parsed_subtitles_0 @ 000002c0a33cdf00] Using font provider directwrite (with GDI)
[libx264 @ 000002c0a245b400] using SAR=1/1
[libx264 @ 000002c0a245b400] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 000002c0a245b400] profile High 4:4:4 Predictive, level 4.0, 4:4:4, 8-bit
[libx264 @ 000002c0a245b400] 264 - core 164 r3065 ae03d92 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=4 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'video.mp4':
Metadata:
encoder : Lavf59.5.100
Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv444p(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 12800 tbn
Metadata:
encoder : Lavc59.9.101 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Stream #0:1: Audio: mp3 (mp4a / 0x6134706D), 24000 Hz, mono, fltp, 160 kb/s
[Parsed_subtitles_0 @ 000002c0a33cdf00] fontselect: (Poppins, 700, 0) -> Poppins-Bold, 0, Poppins-Bold
示例视频: https://www.youtube.com/watch?v=y7-hCObVKQU
您是否发现任何可能导致问题的异常情况?任何帮助都将不胜感激!