How to add captions or subtitles to videos
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 30
- Joined: Thu Jul 15, 2021 10:01 am
How to add captions or subtitles to videos
Hi All,
I am able to embed a video in my HTML5 output, but I also want to add subtitles/captions to my video.
I found that the `<track>` HTML5 tag can be used to include a text file with subtitles. But, I am not able to figure out as to how I can insert the `<track>` tag in my HTML output. I tried using the `param` tag, but that add <track> as an attribute of the <video> element itself.
Thanks!
I am able to embed a video in my HTML5 output, but I also want to add subtitles/captions to my video.
I found that the `<track>` HTML5 tag can be used to include a text file with subtitles. But, I am not able to figure out as to how I can insert the `<track>` tag in my HTML output. I tried using the `param` tag, but that add <track> as an attribute of the <video> element itself.
image.png
All help is appreciated. Trying to make the video accessible for everyone.Thanks!
You do not have the required permissions to view the files attached to this post.
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: How to add captions or subtitles to videos
Hi,
I'm afraid that for now we do not have a solution for this using DITA elements. We have an internal issue registered for this and I added your details to it, we'll update this forum thread if a fix becomes available.
As a workaround you can embed pure HTML content directly inside DITA topics:
https://www.oxygenxml.com/doc/versions/ ... -html.html
Regards,
Radu
I'm afraid that for now we do not have a solution for this using DITA elements. We have an internal issue registered for this and I added your details to it, we'll update this forum thread if a fix becomes available.
As a workaround you can embed pure HTML content directly inside DITA topics:
https://www.oxygenxml.com/doc/versions/ ... -html.html
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 30
- Joined: Thu Jul 15, 2021 10:01 am
Re: How to add captions or subtitles to videos
Thanks Radu!
That was a helpful workaround, but when I try it with the following code, it does not render anything in the HTML file.
Can you please tell me if anything is missing or what is wrong here?
What kind of transform should I use? I tried DITA HTML5.
That was a helpful workaround, but when I try it with the following code, it does not render anything in the HTML file.
Can you please tell me if anything is missing or what is wrong here?
What kind of transform should I use? I tried DITA HTML5.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="test_video">
<title>Test video</title>
<shortdesc></shortdesc>
<conbody>
<foreign outputclass="html-embed"><![CDATA[
<video width="299" height="168" controls>
<source src="../../../Desktop/first_version.mp4" type="video/mp4">
<track kind="captions" src="../../../Desktop/test.vtt" srclang="en" label="English">
</video>
]]></foreign>
</conbody>
</concept>
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: How to add captions or subtitles to videos
Hi,
If the generated HTML document in the output file looks correct, probably the problem is that your movie and subtitle files are not automatically copied to the output file.
You should place the movie and subtitle files inside the project folder in a subfolder somewhere, then add in the DITA Map references to both of them like:
This should make the publishing engine automatically copy them to the output folder.
Then double check they are present in the output folder in the corresponding subfolder and take care to properly refer to them from the HTML fragment.
Regards,
Radu
If the generated HTML document in the output file looks correct, probably the problem is that your movie and subtitle files are not automatically copied to the output file.
You should place the movie and subtitle files inside the project folder in a subfolder somewhere, then add in the DITA Map references to both of them like:
Code: Select all
<topicref href="movies/first_version.mp4" processing-role="resource-only"/>
<topicref href="movies/test.vtt" processing-role="resource-only"/>
Then double check they are present in the output folder in the corresponding subfolder and take care to properly refer to them from the HTML fragment.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: How to add captions or subtitles to videos
Hi,
One more thing, as the Oxygen docs says, the embedded HTML fragment needs to be well-formed HTML, so something like:
Regards,
Radu
One more thing, as the Oxygen docs says, the embedded HTML fragment needs to be well-formed HTML, so something like:
Code: Select all
<video width="299" height="168" controls="">
<source src="../../../Desktop/first_version.mp4" type="video/mp4"/>
<track kind="captions" src="../../../Desktop/test.vtt" srclang="en" label="English"/>
</video>
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 30
- Joined: Thu Jul 15, 2021 10:01 am
Re: How to add captions or subtitles to videos
Thanks for that input, Radu! I was able to get it to work after adding the closing slashes, although the pure HTML would have worked just fine without those.
Having the support to add captions directly using DITA (instead of embedding HTML) would be a great feature.
Thanks for your time!
Having the support to add captions directly using DITA (instead of embedding HTML) would be a great feature.
Thanks for your time!
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service