将 mkv 重新编码为 mp4,仅带强制字幕

将 mkv 重新编码为 mp4,仅带强制字幕

我之前问过类似的问题,但我无法让它工作,而且由于这是一篇旧帖子,所以我正在重试。我想从 mkv 转换为 mp4,因为我的许多播放器都无法播放 mkv。要么他们无法播放,要么即使我不想播放字幕也会播放。我想要的是音频是不同语言的英语字幕。这是我的基本代码,其中包含一个不起作用的字幕命令:for %i in (*.mkv) do (ffmpeg -i "%i" -acodec aac -vcodec h264 -sn -filter_complex [0:v:0][0:2]overlay "%~ni".mp4)。在我处理的文件中,[0:2] 是当人们说英语以外的语言时强制使用的英语字幕。我做错了什么?

C:\Users\Michael\Videos\Recode\ffmpeg>ffmpeg -i test.mkv
ffmpeg version N-86935-g44e9783 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7.1.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
  libavutil      55. 69.101 / 55. 69.101
  libavcodec     57.102.100 / 57.102.100
  libavformat    57. 76.100 / 57. 76.100
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 97.100 /  6. 97.100
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
Input #0, matroska,webm, from 'test.mkv':
  Metadata:
    encoder         : libebml v1.3.6 + libmatroska v1.4.9
    creation_time   : 2019-03-29T07:06:21.000000Z
  Duration: 00:31:04.35, start: 0.000000, bitrate: 1067 kb/s
    Stream #0:0: Video: h264 (Main), yuv420p(progressive), 720x480 [SAR 32:27 DAR 16:9], SAR 186:157 DAR 279:157, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Metadata:
      BPS-eng         : 934691
      DURATION-eng    : 00:31:04.279000000
      NUMBER_OF_FRAMES-eng: 44698
      NUMBER_OF_BYTES-eng: 217815803
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-29 07:06:21
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1(eng): Audio: eac3, 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      BPS-eng         : 128000
      DURATION-eng    : 00:31:04.352000000
      NUMBER_OF_FRAMES-eng: 58261
      NUMBER_OF_BYTES-eng: 29829632
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-29 07:06:21
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:2(eng): Subtitle: subrip (default) (forced)
    Metadata:
      title           : Forced
      BPS-eng         : 41
      DURATION-eng    : 00:02:36.948000000
      NUMBER_OF_FRAMES-eng: 35
      NUMBER_OF_BYTES-eng: 823
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-29 07:06:21
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:3(eng): Subtitle: subrip
    Metadata:
      BPS-eng         : 95
      DURATION-eng    : 00:30:24.197000000
      NUMBER_OF_FRAMES-eng: 642
      NUMBER_OF_BYTES-eng: 21729
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-29 07:06:21
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:4(por): Subtitle: subrip
    Metadata:
      title           : Brazilian
      BPS-eng         : 87
      DURATION-eng    : 00:29:03.992000000
      NUMBER_OF_FRAMES-eng: 568
      NUMBER_OF_BYTES-eng: 19031
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-29 07:06:21
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:5(dan): Subtitle: subrip
    Metadata:
      BPS-eng         : 86
      DURATION-eng    : 00:30:25.990000000
      NUMBER_OF_FRAMES-eng: 603
      NUMBER_OF_BYTES-eng: 19683
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-29 07:06:21
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:6(dut): Subtitle: subrip
    Metadata:
      BPS-eng         : 82
      DURATION-eng    : 00:30:25.990000000
      NUMBER_OF_FRAMES-eng: 583
      NUMBER_OF_BYTES-eng: 18840
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-29 07:06:21
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:7(spa): Subtitle: subrip
    Metadata:
      title           : European
      BPS-eng         : 72
      DURATION-eng    : 00:30:25.990000000
      NUMBER_OF_FRAMES-eng: 601
      NUMBER_OF_BYTES-eng: 16596
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-29 07:06:21
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:8(fin): Subtitle: subrip
    Metadata:
      BPS-eng         : 78
      DURATION-eng    : 00:30:25.990000000
      NUMBER_OF_FRAMES-eng: 489
      NUMBER_OF_BYTES-eng: 17999
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-29 07:06:21
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:9(fre): Subtitle: subrip
    Metadata:
      BPS-eng         : 92
      DURATION-eng    : 00:30:25.990000000
      NUMBER_OF_FRAMES-eng: 604
      NUMBER_OF_BYTES-eng: 21149
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-29 07:06:21
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:10(ger): Subtitle: subrip
    Metadata:
      BPS-eng         : 81
      DURATION-eng    : 00:30:25.990000000
      NUMBER_OF_FRAMES-eng: 544
      NUMBER_OF_BYTES-eng: 18539
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-29 07:06:21
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:11(gre): Subtitle: subrip
    Metadata:
      BPS-eng         : 131
      DURATION-eng    : 00:30:25.990000000
      NUMBER_OF_FRAMES-eng: 606
      NUMBER_OF_BYTES-eng: 30026
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-29 07:06:21
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:12(ind): Subtitle: subrip
    Metadata:
      BPS-eng         : 88
      DURATION-eng    : 00:30:17.232000000
      NUMBER_OF_FRAMES-eng: 598
      NUMBER_OF_BYTES-eng: 20099
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-29 07:06:21
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:13(ita): Subtitle: subrip
    Metadata:
      BPS-eng         : 76
      DURATION-eng    : 00:30:23.488000000
      NUMBER_OF_FRAMES-eng: 593
      NUMBER_OF_BYTES-eng: 17422
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-29 07:06:21
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:14(nob): Subtitle: subrip
    Metadata:
      BPS-eng         : 79
      DURATION-eng    : 00:30:25.990000000
      NUMBER_OF_FRAMES-eng: 603
      NUMBER_OF_BYTES-eng: 18149
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-29 07:06:21
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:15(pol): Subtitle: subrip
    Metadata:
      BPS-eng         : 76
      DURATION-eng    : 00:30:25.990000000
      NUMBER_OF_FRAMES-eng: 557
      NUMBER_OF_BYTES-eng: 17428
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-29 07:06:21
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:16(por): Subtitle: subrip
    Metadata:
      BPS-eng         : 85
      DURATION-eng    : 00:30:25.990000000
      NUMBER_OF_FRAMES-eng: 595
      NUMBER_OF_BYTES-eng: 19531
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-29 07:06:21
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:17(spa): Subtitle: subrip
    Metadata:
      BPS-eng         : 81
      DURATION-eng    : 00:30:25.990000000
      NUMBER_OF_FRAMES-eng: 593
      NUMBER_OF_BYTES-eng: 18649
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-29 07:06:21
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:18(swe): Subtitle: subrip
    Metadata:
      BPS-eng         : 90
      DURATION-eng    : 00:30:25.990000000
      NUMBER_OF_FRAMES-eng: 603
      NUMBER_OF_BYTES-eng: 20666
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-29 07:06:21
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:19(tur): Subtitle: subrip
    Metadata:
      BPS-eng         : 92
      DURATION-eng    : 00:30:25.990000000
      NUMBER_OF_FRAMES-eng: 605
      NUMBER_OF_BYTES-eng: 21212
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-29 07:06:21
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
At least one output file must be specified

答案1

您可以使用字幕过滤器刻录基于文本的字幕流:

ffmpeg -i file -acodec aac -vcodec h264 -sn -filter_complex subtitles=f=file:si=2 out.mp4

请参阅字幕过滤器的文档:http://ffmpeg.org/ffmpeg-filters.html#subtitles-1

相关内容