Posts

Showing posts from October, 2022

CAPTURE OPEN SUBTITLE TEXT OF AN VIDEO (under contruction)

Image
The video need to be download to your ipad and saved in the same folder with this html file The youtube video https://youtu.be/8Nukkm4jc7s is used in this html file You can use y2mate.com to download this video to your ipad <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script> <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css"/> <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js"></script> <script type="text/javascript&quo

DOWNLOAD HTML CODE FOR THE POST Play closed subtitle with yt video

<!DOCTYPE html> <html> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <head> <script src="https://code.jquery.com/jquery-3.6.0.js"></script> <style> body{ font-family:Arial; font-size:14pt; background-color:#8F916B; margin:0px; padding:0px; color:white; } button, input, textarea, span{ font-size:14pt; } textarea{ width:620px; height:200px; } #header1{ color:white; font-weight:bold; width:720px; height:40px; background-color:#006699; padding-top:3px; padding-bottom:3px; top: 0px; left: 0; right: 0; margin: 0 auto; } #header1 td {border: none;} span{font-size:16pt} .me{ color: #AAFF00; font-size:20pt; } .select { cursor: pointer; display: inline-block; position: relative; font: normal 12pt Arial, Sans-Serif; color: black; border: 1px solid #ccc; } .my-select-menu::part(button) { color: white; background-color: #f00; padding: 5px

TRANSLATE SRT (VTT) SUBTILE FILE ON IPAD

TRANSLATE SRT OR VTT FILES USING JS ON IPAD If you let the app translate the following line into another language 00:00:04.580 --> 00:00:06.660 then they often spoil it, for example there will be 00:00: 04.580 ->00:00:06.660 So I have to change it to the format seconds ## seconds After the translation is done, change it back to hhmmss --> hhmmss After the file srt (or vtt) is extracted from youtube video (using downsub.com for example) let open this html code and parse it inside textarea with id="area1" Tap the finame of this html to run it. Tap "OK" to change to seconds ## seconds format WEBVTT 1 00:00:04.580 --> 00:00:06.660 Juny Tony Story Musical 2 00:00:07.140 --> 00:00:08.100 Little Red Riding Hood 3 00:00:08.260 --> 00:00:09.620 Shall we start? 4 00:00:11.640 --> 00:00:12.440 Once upon a time 5 00:00:12.700 --> 00:00:14.700 there was a lovely little girl. 6 00:00:17.000 --> 00:00:20.100 She alw

JAVASCRIPT SNIPPETS

/* vttParser.js (by pvh) */ point = []; sub = []; function vParser(vtt) { var lines = vtt.trim().replace('\r\n', '\n').split(/[\r\n]/).map(function(line) { return line.trim(); }); var start = null; var end = null; var payload = null; for (var i = 0; i < lines.length; i++) { if (lines[i].indexOf('-->') >= 0) { var splitted = lines[i].split(/[ \t]+-->[ \t]+/); if (splitted.length != 2) { throw 'Error when splitting "-->": ' + lines[i]; } // Already ignoring anything past the "end" timestamp (i.e. cue settings). start = to_sec(splitted[0]); point.push(start); end = to_sec(splitted[1]); } else if (lines[i] == '') { if (start && end) { start = null; end = null; payload = null; } } else if(start && end) { if (payload == null) { payload = lines[i]; } else { payload += '\n' + lines[i]; } sub.push(payload); } } //for

PLAY CLOSED SUBTITLE WITH VIDEO (iframe api). Test file a5-play-vtt-red-hood.html

Let’s use the youtube video “Little red riding hood in chinese” https://youtu.be/zvHovAPggEE This video has audio in Chinese (zh) with closed English (en) subtitles. Many videos on youtube.com have open (or hard, burned in) subtitles. We can't close (or hide) open subtitles. On youtube.com sometimes (rarely) we find videos with closed (soft) subtitles. Unlike open subtiles, with closed subtitles we can turn it off or choose to view subtitles in another language. When you know that the specific video possess closed subtitles, let use the website downsub.com to get srt file. But using html5 video tag on Ipad you cannot work with srt file. So you need to use the online srt to vtt service for the convert. If you like to learn javascript programming on ipad, you can install ios app "Koder code code editor". You can write your own or look online for js code for this convert. Usually people use html5 video with text track to display subtit