Flash video captions tutorial: Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
(Created page with "{{Incomplete}} {{Flash tutorial|CS6, (CS4, CS5)|intermediate|}} == Introduction == Video components are prebuilt interface elements (widgets) that will speed up video integr...")
 
m (Text replacement - "<pageby nominor="false" comments="false"/>" to "<!-- <pageby nominor="false" comments="false"/> -->")
 
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Incomplete}}
{{Incomplete}}
{{Flash tutorial|CS6, (CS4, CS5)|intermediate|}}
{{Flash tutorial|CS6, (CS4, CS5)|intermediate|}}
<!-- <pageby nominor="false" comments="false"/> -->


== Introduction ==
== Introduction ==


Video components are prebuilt interface elements (widgets) that will speed up video integration. As explained in the [[Flash video component tutorial]] the '''FLVPlayBack Video Component''' allows to render videos in an easy way since it includes a nice choice of skins for user controls. Videos also can be enhanced with captioning or they may interact with the rest of the animation. Some of these techniques require some more technical skills, e.g. knowledge of [[XML]] and some ActionScript as we shall explain here. Finally, you also could program your own video interface using ActionScript, a topic that will not be covered here.
Video components are pre-built interface elements (widgets) that will speed up video integration. As explained in the [[Flash video component tutorial]], the '''FLVPlayBack Video Component''' allows to render videos in an easy way since it includes a nice choice of skins for user controls. Videos also can be enhanced with captioning, i.e. subtitles or side-text as we shall explain in this tutorial. For this purpose, you need another component: '''FLVPlayback Captioning'''


<div class="tut_goals">
<div class="tut_goals">
; Learning goals:
; Learning goals:
: Learn how to encode *.fl4 and (older) *.flv files
: Learn how to encode *.fl4 and (older) *.flv files
: Learn how to use the Flash 9 (CS3) video component for simple video playback
: Learn how to use the Flash 10/11 (CS5/6) video component for simple video playback


;Prerequisites for the first part
;Prerequisites for the first part
:[[Flash CS6 desktop tutorial]]
:[[Flash CS6 desktop tutorial]]
:[[Flash drawing tutorial]]
:[[Flash drawing tutorial]]
:[[Flash component button tutorial]]
:[[Flash video component tutorial]] ('''important''')
:[[Timed Text]] (only for captions).
:[[Timed Text]]  
:[[Flash button tutorial]]
:[[Flash embedded movie clip tutorial]] (maybe)
:[[Flash motion tweening tutorial]], [[Flash shape tweening tutorial]], [[Flash special effects tutorial]]
:[[Flash embedded movie clip tutorial]]


;Moving on
;Moving on
Line 26: Line 25:
: This text should technical people get going and may not be good enough for self-learning beginners. It can be used as handout in a "hands-on" class. That is what [[User:Daniel K. Schneider|Daniel K. Schneider]] made it for...
: This text should technical people get going and may not be good enough for self-learning beginners. It can be used as handout in a "hands-on" class. That is what [[User:Daniel K. Schneider|Daniel K. Schneider]] made it for...
;Level
;Level
: It both aims at beginners (FLV encoding, using the video playback component and embedding a video in the timeline) and intermediate Flash designers (inserting captions and using cue points to trigger animations).
: It both aims at beginners that do have some web technology background and intermediate Flash designers.
</div>
</div>


Line 41: Line 40:
* Encode captions in an XML file (there are at least two options). This XML file then must be registered with the captioning component.
* Encode captions in an XML file (there are at least two options). This XML file then must be registered with the captioning component.


