Track Description to Media Track Mapping
Posted: 15 Aug 2024 20:04
by william krzyzkowski
Hello,
I am playing back an MPTS using LibVlcSharp. The Audio Track Description lists an id of perhaps 53. If I parse the media and get the Media Tracks, there is no Media Track with an Id of 53. I'm wondering how I can map these two together especially since the media tracks share descriptions. Any Help would be appreciated. I can also provide an example if needed.
Thank you in Advance!
Re: Track Description to Media Track Mapping
Posted: 26 Aug 2024 06:44
by mfkl
Provide a fully working example so we can test.
Re: Track Description to Media Track Mapping
Posted: 26 Aug 2024 19:18
by william krzyzkowski
Code: Select all
using LibVLCSharp.Shared;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace TestApp
{
class Program
{
static void Main(string[] args)
{
Core.Initialize();
var vlcArgs = new List<string>();
vlcArgs.Add("--swscale-mode=4");
var libvlc = new LibVLC(vlcArgs.ToArray());
var player = new MediaPlayer(libvlc);
var media = new Media(libvlc, "./wills_30_second.ts", FromType.FromPath);
player.Play(media);
Thread.Sleep(100);
var audio = player.AudioTrackDescription;
foreach (var track in audio)
{
Console.WriteLine($"Name {track.Name}, Id {track.Id}");
}
player.Media.Parse();
var mediaTracks = player.Media.Tracks;
var audioTracks = mediaTracks.Where(track => track.TrackType == TrackType.Audio);
foreach (var audioTrack in audioTracks)
{
Console.WriteLine($"Description {audioTrack.Description}, Id {audioTrack.Id}");
}
Console.WriteLine("how do I tie these together?");
Console.ReadLine();
}
}
}
C# framework 4.7.2, LibVlcSharp 3.6.5 and VideoLAN.LibVlc.Windows 3.0.18. Williing to provide a zip file if granted attachment permissions