获取带字幕的视频的屏幕截图

时间:2017-10-21 18:29:36

标签: ffmpeg

我试图使用包含字幕的ffmpeg获取视频的单帧

  

ffmpeg -ss 00:09:18 -i movie.mkv -vf subtitles = subtitles.srt -vframes 1   screenshot.png

屏幕截图正在输出,但字幕不在图片上。

我是ffmpeg的新手,所以如果有人能帮助我,那就太棒了!

编辑:这是我得到的输出示例:

  

ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright(c)2000-2017 the   FFmpeg开发人员用gcc 5.4.0构建(Ubuntu   5.4.0-6ubuntu1~16.04.4)20160609配置: - prefix = / usr --extra-version = 0ubuntu0.16.04.1 --build-suffix = -ffmpeg --toolchain = hardened --libdir = / usr / lib / x86_64-linux-gnu --incdir = / usr / include / x86_64-linux-gnu --cc = cc --cxx = g ++ --enable-gpl --enable-shared --disable-stripping --disable- decoder = libopenjpeg --disable-decoder = libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libz vbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv libavutil 54. 31.100 / 54. 31.100 libavcodec 56. 60.100 / 56. 60.100 libavformat 56. 40.101 / 56. 40.101 libavdevice 56. 4.100 /   56. 4.100 libavfilter 5. 40.101 / 5. 40.101 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc 53. 3.100 /   53. 3.100 [aac @ 0xfe73c0]元素类型不匹配3!= 0 [aac @ 0xfe73c0]元素类型不匹配1!= 0       最后一条消息重复1次输入#0,matroska,webm,来自' Community.S01E01.720p.5.1Ch.Web-DL.ReEnc-DeeJayAhmed.mkv':
  元数据:       编码器:libebml v1.3.1 + libmatroska v1.4.2       creation_time:2015-10-16 19:35:27持续时间:00:25:25.15,开始:0.000000,比特率:1135 kb / s       流#0:0:视频:h264(高),yuv420p,1280x720 [SAR 1:1 DAR 16:9],23.98 fps,23.98 tbr,1k tbn,47.95 tbc(默认值)       元数据:         BPS:947111         BPS-eng:947111         持续时间:00:25:25.107000000         DURATION-eng:00:25:25.107000000         NUMBER_OF_FRAMES:36566         NUMBER_OF_FRAMES-eng:36566         NUMBER_OF_BYTES:180555811         NUMBER_OF_BYTES-eng:180555811         _STATISTICS_WRITING_APP:mkvmerge v8.4.0('更好的飞行方式')32bit         _STATISTICS_WRITING_APP-eng:mkvmerge v8.4.0('更好的飞行方式')32bit         _STATISTICS_WRITING_DATE_UTC:2015-10-16 19:35:27         _STATISTICS_WRITING_DATE_UTC-eng:2015-10-16 19:35:27         _STATISTICS_TAGS:BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES         _STATISTICS_TAGS-eng:BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES       流#0:1(eng):音频:aac(HE-AAC),48000 Hz,5.1,fltp(默认)       元数据:         BPS:186250         BPS-eng:186250         持续时间:00:25:25.120000000         DURATION-eng:00:25:25.120000000         NUMBER_OF_FRAMES:35745         NUMBER_OF_FRAMES-eng:35745         NUMBER_OF_BYTES:35506701         NUMBER_OF_BYTES-eng:35506701         _STATISTICS_WRITING_APP:mkvmerge v8.4.0('更好的飞行方式')32bit         _STATISTICS_WRITING_APP-eng:mkvmerge v8.4.0('更好的飞行方式')32bit         _STATISTICS_WRITING_DATE_UTC:2015-10-16 19:35:27         _STATISTICS_WRITING_DATE_UTC-eng:2015-10-16 19:35:27         _STATISTICS_TAGS:BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES         _STATISTICS_TAGS-eng:BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES [Parsed_subtitles_0 @ 0x106ce60]塑造者:FriBidi   0.19.7(SIMPLE)HarfBuzz-ng 1.0.1(COMPLEX)[Parsed_subtitles_0 @ 0x106ce60]使用字体提供程序fontconfig输出#0,image2到   ' screenshot.png':元数据:       编码器:Lavf56.40.101       流#0:0:视频:png,rgb24,1280x720 [SAR 1:1 DAR 16:9],q = 2-31,200 kb / s,23.98 fps,23.98 tbn,23.98 tbc(默认值)       元数据:         BPS:947111         BPS-eng:947111         持续时间:00:25:25.107000000         DURATION-eng:00:25:25.107000000         NUMBER_OF_FRAMES:36566         NUMBER_OF_FRAMES-eng:36566         NUMBER_OF_BYTES:180555811         NUMBER_OF_BYTES-eng:180555811         _STATISTICS_WRITING_APP:mkvmerge v8.4.0('更好的飞行方式')32bit         _STATISTICS_WRITING_APP-eng:mkvmerge v8.4.0('更好的飞行方式')32bit         _STATISTICS_WRITING_DATE_UTC:2015-10-16 19:35:27         _STATISTICS_WRITING_DATE_UTC-eng:2015-10-16 19:35:27         _STATISTICS_TAGS:BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES         _STATISTICS_TAGS-eng:BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES         编码器:Lavc56.60.100 png流映射:流#0:0 - > #0:0(h264(原生) - > png(原生))按[q]停止,[?]表示帮助帧= 1 fps = 0.0 q = -0.0 Lsize = N / A time = 00:00: 00.04   比特率= N / A视频:1109kB音频:0kB字幕:0kB其他流:0kB   全局标头:0kB多路复用开销:未知

1 个答案:

答案 0 :(得分:2)

应添加-copyts选项。

ffmpeg -ss 00:09:18 -copyts -i movie.mkv -vf subtitles=subtitles.srt -vframes 1 screenshot.png

字幕过滤器依赖于输入时间戳来知道何时叠加字幕,但快速搜索(-ss之前的-i)在将剪切部分的时间戳传递给字幕过滤器之前重置它的时间戳。