Does player framework works with subtitle?

Topics: Windows 8 JavaScript
Jul 25, 2013 at 8:16 AM
Hi all,

Does player framework works with subtitle track? If the video file have multiple built-in subtitles (like multiple languages) can we change it during playback? Also does player framework works with separate subtitle files?

Thanks.
Coordinator
Jul 26, 2013 at 8:54 PM
Hello, built-in subtitle tracks works when using smooth streaming & TTML. Check out our sample application for a demonstration of how to enable it.

Separate files are also supported (often referred to as "side car" files). There is also a demonstration of this in the sample app.
Jul 30, 2013 at 7:25 AM
Hi timgreenfield,

I've download the sample app (this link: http://playerframework.codeplex.com/downloads/get/523391) and found out that the captions track in sample is a separated XML file. What I try to do is to show a built-in caption/subtitle when playing a video. For Now, I can swap audio track by using these option:
<div data-win-control="PlayerFramework.MediaPlayer" data-win-options="
                { 
                    src: '\\Distric9_480p.mp4',
                    isAudioAllowed: true,
                    isAudioEnabled: true,
                    isAudioVisible: true,
                    isCaptionsAllowed: true,
                    isCaptionsEnabled: true,
                    isCaptionsVisible: true
                }
            "></div>
But for some reason caption doesn't work and I don't know why. I can play my test video with Media Player Classic and swap the caption/subtitle with no problem.
Jul 30, 2013 at 8:15 AM
This is my video file info, if it help.
General
Complete name                            : C:\Users\user\Downloads\Distric9_480p.mp4
Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42
File size                                : 297 MiB
Duration                                 : 9mn 46s
Overall bit rate mode                    : Variable
Overall bit rate                         : 4 244 Kbps
Encoded date                             : UTC 2013-07-29 08:24:09
Tagged date                              : UTC 2013-07-29 08:27:14
Writing application                      : HandBrake 0.9.8 2012071700

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Baseline@L3.1
Format settings, CABAC                   : No
Format settings, ReFrames                : 2 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 9mn 46s
Bit rate mode                            : Variable
Bit rate                                 : 2 637 Kbps
Width                                    : 880 pixels
Height                                   : 480 pixels
Display aspect ratio                     : 1.85:1
Frame rate mode                          : Variable
Frame rate                               : 23.976 fps
Minimum frame rate                       : 23.962 fps
Maximum frame rate                       : 23.981 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.260
Stream size                              : 185 MiB (62%)
Writing library                          : x264 core 120
Encoding settings                        : cabac=0 / ref=2 / deblock=1:0:0 / analyse=0x1:0x111 / me=umh / subme=6 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=0 / weightp=0 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=3 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Encoded date                             : UTC 2013-07-29 08:24:09
Tagged date                              : UTC 2013-07-29 08:27:14
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

Audio #1
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : 40
Duration                                 : 9mn 46s
Bit rate mode                            : Variable
Bit rate                                 : 160 Kbps
Maximum bit rate                         : 205 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 KHz
Compression mode                         : Lossy
Stream size                              : 11.2 MiB (4%)
Language                                 : Thai
Encoded date                             : UTC 2013-07-29 08:24:09
Tagged date                              : UTC 2013-07-29 08:27:14

Audio #2
ID                                       : 3
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : 40
Duration                                 : 9mn 46s
Bit rate mode                            : Variable
Bit rate                                 : 160 Kbps
Maximum bit rate                         : 201 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 KHz
Compression mode                         : Lossy
Stream size                              : 11.2 MiB (4%)
Language                                 : English
Encoded date                             : UTC 2013-07-29 08:24:09
Tagged date                              : UTC 2013-07-29 08:27:14

Audio #3
ID                                       : 4
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Mode extension                           : CM (complete main)
Format settings, Endianness              : Big
Codec ID                                 : ac-3
Duration                                 : 9mn 46s
Bit rate mode                            : Constant
Bit rate                                 : 640 Kbps
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 KHz
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 44.8 MiB (15%)
Language                                 : Thai
Encoded date                             : UTC 2013-07-29 08:24:09
Tagged date                              : UTC 2013-07-29 08:27:14

Audio #4
ID                                       : 5
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Mode extension                           : CM (complete main)
Format settings, Endianness              : Big
Codec ID                                 : ac-3
Duration                                 : 9mn 46s
Bit rate mode                            : Constant
Bit rate                                 : 640 Kbps
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 KHz
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 44.8 MiB (15%)
Language                                 : English
Encoded date                             : UTC 2013-07-29 08:24:09
Tagged date                              : UTC 2013-07-29 08:27:14

Text #1
ID                                       : 6
Format                                   : Timed Text
Muxing mode                              : sbtl
Codec ID                                 : tx3g
Duration                                 : 9mn 44s
Bit rate mode                            : Variable
Bit rate                                 : 268 bps
Stream size                              : 19.1 KiB (0%)
Language                                 : Thai
Encoded date                             : UTC 2013-07-29 08:24:09
Tagged date                              : UTC 2013-07-29 08:27:14

Text #2
ID                                       : 7
Format                                   : Timed Text
Muxing mode                              : sbtl
Codec ID                                 : tx3g
Duration                                 : 9mn 44s
Bit rate mode                            : Variable
Bit rate                                 : 123 bps
Stream size                              : 8.81 KiB (0%)
Language                                 : English
Encoded date                             : UTC 2013-07-29 08:24:09
Tagged date                              : UTC 2013-07-29 08:27:14
Coordinator
Jul 30, 2013 at 11:43 PM
Unfortunately, HTML5 & the video tag do not expose internal caption information the way it does with audio tracks. You therefore you need to have separate, external caption files (also known as side car files) that contain your caption information. Sorry for the bad news but there's not a lot we can do about this in the player framework.

Technically, you could write your own media foundation extension to parse the mp4 data and expose it to your app but this is not trival (requires writing an mp4 parser in C++).

Note: The next version of HTML does support dynamic text tracks so this might open the door for this kind of feature someday.
Jul 31, 2013 at 4:00 AM
OK Thanks. :)
And what about PlayerFramework in C#? Does it support internal caption?
Coordinator
Aug 8, 2013 at 5:05 PM
Sorry, the same is true in C#: embedded caption tracks in progressive download videos are ignored.