如何指定多个 ffmpeg 流说明符元数据标签键?

如何指定多个 ffmpeg 流说明符元数据标签键?

如何指定多个流说明符元数据标签键?

例如,这将视频从输入复制到输出,并且仅选择英语的音轨(有两个,一个是单声道,另一个是立体声):

ffmpeg -i "s1950e15 What's up Doc.mkv" -map 0:a:m:language:eng -map 0:v -c:v copy test.mkv

类似地,这会将视频从输入复制到输出,并且仅选择单声道的音轨(有两个,一个是英语,一个是法语):

ffmpeg -i "s1950e15 What's up Doc.mkv" -map 0:a:m:title:Mono -map 0:v -c:v copy test.mkv

但是我如何选择一个英语和单声道的音轨?

如果它是有效的(它不是),这就是我想要做的:

ffmpeg -i "s1950e15 What's up Doc.mkv" -map 0:a:m:language:eng:m:title:Mono -map 0:v -c:v copy test.mkv

我尝试了上述方法和各种组合,但均无效。

这是 ffmpeg 的输出:

Input #0, matroska,webm, from 's1950e15 What's up Doc.mkv':
  Metadata:
    encoder         : libmakemkv v1.16.7 (1.3.10/1.5.2) win(x64-release)
    creation_time   : 2022-05-05T00:52:29.000000Z
  Duration: 00:07:15.80, start: 0.000000, bitrate: 3853 kb/s
  Stream #0:0(eng): Video: mpeg2video (Main), yuv420p(tv, progressive), 720x480 [SAR 8:9 DAR 4:3], 29.97 fps, 29.97 tbr, 1k tbn
    Metadata:
      BPS-eng         : 3070452
      DURATION-eng    : 00:07:15.802033333
      NUMBER_OF_FRAMES-eng: 10449
      NUMBER_OF_BYTES-eng: 167263690
      SOURCE_ID-eng   : 0100E0
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.16.7 win(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2022-05-05 00:52:29
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
    Side data:
      cpb: bitrate max/min/avg: 7500000/0/0 buffer size: 1835008 vbv_delay: N/A
  Stream #0:1(eng): Audio: ac3, 48000 Hz, mono, fltp, 192 kb/s (default)
    Metadata:
      title           : Mono
      BPS-eng         : 192000
      DURATION-eng    : 00:07:15.776000000
      NUMBER_OF_FRAMES-eng: 13618
      NUMBER_OF_BYTES-eng: 10458624
      SOURCE_ID-eng   : 0180BD
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.16.7 win(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2022-05-05 00:52:29
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
  Stream #0:2(fre): Audio: ac3, 48000 Hz, mono, fltp, 192 kb/s
    Metadata:
      title           : Mono
      BPS-eng         : 192000
      DURATION-eng    : 00:07:15.776000000
      NUMBER_OF_FRAMES-eng: 13618
      NUMBER_OF_BYTES-eng: 10458624
      SOURCE_ID-eng   : 0181BD
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.16.7 win(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2022-05-05 00:52:29
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
  Stream #0:3(eng): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Metadata:
      title           : Stereo
      BPS-eng         : 192000
      DURATION-eng    : 00:07:15.776000000
      NUMBER_OF_FRAMES-eng: 13618
      NUMBER_OF_BYTES-eng: 10458624
      SOURCE_ID-eng   : 0183BD
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.16.7 win(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2022-05-05 00:52:29
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
  Stream #0:4(eng): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Metadata:
      title           : Stereo
      BPS-eng         : 192000
      DURATION-eng    : 00:07:15.776000000
      NUMBER_OF_FRAMES-eng: 13618
      NUMBER_OF_BYTES-eng: 10458624
      SOURCE_ID-eng   : 0185BD
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.16.7 win(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2022-05-05 00:52:29
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
  Stream #0:5(eng): Subtitle: dvd_subtitle, 720x480 (default)
    Metadata:
      BPS-eng         : 2609
      DURATION-eng    : 00:06:17.441033333
      NUMBER_OF_FRAMES-eng: 58
      NUMBER_OF_BYTES-eng: 123096
      SOURCE_ID-eng   : 0120BD
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.16.7 win(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2022-05-05 00:52:29
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
  Stream #0:6(fre): Subtitle: dvd_subtitle, 720x480
    Metadata:
      BPS-eng         : 2755
      DURATION-eng    : 00:06:55.912800000
      NUMBER_OF_FRAMES-eng: 62
      NUMBER_OF_BYTES-eng: 143280
      SOURCE_ID-eng   : 0121BD
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.16.7 win(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2022-05-05 00:52:29
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
  Stream #0:7(spa): Subtitle: dvd_subtitle, 720x480
    Metadata:
      BPS-eng         : 2704
      DURATION-eng    : 00:06:55.912800000
      NUMBER_OF_FRAMES-eng: 64
      NUMBER_OF_BYTES-eng: 140580
      SOURCE_ID-eng   : 0122BD
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.16.7 win(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2022-05-05 00:52:29
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
  Stream #0:8(eng): Subtitle: subrip
    Metadata:
      BPS-eng         : 150
      DURATION-eng    : 00:06:30.488000000
      NUMBER_OF_FRAMES-eng: 129
      NUMBER_OF_BYTES-eng: 7356
      SOURCE_ID-eng   : 0100E0
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.16.7 win(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2022-05-05 00:52:29
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID

答案1

目前,ffmpeg 仅检查指定的第一个元数据值。我将把它放在我的 ToDo 上以允许进一步的键。

答案2

ffmpeg 确实有一个功能,您可以手动设置要合并到视频文件中的元数据。

ffmpeg -i oldfile.mp4 -codec copy -metadata title="" -metadata album="" -metadata year="" -metadata container="" -metadata artist="" -metadata comment="" newfile.mp4

  1. 您可以为每个元数据输入所需的变量""。例如 -metadata title="Favorite Memory" -metadata comment="my vacation trip in 2022"

  2. 不要尝试从同一个文件中删除元数据,而是运行 ffmpeg 来使用您喜欢的元数据制作新副本(确保在为新文件运行 ffmpeg 后删除旧文件)

  3. 使用-codec copy函数很重要,因为它告诉 ffmpeg 仅复制文件并将数据添加到元数据中以合并到新文件中。

相关内容