Request
In Flash/AS3 how do you decode or capture CEA-608 closed-captions embedded in an mp4? I can't seem to get even a hint of the caption data nor can I find any documentation that can point me in the right direction. Any documentation, examples, or ideas would be super helpful.
Specifics
I'm building a video-player in AS3 using OSMF. I can't seem to find /any/ documentation on accessing CEA-608 closed-captions embedded in mp4 chunks in an m3u8 video.
The OSMF CaptioningPlugin requires an external XML file so that won't do; I'm looking for integration details for embedded captioning tracks.
I've tried attaching onTextData
, onMetaData
, onCaptionData
, onTextRR
handlers and listeners to the OSMF Netstream
with absolutely no luck (like... none of these events or handlers ever fire or return anything).
private function onTraitAdd ($e:MediaElementEvent) : void { var mediaElement: MediaElement = ($e.target as MediaElement);
switch ($e.traitType) {
case MediaTraitType.LOAD:
_netStreamLoadTrait = mediaElement.getTrait(MediaTraitType.LOAD) as NetStreamLoadTrait;
_netStreamLoadTrait.addEventListener(LoadEvent.LOAD_STATE_CHANGE, onNetStreamLoaded);
break;
}
}
private function onNetStreamLoaded ($e:LoadEvent) : void {
var netStream:NetStream = _netStreamLoadTrait.netStream;
netStream.client.addHandler("onTextData", onTextData);
netStream.client.addHandler("onCuePoint", onTextData);
netStream.client.addHandler("onMetaData", onTextData);
netStream.client.addHandler("onCaptionData", onTextData);
netStream.client.addHandler("onTextRR", onTextData);
netStream.client.addHandler("onCaptionInfo", onTextData);
netStream.addEventListener("onTextData", onTextData);
netStream.addEventListener("onCuePoint", onTextData);
netStream.addEventListener("onMetaData", onTextData);
netStream.addEventListener("onCaptionData", onTextData);
netStream.addEventListener("onTextRR", onTextData);
netStream.addEventListener("onCaptionInfo", onTextData);
netStream.addEventListener(NetStatusEvent.NET_STATUS, onNetStreamStatus);
netStream.addEventListener(NetDataEvent.MEDIA_TYPE_DATA, onStreamData);
}
I can't tell if the issue is with my OSMF implementation (maybe I'm listening to the wrong NetStream), or if the issue is that there's no way to get this data out of the video.
Example files:
http://stream.flowplayer.org/big_buck_bunny_with_captions.mp4 http://now.video.nfl.com/i/captiontest/closedcaptiontest_,350k,550k,.mp4.csmil/master.m3u8 (this example file is more complex though because it requires an HLS plugin)
Other
I tried using
OSMFCCDecoder.swc
(which was rather hard to find, uploaded here). There's very little documentation and no information on the expected result.Also decompiled
JWPlayer
to see how they handle captions, they parse-out the byteArray ref.Steps to see captions playing in JWPlayer
- http://support.jwplayer.com/customer/portal/articles/1430278-cea-608-captions
- Open browsers javascript console
- Paste this code
jwplayer("container_wrapper")
.setup({
file: "http://now.video.nfl.com/i/captiontest/closedcaptiontest_,350k,550k,.mp4.csmil/master.m3u8"
});