To import the video, use the same procedure as in [[#Using_the_FLVPlayback_component|Using the FLVPlayback component]]
To import the video, use the same procedure as in the [[Flash video component tutorial]]
* Drag the video component to the stage
* Configure the file name and skin in the properties panel


== The caption component with timed text ==
== The caption component with timed text ==
Line 51: Line 52:
Flash doesn't support the full [[Timed Text]] specification and the documentation at Adobe is rather shaky. For those who are familiar with XML I wrote a little DTD that helps editing. Just grab it from the [[Timed Text]] article and also copy/paste the XML template.  
Flash doesn't support the full [[Timed Text]] specification and the documentation at Adobe is rather shaky. For those who are familiar with XML I wrote a little DTD that helps editing. Just grab it from the [[Timed Text]] article and also copy/paste the XML template.  


Note: Timed Text is defined with a complex [[XML Schema]] but since Adobe Flash only implements a subset, it's not worth using this.
Notes: Timed Text is defined with a complex [[XML Schema]] but since Adobe Flash only implements a subset, it's not worth using this. Also, Internet Explorer 10 supports Timed Text in the HTML5 video tag, read [[HTML5 audio and video]].


; Figuring out time for captions
; Figuring out time for captions
In order to write this XML file you must know what caption to insert at which time and for how long. For CS3 and CS4 you need to play the movie with an external video player. The CS4 Adobe Media player does show time and maybe other *.flv video players too.
* Get [http://get.adobe.com/amp/ Adobe Media Player]. It is free.
* Under Ubuntu, the Totem player works well.


In CS5, there is '''no need for an external video player''', you can preview the video in the authoring tool or alternatively write down times in the Media Encoder tool
There are several methods:
 
* Use the Adobe Media Encoder, i.e. the playhead in the Export Settings as explained in the [[Flash video component tutorial]]
In CS3, if you want high precision, you also can load the *.flv file into the timeline (see below) and then play it with ''View->Bandwidth Profiler'' on. Write down the frame number for captions and then divide by the frame rate. Hit:
* Use a Skin with full controls, then slide the playhead you can see in the component on the stage to the right position. Add a cue point. It will show the current "time". Of course, don't save these cue points...
* '.' to stop and then to go forward one frame,
* ',' to go back one frame,
* 'Enter' to start playing again.


; A minimal example XML captioning file
; A minimal example XML captioning file
Line 128: Line 123:
: specify the ''source'' file of the Timed Text XML file to download. So, create the xml file now, if you didn't so far. Make sure to get the spelling right.
: specify the ''source'' file of the Timed Text XML file to download. So, create the xml file now, if you didn't so far. Make sure to get the spelling right.


[[image:flash-cs3-video-captions.png|thumb|600px|none|The FLVPlayback Captioning component and its parameters]]
[[image:flash-cs6-video-captions.png|thumb|800px|none|The FLVPlayback Captioning component and its parameters]]


; The example
; The example
Line 142: Line 137:
== CaptionsBox and Style ==
== CaptionsBox and Style ==


As explained in Tom Greens' [http://www.digital-web.com/articles/captions_flash_video/ Captions for Video with Flash CS] tutorial, you can use a different text box to display the captions.
You can use a different text box to display the captions, i.e. nothing prevents you from displaying the text somewhere in the middle of the video or outside of the playback component's area.


; Step 1 - Draw a textbox for the captions to appear
; Step 1 - Draw a textbox for the captions to appear
Line 154: Line 149:
; Step 2 - Configure the component
; Step 2 - Configure the component
Tell the captioning component to use the textbox you just made to display captions:
Tell the captioning component to use the textbox you just made to display captions:
* Open the parameter or inspector panel for the FLVPlayback Captioning component
* Select FLVPlayback Captioning component
* Set captionTarget = caption_box
In the Properties panel:
* Set autoLayout = false
* Set captionTargetName = caption_box
* '''Untick''' autoLayout
* Add the source, i.e. the XML file name (or do it later)
 
[[image:flash-cs6-video-captions2.png|thumb|600px|none|The FLVPlayback Captioning component and its parameters]]


; Step 3 - Add some style to the XML File
; Step 3 - Add some style to the XML File
Line 204: Line 203:
== Adding captions with Cue Points ==
== Adding captions with Cue Points ==


There is an alternative method. Read [http://www.digital-web.com/articles/captions_flash_video_2/ Captions for Video with Flash CS3 (Part Two)], by Tom Green, Digital Web Magazine, June
There is an alternative method and the principle is obvious if you understood the principles explained in the [[flash augmented video tutorial]].
 
# Add cue points to your video, i.e. one for each "moment" where you plan to display some text.
# Use these cue points to display various hidden statics text boxes, or better, substitute text of the same dynamic text box.
 
Absolute beginners solution:
* Put textboxes on the stage and give each a different instance name, e.g. text1, text2, etc.
* In the ActionScript code hide these at start:
text1.visibility = false;
text2.visibility = false;
* Define event handlers for each of these, as explained above
* In the function that is called when a cue point event occurs:
text1.visibility = true;
 
In some distant future we may create an example. For the moment, implementation is left as an exercise to the reader.
 
A totally different solution is to directly edit the video file. E.g. read [http://www.digital-web.com/articles/captions_flash_video_2/ Captions for Video with Flash CS3 (Part Two)], by Tom Green, Digital Web Magazine, June. We don't know if this solution works and is still accurate.


== Links ==
== Links ==
Line 211: Line 226:


* [http://www.w3.org/AudioVideo/TT/ Timed-Text], W3C Specification
* [http://www.w3.org/AudioVideo/TT/ Timed-Text], W3C Specification
* [http://livedocs.adobe.com/flash/9.0/main/00000611.html Timed Text Tags] (List of supported tabs, Adobe)
* [http://help.adobe.com/en_US/as3/components/WS5b3ccc516d4fbf351e63e3d118a9c65b32-7ee5.html Timed Text Tags] (List of supported tabs, Adobe, retrieved Feb 2013)

Latest revision as of 18:52, 22 August 2016

Introduction

Video components are pre-built interface elements (widgets) that will speed up video integration. As explained in the Flash video component tutorial, the FLVPlayBack Video Component allows to render videos in an easy way since it includes a nice choice of skins for user controls. Videos also can be enhanced with captioning, i.e. subtitles or side-text as we shall explain in this tutorial. For this purpose, you need another component: FLVPlayback Captioning

Learning goals
Learn how to encode *.fl4 and (older) *.flv files
Learn how to use the Flash 10/11 (CS5/6) video component for simple video playback
Prerequisites for the first part
Flash CS6 desktop tutorial
Flash drawing tutorial
Flash video component tutorial (important)
Timed Text
Flash embedded movie clip tutorial (maybe)
Moving on
The Flash article has a list of other tutorials.
Quality
This text should technical people get going and may not be good enough for self-learning beginners. It can be used as handout in a "hands-on" class. That is what Daniel K. Schneider made it for...
Level
It both aims at beginners that do have some web technology background and intermediate Flash designers.

Making use of captions

A caption is a text that is displayed dynamically while the video is playing. Captions may serve several purposes:

  • You can deploy videos to people with hearing disabilities
  • Users can look at videos without making noise
  • You can emphasize important passages, or paraphrase or comment voice tracks.

In order for captions to work, you must do three things:

  • Use a skin for the playback component that includes a Caption button, e.g. SkinUnderAllNoFullscreen.swf.
  • Make use of the FLVPlayback Captioning component (in addition to the playback component)
  • Encode captions in an XML file (there are at least two options). This XML file then must be registered with the captioning component.

To import the video, use the same procedure as in the Flash video component tutorial

  • Drag the video component to the stage
  • Configure the file name and skin in the properties panel

The caption component with timed text

The Timed Text standard and XML

If you are not familiar with XML, you may have a glance at the XML article and maybe the DTD tutorial. Then, we also suggest to work with an XML editor in order to insure that your file is well formed. We suggest the free Exchanger XML Lite. If you don't feel learning XML, just make very sure that you exactly use a template as described below. One missing tag or or some syntax mistake like a missing ">" will make your animation fail.

Flash doesn't support the full Timed Text specification and the documentation at Adobe is rather shaky. For those who are familiar with XML I wrote a little DTD that helps editing. Just grab it from the Timed Text article and also copy/paste the XML template.

Notes: Timed Text is defined with a complex XML Schema but since Adobe Flash only implements a subset, it's not worth using this. Also, Internet Explorer 10 supports Timed Text in the HTML5 video tag, read HTML5 audio and video.

Figuring out time for captions

There are several methods:

  • Use the Adobe Media Encoder, i.e. the playhead in the Export Settings as explained in the Flash video component tutorial
  • Use a Skin with full controls, then slide the playhead you can see in the component on the stage to the right position. Add a cue point. It will show the current "time". Of course, don't save these cue points...
A minimal example XML captioning file

As a minimum we suggest to enter the following data. For each caption enter:

  • A <p> </p> tag. Each "p" should include:
  • a begin attribute that defines when the caption should appear,
  • a dur attribute that defines how long it will stay on screen.

Time is in seconds, but also may use a more complex format like

02:30.5

meaning 2 minutes, 30 seconds and a half.

Here is the file we called timed-text.xml and that we used in this example

<?xml version="1.0" encoding="UTF-8"?>
<tt xml:lang="en" xmlns="http://www.w3.org/2006/04/ttaf1"
    xmlns:tts="http://www.w3.org/2006/04/ttaf1#styling">
  <head>
    <styling>
    </styling>
  </head>
  <body>
   <div xml:lang="en">
      <p begin="1" dur="4">Daniel´s Office</p>
      <p begin="5" dur="5">My Palm Tree (from NYC)</p>
      <p begin="11" dur="7">My Bookshelf</p>
      <p begin="18" dur="5">My favorite Flash Drawing Book</p>
      <p begin="25" dur="5">My DELL XPS Laptop Flash machine</p>
      <p begin="30" dur="5">My Ubuntu Linux workstation</p>
      <p begin="33" dur="5">Working hard on Flash Tutorials using the Xemacs Editor</p>
      <p begin="42" dur="5">The outside (not my bike)</p>
    </div>
  </body>
</tt>

Note: Captions may overlap, i.e. Flash will display a new caption on a new line if the previous one is still on. You can see this in the example we present in the next section.

For now, just grab the template below and add "p" tags, make sure to close them as in the example above. Replace "Let's start" by your own caption of course.

<?xml version="1.0" encoding="UTF-8"?>
<tt xml:lang="en" xmlns="http://www.w3.org/2006/04/ttaf1"
    xmlns:tts="http://www.w3.org/2006/04/ttaf1#styling">
  <head><styling></styling></head>
  <body>
   <div xml:lang="en">
      <p begin="1" dur="4">Let´s start</p>

    </div>
  </body>
</tt>
Using the FLVPlayback Captioning component
  • Create a new layer and call it "Caption" or something like that. Go there.
  • Then drag the "FLVPlayback Captioning component" somewhere to the workspace or even to the stage.
  • Unlike the playback component, this component will not be seen by the end user, so you can place it anywhere.
Customization of the component
Click on the component and edit the parameters, either in the Parameters or the Component Inspector panel (CS3 only). Then,
set showCaptions to true if you want all users to see captions (probably most users don't know how to turn it on or off, so turn it on)
specify the source file of the Timed Text XML file to download. So, create the xml file now, if you didn't so far. Make sure to get the spelling right.
The FLVPlayback Captioning component and its parameters
The example
Tuning
  • You can style text and background of the Caption Box (see below)
  • Put down the volume: Set it to 0.5 in the parameters of the FLVPlayer or even lower. I am fed up listening to my own voice, really.

CaptionsBox and Style

You can use a different text box to display the captions, i.e. nothing prevents you from displaying the text somewhere in the middle of the video or outside of the playback component's area.

Step 1 - Draw a textbox for the captions to appear
  • Create a captions layer if you don't already have one
  • Draw a textbox
    • Give it the instance name caption_box
    • Select font size, color etc.
    • Select Multiline
    • Make it Dynamic Text (if it is not)
Step 2 - Configure the component

Tell the captioning component to use the textbox you just made to display captions:

  • Select FLVPlayback Captioning component

In the Properties panel:

  • Set captionTargetName = caption_box
  • Untick autoLayout
  • Add the source, i.e. the XML file name (or do it later)
The FLVPlayback Captioning component and its parameters
Step 3 - Add some style to the XML File

Just look at this example (file timed-text2.xml). I don't really understand how some styling tags work. I'd expect for instance to behave backgroundColor within a span like in HTML but it doesn't. I don't know this behavior is a feature or a bug or my misunderstanding of the manual.

If something is not clear, please download the *.fla file and look at it. Make sure to verify that both the playback and the captioning component parameters are ok and that you put all the files in your computer or the server (including the skin *.swf, the *.flv and the *.xml file) in the same directory. Do not forget to copy the skin !

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tt SYSTEM "mini-tt.dtd">
<tt xml:lang="en" xmlns="http://www.w3.org/2006/04/ttaf1"
    xmlns:tts="http://www.w3.org/2006/04/ttaf1#styling">
  <head>
    <styling>
      <style id="title" tts:backgroundColor="transparent" tts:color="red" tts:fontSize="24"/>
    </styling>
  </head>
  <body>
   <div xml:lang="en">
      <p begin="0" dur="9" style="title">Daniel´s Office</p>
      <p begin="5" dur="4">My Palm Tree (from NYC)</p>
      <p begin="10" dur="13" style="title">Books ....</p>
      <p begin="11" dur="7">My Bookshelf</p>
      <p begin="18" dur="5">My favorite Flash Drawing <span tts:color="red">Book</span></p>
      <p begin="24" dur="16" style="title">Computers ....</p>
      <p begin="25" dur="5">My DELL XPS Laptop Flash machine</p>
      <p begin="30" dur="5">My 
        <span tts:backgroundColor="yellow" tts:color="black">
        Ubuntu Linux workstation</span>
      </p>
      <p begin="35" dur="5">
        <span tts:backgroundColor="transparent"></span>
        Working hard on Flash Tutorials using the Xemacs Editor
      </p>
      <p begin="40" dur="4">The outside (not my bike)</p>
    </div>
  </body>
</tt>
The result

Adding captions with Cue Points

There is an alternative method and the principle is obvious if you understood the principles explained in the flash augmented video tutorial.

  1. Add cue points to your video, i.e. one for each "moment" where you plan to display some text.
  2. Use these cue points to display various hidden statics text boxes, or better, substitute text of the same dynamic text box.

Absolute beginners solution:

  • Put textboxes on the stage and give each a different instance name, e.g. text1, text2, etc.
  • In the ActionScript code hide these at start:
text1.visibility = false;
text2.visibility = false;
  • Define event handlers for each of these, as explained above
  • In the function that is called when a cue point event occurs:
text1.visibility = true;

In some distant future we may create an example. For the moment, implementation is left as an exercise to the reader.

A totally different solution is to directly edit the video file. E.g. read Captions for Video with Flash CS3 (Part Two), by Tom Green, Digital Web Magazine, June. We don't know if this solution works and is still accurate.

Links

Timed Text (TT)