Answered by:
Video file with subtitles/multiple audio track support?

Question
-
I know this is not a C++ specific question but more a metro API question - I couldn't find a proper section to ask this question so here it is.
How to play video file (assume properly encoded .mp4/h264/aac) with subtitle in it? and if the video file has multiple audio tracks, how to switch between them (what metro API to use?)
Monday, May 14, 2012 3:00 AM
Answers
-
Hello Viyayo,
You can use the following interfaces to query and select the current audio stream. Please take a look at the links below. If you still have questions please let me know.
MediaElement.AudioStreamCount
http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.mediaelement.audiostreamcount.aspxMediaElement.AudioStreamIndex
http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.mediaelement.audiostreamindex.aspxMediaElement.GetAudioStreamLanguage
http://msdn.microsoft.com/en-us/library/windows/apps/br227384.aspxI hope this helps,
James
Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/
- Proposed as answer by James Dailey - MSFTMicrosoft employee, Moderator Tuesday, May 15, 2012 9:05 PM
- Marked as answer by Jie Bao Tuesday, June 12, 2012 6:17 AM
Tuesday, May 15, 2012 9:05 PMModerator -
Hello Viyayo,
If you are using HTML you can create a WebVTT or TTML file and sync it to the video using the "track" element. If you are using the MediaElement you might be able to use the MarkerReached event to embed markers in the file and pull the text out of the marker to display as your closed caption text.
track element | track object
http://msdn.microsoft.com/en-us/library/windows/apps/Hh767385.aspxMediaElement.MarkerReached event
http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.mediaelement.markerreached.aspxI hope this helps,
James
Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/
- Proposed as answer by James Dailey - MSFTMicrosoft employee, Moderator Friday, May 18, 2012 9:49 PM
- Marked as answer by Jie Bao Tuesday, June 12, 2012 6:17 AM
Wednesday, May 16, 2012 10:07 PMModerator
All replies
-
Hello,
Thanks for your feedback, I will involve more experts to investigate it.
Best regards,
Jesse
Jesse Jiang [MSFT]
MSDN Community Support | Feedback to us
Tuesday, May 15, 2012 9:52 AM -
Hello Viyayo,
You can use the following interfaces to query and select the current audio stream. Please take a look at the links below. If you still have questions please let me know.
MediaElement.AudioStreamCount
http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.mediaelement.audiostreamcount.aspxMediaElement.AudioStreamIndex
http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.mediaelement.audiostreamindex.aspxMediaElement.GetAudioStreamLanguage
http://msdn.microsoft.com/en-us/library/windows/apps/br227384.aspxI hope this helps,
James
Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/
- Proposed as answer by James Dailey - MSFTMicrosoft employee, Moderator Tuesday, May 15, 2012 9:05 PM
- Marked as answer by Jie Bao Tuesday, June 12, 2012 6:17 AM
Tuesday, May 15, 2012 9:05 PMModerator -
Thanks for the answer James. However,on the MSDN page you gave, I still couldn't find information on how the subtitle is supported - how do I query for available subtitles and how do I select a subtitle for display? and what subtitle format are supported?
Thanks again,
Wednesday, May 16, 2012 1:48 AM -
Hello Viyayo,
If you are using HTML you can create a WebVTT or TTML file and sync it to the video using the "track" element. If you are using the MediaElement you might be able to use the MarkerReached event to embed markers in the file and pull the text out of the marker to display as your closed caption text.
track element | track object
http://msdn.microsoft.com/en-us/library/windows/apps/Hh767385.aspxMediaElement.MarkerReached event
http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.mediaelement.markerreached.aspxI hope this helps,
James
Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/
- Proposed as answer by James Dailey - MSFTMicrosoft employee, Moderator Friday, May 18, 2012 9:49 PM
- Marked as answer by Jie Bao Tuesday, June 12, 2012 6:17 AM
Wednesday, May 16, 2012 10:07 PMModerator -
Hello Viyayo,
If you are using HTML you can create a WebVTT or TTML file and sync it to the video using the "track" element. If you are using the MediaElement you might be able to use the MarkerReached event to embed markers in the file and pull the text out of the marker to display as your closed caption text.
track element | track object
http://msdn.microsoft.com/en-us/library/windows/apps/Hh767385.aspxMediaElement.MarkerReached event
http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.mediaelement.markerreached.aspxI hope this helps,
James
Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/
Does that mean MediaElement has no official support for subtitle (e.g. mpeg-4 part 17)? I have a parse the subtitle then display it as a separate layer when the moment comes.
Friday, May 18, 2012 1:06 PM -
At this time that does appear to be correct.
-James
Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/
Friday, May 18, 2012 9:49 PMModerator