mpvを使用してメディアファイルに複数のオーディオトラックがある場合は、オーディオトラックを選択する方法は?

mpvを使用してメディアファイルに複数のオーディオトラックがある場合は、オーディオトラックを選択する方法は?

マイメディアファイル(ビデオ+オーディオ)には複数のオーディオトラックが含まれています。たとえば、見てみましょう——

 $ mediainfo somefile.mkv

General
Unique ID                                : xxxxxxxxxxxxxxxxxxxxxxxx
Complete name                            : somefile.mkv
Format                                   : Matroska
Format version                           : Version 4 / Version 2
File size                                : 1.35 GiB
Duration                                 : 2h 26mn
Overall bit rate                         : 1 314 Kbps
Movie name                               : somefile
Encoded date                             : UTC 2016-09-04 00:00:15
Writing application                      : mkvmerge v8.8.0 ('Wind at my back') 64bit
Writing library                          : libebml v1.3.3 + libmatroska v1.4.4
Cover                                    : Yes
Attachments                              : Cover.jpg

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : [email protected]
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 2h 26mn
Bit rate                                 : 1 024 Kbps
Width                                    : 1 280 pixels
Height                                   : 544 pixels
Display aspect ratio                     : 2.35:1
Frame rate mode                          : Constant
Frame rate                               : 24.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.061
Stream size                              : 1.05 GiB (78%)
Title                                    : somefile
Writing library                          : x264 core 142 r2479 dd79a61
Encoding settings                        : cabac=1 / ref=3 / deblock=1:-1:-1 / analyse=0x3:0x113 / me=umh / subme=10 / psy=1 / psy_rd=0.00:0.00 / mixed_ref=1 / me_range=32 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=0 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=2pass / mbtree=1 / bitrate=1024 / ratetol=1.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:1.00
Language                                 : Tamil
Default                                  : Yes
Forced                                   : No

Audio #1
ID                                       : 2
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Format profile                           : Dolby Digital
Mode extension                           : CM (complete main)
Format settings, Endianness              : Big
Codec ID                                 : A_AC3
Duration                                 : 2h 26mn
Bit rate mode                            : Constant
Bit rate                                 : 224 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 KHz
Frame rate                               : 31.250 fps (1536 spf)
Compression mode                         : Lossy
Stream size                              : 235 MiB (17%)
Title                                    : somefile
Language                                 : Hindi
Default                                  : Yes
Forced                                   : No

Audio #2
ID                                       : 3
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : HE-AAC / LC
Codec ID                                 : A_AAC
Duration                                 : 2h 26mn
Bit rate                                 : 64.0 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 KHz / 24.0 KHz
Frame rate                               : 23.438 fps (1024 spf)
Compression mode                         : Lossy
Stream size                              : 67.1 MiB (5%)
Title                                    : somefile
Language                                 : Tamil
Default                                  : No
Forced                                   : No

プライバシーと不要な理由でメディアファイルの一意のIDと名前を削除しました。 mediainfoに見られるように、2つのオーディオトラックがあり、1つはヒンディー語、もう1つはタミル語です。デフォルトでは、ヒンディー語トラックはデフォルト値なので、タミル語トラックが必要な場合はどうなりますか?どうやってプレイできますか?

ベストアンサー1

MPVは--aidマニュアルで以下を提供します。

--aid=<ID|auto|no>
       Select audio track. auto selects the default, no disables audio.  See  also  --alang.  mpv  normally  prints
       available audio tracks on the terminal when starting playback of a file.

はい、--aid=1ヒンディー語とタミル語になります--aid=2

--alangまた、言語コードを認識できる必要があります。

  • --alang=hinそのようなトラックがあれば、ヒンディー語で再生する必要があります。
  • --alang=tamタミル語が可能な場合は、タミル語で遊ぶ必要があります
  • そして--alange=tam,hinタミル語を演奏することが可能でなければならず、そうでなければヒンディー語トラックを見つけようとしなければなりません。

メモ:

  • ffprobe言語コードを印刷します(mediainfo言語全体を印刷するのと同じ)。
  • --sid字幕もあります--slang

おすすめ記事