Audio Track via Command Line: Broke for 12 Years
Posted: 19 Jan 2017 23:16
Ok, first off, let me say I love VLC. But it has a bug with setting audio and subtitles via the command line, and it is a problem that has been going on for over a decade. In researching the problem on this forum, I found all these posts talking about the issue, and the problem was never resolved:
https://forum.videolan.org/viewtopic.php?t=108870
https://forum.videolan.org/viewtopic.php?t=63825
https://forum.videolan.org/viewtopic.php?t=115954
https://forum.videolan.org/viewtopic.php?t=12067
https://forum.videolan.org/viewtopic.php?t=96757
Specifically, here is what I have experienced myself. I have written some simple batch files that load bluray .ISO files that I ripped using AnyDVD. The batch files mount the .ISO (for example, Captain America Civil War), then call VLC from the command line to run the movie from the virtual drive. The movie mounts and plays nicely, but the audio track always loads with track #2, the director's commentary, no matter what settings I try. The audio track I would like to use is track #1, which is the standard English soundtrack for the movie.
I have tried (I think) just about every conceivable combination of --audio-track and --audio-track-id switches. I tried 1 and -1, -1 and 1, and basically every integer from -1 to 10, and always, there are two possible results. Either track #2 is loaded, or the audio track is disabled. Very frustrating, because I am so close to having a very nice way to play my ripped bluray discs via VLC's command line interface. But it is basically useless if the command cannot effectively start the movie with the right audio track.
Here's an example of the batch file I have tried:
.\vcdmount.exe /l=f ..\BluRay\CAPTAIN_AMERICA_CIVIL_WAR.iso
SLEEP 6
"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --audio-track=-1 --audio-track-id=1 bluray:///F:/ --fullscreen
Like I say, it works perfectly, other than it just won't set the audio track right, no matter what I try. I also messed around with trying to set the subtitles via command line, and ran into a similar problem.
And FYI: I've used the VLC "Codec Info" to look up the IDs for the audio tracks, and also tried the third-party MediaInfo tool, and looked at the ID information in the audio streams. Here is the data that MediaInfo shows:
General
ID : 0 (0x0)
Complete name : F:\BDMV\STREAM\00300.m2ts
Format : BDAV
Format/Info : Blu-ray Video
File size : 33.7 GiB
Duration : 2 h 27 min
Overall bit rate mode : Variable
Overall bit rate : 32.6 Mb/s
Maximum Overall bit rate : 48.0 Mb/s
Video
ID : 4113 (0x1011)
Menu ID : 1 (0x1)
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.1
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Format settings, GOP : M=3, N=12
Codec ID : 27
Duration : 2 h 27 min
Bit rate mode : Variable
Maximum bit rate : 35.0 Mb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Audio #1
ID : 4352 (0x1100)
Menu ID : 1 (0x1)
Format : DTS
Format/Info : Digital Theater Systems
Format profile : MA / Core
Mode : 16
Format settings, Endianness : Big
Muxing mode : Stream extension
Codec ID : 134
Duration : 2 h 27 min
Bit rate mode : Variable / Constant
Bit rate : Unknown / 1 509 kb/s
Channel(s) : 8 channels / 6 channels
Channel positions : Front: L C R, Side: L R, Back: L R, LFE / Front: L C R, Side: L R, LFE
Sampling rate : 48.0 kHz
Frame rate : 93.750 FPS (512 spf)
Bit depth : 24 bits
Compression mode : Lossless / Lossy
Audio #2
ID : 4353 (0x1101)
Menu ID : 1 (0x1)
Format : AC-3
Format/Info : Audio Coding 3
Format profile : Dolby Digital
Mode extension : CM (complete main)
Format settings, Endianness : Big
Codec ID : 129
Duration : 2 h 27 min
Bit rate mode : Constant
Bit rate : 320 kb/s
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 kHz
Frame rate : 31.250 FPS (1536 spf)
Bit depth : 16 bits
Compression mode : Lossy
Stream size : 338 MiB (1%)
Audio #3
ID : 4354 (0x1102)
Menu ID : 1 (0x1)
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Format settings, Endianness : Big
Codec ID : 129
Duration : 2 h 27 min
Bit rate mode : Constant
Bit rate : 640 kb/s
Channel(s) : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 kHz
Frame rate : 31.250 FPS (1536 spf)
Bit depth : 16 bits
Compression mode : Lossy
Stream size : 676 MiB (2%)
Audio #4
ID : 4355 (0x1103)
Menu ID : 1 (0x1)
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Format settings, Endianness : Big
Codec ID : 129
Duration : 2 h 27 min
Bit rate mode : Constant
Bit rate : 640 kb/s
Channel(s) : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 kHz
Frame rate : 31.250 FPS (1536 spf)
Bit depth : 16 bits
Compression mode : Lossy
Stream size : 676 MiB (2%)
Audio #5
ID : 4356 (0x1104)
Menu ID : 1 (0x1)
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Format settings, Endianness : Big
Codec ID : 129
Duration : 2 h 27 min
Bit rate mode : Constant
Bit rate : 192 kb/s
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 kHz
Frame rate : 31.250 FPS (1536 spf)
Bit depth : 16 bits
Compression mode : Lossy
Stream size : 203 MiB (1%)
Text #1
ID : 4608 (0x1200)
Menu ID : 1 (0x1)
Format : PGS
Codec ID : 144
Text #2
ID : 4609 (0x1201)
Menu ID : 1 (0x1)
Format : PGS
Codec ID : 144
Text #3
ID : 4610 (0x1202)
Menu ID : 1 (0x1)
Format : PGS
Codec ID : 144
Text #4
ID : 4611 (0x1203)
Menu ID : 1 (0x1)
Format : PGS
Codec ID : 144
Duration : 2 h 27 min
Delay relative to video : 8 s 967 ms
Text #5
ID : 4612 (0x1204)
Menu ID : 1 (0x1)
Format : PGS
Codec ID : 144
Text #6
ID : 4613 (0x1205)
Menu ID : 1 (0x1)
Format : PGS
Codec ID : 144
Text #7
ID : 4614 (0x1206)
Menu ID : 1 (0x1)
Format : PGS
Codec ID : 144
Text #8
ID : 4615 (0x1207)
Menu ID : 1 (0x1)
Format : PGS
Codec ID : 144
Duration : 2 h 27 min
Delay relative to video : 8 s 967 ms
Text #9
ID : 4616 (0x1208)
Menu ID : 1 (0x1)
Format : PGS
Codec ID : 144
Duration : 2 h 27 min
Delay relative to video : 8 s 967 ms
https://forum.videolan.org/viewtopic.php?t=108870
https://forum.videolan.org/viewtopic.php?t=63825
https://forum.videolan.org/viewtopic.php?t=115954
https://forum.videolan.org/viewtopic.php?t=12067
https://forum.videolan.org/viewtopic.php?t=96757
Specifically, here is what I have experienced myself. I have written some simple batch files that load bluray .ISO files that I ripped using AnyDVD. The batch files mount the .ISO (for example, Captain America Civil War), then call VLC from the command line to run the movie from the virtual drive. The movie mounts and plays nicely, but the audio track always loads with track #2, the director's commentary, no matter what settings I try. The audio track I would like to use is track #1, which is the standard English soundtrack for the movie.
I have tried (I think) just about every conceivable combination of --audio-track and --audio-track-id switches. I tried 1 and -1, -1 and 1, and basically every integer from -1 to 10, and always, there are two possible results. Either track #2 is loaded, or the audio track is disabled. Very frustrating, because I am so close to having a very nice way to play my ripped bluray discs via VLC's command line interface. But it is basically useless if the command cannot effectively start the movie with the right audio track.
Here's an example of the batch file I have tried:
.\vcdmount.exe /l=f ..\BluRay\CAPTAIN_AMERICA_CIVIL_WAR.iso
SLEEP 6
"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --audio-track=-1 --audio-track-id=1 bluray:///F:/ --fullscreen
Like I say, it works perfectly, other than it just won't set the audio track right, no matter what I try. I also messed around with trying to set the subtitles via command line, and ran into a similar problem.
And FYI: I've used the VLC "Codec Info" to look up the IDs for the audio tracks, and also tried the third-party MediaInfo tool, and looked at the ID information in the audio streams. Here is the data that MediaInfo shows:
General
ID : 0 (0x0)
Complete name : F:\BDMV\STREAM\00300.m2ts
Format : BDAV
Format/Info : Blu-ray Video
File size : 33.7 GiB
Duration : 2 h 27 min
Overall bit rate mode : Variable
Overall bit rate : 32.6 Mb/s
Maximum Overall bit rate : 48.0 Mb/s
Video
ID : 4113 (0x1011)
Menu ID : 1 (0x1)
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.1
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Format settings, GOP : M=3, N=12
Codec ID : 27
Duration : 2 h 27 min
Bit rate mode : Variable
Maximum bit rate : 35.0 Mb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Audio #1
ID : 4352 (0x1100)
Menu ID : 1 (0x1)
Format : DTS
Format/Info : Digital Theater Systems
Format profile : MA / Core
Mode : 16
Format settings, Endianness : Big
Muxing mode : Stream extension
Codec ID : 134
Duration : 2 h 27 min
Bit rate mode : Variable / Constant
Bit rate : Unknown / 1 509 kb/s
Channel(s) : 8 channels / 6 channels
Channel positions : Front: L C R, Side: L R, Back: L R, LFE / Front: L C R, Side: L R, LFE
Sampling rate : 48.0 kHz
Frame rate : 93.750 FPS (512 spf)
Bit depth : 24 bits
Compression mode : Lossless / Lossy
Audio #2
ID : 4353 (0x1101)
Menu ID : 1 (0x1)
Format : AC-3
Format/Info : Audio Coding 3
Format profile : Dolby Digital
Mode extension : CM (complete main)
Format settings, Endianness : Big
Codec ID : 129
Duration : 2 h 27 min
Bit rate mode : Constant
Bit rate : 320 kb/s
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 kHz
Frame rate : 31.250 FPS (1536 spf)
Bit depth : 16 bits
Compression mode : Lossy
Stream size : 338 MiB (1%)
Audio #3
ID : 4354 (0x1102)
Menu ID : 1 (0x1)
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Format settings, Endianness : Big
Codec ID : 129
Duration : 2 h 27 min
Bit rate mode : Constant
Bit rate : 640 kb/s
Channel(s) : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 kHz
Frame rate : 31.250 FPS (1536 spf)
Bit depth : 16 bits
Compression mode : Lossy
Stream size : 676 MiB (2%)
Audio #4
ID : 4355 (0x1103)
Menu ID : 1 (0x1)
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Format settings, Endianness : Big
Codec ID : 129
Duration : 2 h 27 min
Bit rate mode : Constant
Bit rate : 640 kb/s
Channel(s) : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 kHz
Frame rate : 31.250 FPS (1536 spf)
Bit depth : 16 bits
Compression mode : Lossy
Stream size : 676 MiB (2%)
Audio #5
ID : 4356 (0x1104)
Menu ID : 1 (0x1)
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Format settings, Endianness : Big
Codec ID : 129
Duration : 2 h 27 min
Bit rate mode : Constant
Bit rate : 192 kb/s
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 kHz
Frame rate : 31.250 FPS (1536 spf)
Bit depth : 16 bits
Compression mode : Lossy
Stream size : 203 MiB (1%)
Text #1
ID : 4608 (0x1200)
Menu ID : 1 (0x1)
Format : PGS
Codec ID : 144
Text #2
ID : 4609 (0x1201)
Menu ID : 1 (0x1)
Format : PGS
Codec ID : 144
Text #3
ID : 4610 (0x1202)
Menu ID : 1 (0x1)
Format : PGS
Codec ID : 144
Text #4
ID : 4611 (0x1203)
Menu ID : 1 (0x1)
Format : PGS
Codec ID : 144
Duration : 2 h 27 min
Delay relative to video : 8 s 967 ms
Text #5
ID : 4612 (0x1204)
Menu ID : 1 (0x1)
Format : PGS
Codec ID : 144
Text #6
ID : 4613 (0x1205)
Menu ID : 1 (0x1)
Format : PGS
Codec ID : 144
Text #7
ID : 4614 (0x1206)
Menu ID : 1 (0x1)
Format : PGS
Codec ID : 144
Text #8
ID : 4615 (0x1207)
Menu ID : 1 (0x1)
Format : PGS
Codec ID : 144
Duration : 2 h 27 min
Delay relative to video : 8 s 967 ms
Text #9
ID : 4616 (0x1208)
Menu ID : 1 (0x1)
Format : PGS
Codec ID : 144
Duration : 2 h 27 min
Delay relative to video : 8 s 967 ms