mencode Spanish/Españotli Subtitles in NASA Scientists' Maya 2012 Video.
"The World Didn't End Yesterday" [El Mundo No Terminó Ayer] video released by NASA prior to the Maya December 21, 2012, phenomenon is evidently intended to assuage potential concerns over the Judeo-Christian apocalyptic tendency inherent in the western psyche. On the other hand, for the Maya in Mexico and Guatemala this date is more of a celebration of their survival against all odds. The Maya have withstood genocide and brutal oppression by the Spanish since the early 1500s and until modern times under the rule of the Spaniards' descendants (criollos) in colonies such as 'Mexico', and Guatemala.
When I saw the original NASA video released a few days prior to the end of the 13 baktuns, in the Maya Long Count Calendar, I wondered why it was not released in the Spanish language as well. And after a couple of days passed, I decided that it might also be useful if at least Spanish subtitles were included.
I use GNU/Linux Debian and GNOME 3 as my main desktop. Thus, if I were to add subtitles I'd use free and open source software throughout this effort.
For a project like this, I had to download the original video at Youtube. Indeed, there multiple ways to go about the procedure but I used youtube-dl -- a python script to download Youtube videos. Under Debian, youtube-dl can be downloaded and installed thus:
apt-get install youtube-dl
To download a Youtube video all that is needed is to provide its link reference at the site. For easier use, at Google's Youtube site selecting the Share button will yield a shorter URL than what is seen at the browsers' top field. Feed that shorter URL to youtube-dl and use the -o option to give a name to the video you are about to download. For instance:
youtube-dl -o WorldDid-ntEnd.flv
YoutubeShortLink
Will download the original video released by ScienceAtNASA and -o will rename the video to a custom file name of your choice with an .flv extension.
Once our target file is downloaded, then we can begin the process of adding the subtitles.
I came across GNOME-subtitles which, after becoming root or superuser, I was able to easily download and install as:
apt-get install gnome-subtitles
The application, once executed, enables us to load (select Video from the topmost bar) our previously downloaded video file and open up a temporary (until we assign it a name) subtitles file. We will be going backward or forward in the video as we synchronize our modifications and timing.
After we are satisfied with the created subtitles file, we save it (by default with a subtitle format SubRip *.srt) as well as character encoding (UTF-8), as shown below:
And then proceed into the actual encoding of its contents into a copy of the video we are manipulating.
Please note that GNOME-subtitles detected my Debian system character encoding appropriately. Sometime ago, when I installed the current instance of Debian into this particular machine, I selected English as default language with Spanish as secondary --both UTF-8.
Encoding Video with mencoder
The first tool I tried is mencoder, a command line utility that is part of the MPlayer: "a movie player which runs on many systems." Under Debian I installed utility as:
apt-get install mencoder
For the uninitiated, the long string of commands and options seems overbearing. If we ask for help by typing at our shell:
man mencoder
we get pages and pages of seemingly unintelligeble verbosity. Accordingly, we may search online for some simple example that matches our intention. In this particular case, I had articulated my intention as: add subtitles to an .flv output format so that it could be played with flowplayer and/or upload it to Youtube.
Suffice it to say that my initial encoding would not be rendered appropriately for the Spanish writing that I intended them. Subtitles would show question marks where accentuated characters should be rendered. Hence, I had to combine several hints and mencoder output help with sections in mencoder's manual pages to put together an articulate command string to achieve my aim.
mencoder
inputFile.flv -oac mp3lame -ovc lavc -sub
subTitlesFile.srt -subcp enca:es:utf-8 -subfont-text-scale 4 -subfont-outline 6 -of mpeg -o
outputFile.flv
Note: make sure to have both, the video file and the subtitles file, at your current directory location in your Linux shell prior to executing mencoder command above to operate on those.
Although the above command may seem too complicated at first sight, mencoder helps us:
First we ask mencoder output for help on -oac:
mencoder -oac help
MEncoder 1.1-4.7 (C) 2000-2012 MPlayer TeamAvailable codecs:
copy - frame copy, without re-encoding (useful for AC3)
pcm - uncompressed PCM audio
mp3lame - cbr/abr/vbr MP3 using libmp3lame
lavc - FFmpeg audio encoder (MP2, AC3, ...)
twolame - Twolame MP2 audio encoder
faac - FAAC AAC audio encoder
Subsequently we request mencoder outpu help on -ovc:
mencoder -ovc help
MEncoder 1.1-4.7 (C) 2000-2012 MPlayer TeamAvailable codecs:
copy - frame copy, without re-encoding. Doesn't work with filters.
frameno - special audio-only file for 3-pass encoding, see DOCS.
raw - uncompressed video. Use fourcc option to set format explicitly.
nuv - nuppel video
lavc - libavcodec codecs - best quality!
libdv - DV encoding with libdv v0.9.5
xvid - XviD encoding
x264 - H.264 encoding
And finally ask mencoder -of
help:
mencoder -of help
MEncoder 1.1-4.7 (C) 2000-2012 MPlayer TeamAvailable output formats:
avi - Microsoft Audio/Video Interleaved
mpeg - MPEG-1/2 system stream format
lavf - FFmpeg libavformat muxers
rawvideo - (video only, one stream only) raw stream, no muxing
rawaudio - (audio only, one stream only) raw stream, no muxing
Most importantly for this project is to adequately render Spanish accents on vowels, as well as other characters, among those are: ¿ and ¡. I was able to achieve that above with option fragment: -subcp enca:es:utf-8
Please see man mencoder
and find or use utility grep to locate text string option -subfonts in output for explanations of the other options in the command above.
Well, I ended up with half the size of the original video (and it can be seen in the quality of the video) but I believe I achieved what I set out to do in the first place: convey the NASA scientists' message in the Spanish dialect. Hopefully those Spanish colonies 'Mexico' and Guatemala, as well as Central America, will take conscience of the importance of the Maya civilization and stop trying to annihilate their wonderful inhabitants.
From Google's Corporate Blog for 'Latin' America: Fin del 13er Baktún de los Mayas [End of the Maya's 13 Baktun(s)].
Friday, December 21, 2012 | 00:01
Mathematics, science and astronomy are issues for which we always have a passion. Therefore, with our doodle today, we celebrate the end of 13 Baktun of the Maya Long Count calendar. But what is its significance?
"Los Maya fueron matemáticos y astrónomos avanzados que calculaban los ciclos de la luna y del sol. Tenían formas muy precisas de medir el tiempo, una de estas formas es el Sistema de Cuenta Larga, en el que cada año tiene 18 meses de 20 [días cada uno]1. El sistema contempla también otras unidades como el Katún, equivalente a 20 años de nuestro calendario, y el Baktún, que equivale a 394 años."
The Maya were advanced mathematicians and astronomers who calculated the moon and the sun's cycles. They had very precise forms of measuring time, and one of these forms is the Long Count System, in which each year has 18 months of 20 days [each]2. Their system also took into account other units such as the Katun, equivalent to 20 years in our [West's] calendar, and the Baktun, which equals 394 years.
The importance of arriving at 13 Baktun, is that, it's very distinct from what happens with our [West's] calendar, there is no 14° Baktun. The count goes back to zero...continues below
continuing... But unlike of all the disaster stories that surely you may have come across, at the end of 13 Baktun, [analogous to the sequence] that ends on Sunday in our [western] calendars, it will be Monday once again and a new week begins. Those who have studied the theme, explain that this is how their calendrical system functions, and, though it represents the end of a cycle, it has no catastrophic significance.
DuckDuckGo search engine parodied the media disinformation hype.
Our doodle today represents the actual date, December 21, 2012, as well as 13 Baktun, to form the word Google. We hope that you enjoy as much as us this doodle, and may the start of the next Baktun be prosperous for all.
1mas un periodo conocido como Wayeb o Uayeb que consistían de 5 días adicionales sin nombre3.
2plus a period known as Wayeb or Uayeb consisting of 5 additional nameless days3.
3Wikipedia article: Maya Calendar
DISCLAIMER although due diligence has been applied, the above post is intended as a proof of concept for encoding Spanish language subtitles in videos.
Please do not hold me or Metztli Information Technology, or its associates, responsible if the information provided here does not achieve the desired result. The information is provided AS IS and with the hope that it may be useful to the Internet community.
Notwithstanding, There is no implicit or explicit guarantee that the information presented here is accurate. Accordingly, if an user(s) decide to implement the procedure or shell commands described here she, he, or them, do so at her, his, or their own risk. You have been forewarned.
I reserve the right to modify the blog and even to delete it without further notice.
Recent comments: