ffmpeg 没有设置音频语言

ffmpeg 没有设置音频语言

我有一个 DVD 的 VOB 文件需要备份。它包含一个视频流和几个音频流。我已确定流 4 是英语,流 5 是法语,流 6 是西班牙语。

我已完成以下操作来设置曲目语言:

ffmpeg -i xxx.vob \
  -vf yadif -map 0:0 -codec:v libx265 -crf 22 \
  -codec:s copy \
  -map 0:4 -metadata:s:a:4 language=eng \
  -map 0:5 -metadata:s:a:5 language=fra \
  -map 0:6 -metadata:s:a:6 language=spa \
  -ss 600 \
  xxx.mkv

输入和映射如下:

Input #0, mpeg, from 'xxx.vob':
  Duration: 00:40:48.96, start: 0.280633, bitrate: 16817 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, progressive), 720x480 [SAR 32:27 DAR 16:9], Closed Captions, 33 fps, 59.94 tbr, 90k tbn, 59.94 tbc
    Side data:
      cpb: bitrate max/min/avg: 9800000/0/0 buffer size: 1835008 vbv_delay: N/A
    Stream #0:1[0x23]: Subtitle: dvd_subtitle
    Stream #0:2[0x24]: Subtitle: dvd_subtitle
    Stream #0:3[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:4[0x81]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:5[0x82]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:6[0x83]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:7[0x84]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> hevc (libx265))
  Stream #0:4 -> #0:1 (ac3 (native) -> vorbis (libvorbis))
  Stream #0:5 -> #0:2 (ac3 (native) -> vorbis (libvorbis))
  Stream #0:6 -> #0:3 (ac3 (native) -> vorbis (libvorbis))

正如您所见,没有语言。

尽管我指定了语言,但输出并未表明语言-metadata

Output #0, matroska, to 'xxx.mkv':
  Metadata:
    encoder         : Lavf58.45.100
    Stream #0:0: Video: hevc (libx265), yuv420p, 720x480 [SAR 32:27 DAR 16:9], q=-1--1, 29.97 fps, 1k tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc58.91.100 libx265
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
    Stream #0:1: Audio: vorbis (libvorbis) (oV[0][0] / 0x566F), 48000 Hz, 5.1(side), fltp
    Metadata:
      encoder         : Lavc58.91.100 libvorbis
    Stream #0:2: Audio: vorbis (libvorbis) (oV[0][0] / 0x566F), 48000 Hz, 5.1(side), fltp
    Metadata:
      encoder         : Lavc58.91.100 libvorbis
    Stream #0:3: Audio: vorbis (libvorbis) (oV[0][0] / 0x566F), 48000 Hz, 5.1(side), fltp
    Metadata:
      encoder         : Lavc58.91.100 libvorbis

在 VLC 中打开时,音轨被称为“轨道 1”、“轨道 2”等:

音轨的 VLC 屏幕截图

为什么 ffmpeg 没有将语言设置为我设置的内容?我检查了一下,它们是 ISO639-2

我花了 10 分钟去人们交谈的地方来确认语言。

这是 lsdvd 的音轨输出:

$ lsdvd -a -t 20
Disc Title: xxx
Title: 20, Length: 01:28:18.633 Chapters: 37, Cells: 38, Audio streams: 05, Subpictures: 05
        Audio: 1, Language: en - English, Format: ac3, Frequency: 48000, Quantization: drc, Channels: 6, AP: 0, Content: Undefined, Stream id: 0x80
        Audio: 2, Language: en - English, Format: ac3, Frequency: 48000, Quantization: drc, Channels: 6, AP: 0, Content: Undefined, Stream id: 0x81
        Audio: 3, Language: fr - Francais, Format: ac3, Frequency: 48000, Quantization: drc, Channels: 6, AP: 0, Content: Undefined, Stream id: 0x82
        Audio: 4, Language: es - Espanol, Format: ac3, Frequency: 48000, Quantization: drc, Channels: 6, AP: 0, Content: Undefined, Stream id: 0x83
        Audio: 5, Language: en - English, Format: ac3, Frequency: 48000, Quantization: drc, Channels: 2, AP: 0, Content: Comments1, Stream id: 0x84

答案1

好的,事实证明元数据语法适用于输出流 ID,而不是输入:

-map 0:<source ID> -metadata:s:a:<output ID> language=xxx

证明:

ffmpeg -i xxx.vob \
  -vf yadif -map 0:0 -codec:v libx265 -crf 22 \
  -codec:s copy \
  -map 0:4 -metadata:s:a:0 language=eng \
  -map 0:5 -metadata:s:a:1 language=fre \
  -map 0:6 -metadata:s:a:2 language=spa \
  -ss 600 \
  xxx.mkv

结果

Input #0, mpeg, from 'xxx.vob':
  Duration: 00:40:48.96, start: 0.280633, bitrate: 16817 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, progressive), 720x480 [SAR 32:27 DAR 16:9], Closed Captions, 33 fps, 59.94 tbr, 90k tbn, 59.94 tbc
    Side data:
      cpb: bitrate max/min/avg: 9800000/0/0 buffer size: 1835008 vbv_delay: N/A
    Stream #0:1[0x23]: Subtitle: dvd_subtitle
    Stream #0:2[0x24]: Subtitle: dvd_subtitle
    Stream #0:3[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:4[0x81]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:5[0x82]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:6[0x83]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:7[0x84]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
[...]
Output #0, matroska, to 'xxx.mkv':
  Metadata:
    encoder         : Lavf58.45.100
    Stream #0:0: Video: hevc (libx265), yuv420p, 720x480 [SAR 32:27 DAR 16:9], q=-1--1, 29.97 fps, 1k tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc58.91.100 libx265
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
    Stream #0:1(eng): Audio: vorbis (libvorbis) (oV[0][0] / 0x566F), 48000 Hz, 5.1(side), fltp
    Metadata:
      encoder         : Lavc58.91.100 libvorbis
    Stream #0:2(fre): Audio: vorbis (libvorbis) (oV[0][0] / 0x566F), 48000 Hz, 5.1(side), fltp
    Metadata:
      encoder         : Lavc58.91.100 libvorbis
    Stream #0:3(spa): Audio: vorbis (libvorbis) (oV[0][0] / 0x566F), 48000 Hz, 5.1(side), fltp
    Metadata:
      encoder         : Lavc58.91.100 libvorbis

在播放器中

VLC 屏幕截图

相关内容