08-03-2021 update:
T̶h̶i̶s̶ ̶v̶i̶d̶e̶o̶ ̶i̶s̶ ̶a̶g̶e̶-̶r̶e̶s̶t̶r̶i̶c̶t̶e̶d̶ ̶a̶n̶d̶ ̶o̶n̶l̶y̶ ̶a̶v̶a̶i̶l̶a̶b̶l̶e̶ ̶o̶n̶ ̶Y̶o̶u̶T̶u̶b̶e̶ Fuck Youtube CEO Polish CENSOR and ex-sister-in-law to Google's co-founder1!
I used Mplayer's mencoder (built from source) to render the English/Russian subtitles in the PoC video above -- as I was trying out the upcoming GNU/Linux Debian Jessie distribution encapsulated inside a KVM virtual machine.
In the past I had used mencoder to add Spanish subtitles to a video, but this time I was challenged with Russian subtitles, as those initially would not render properly in the resulting video. As a matter of fact, I was not even able to install mencoder from the Debian Jessie and Sid repositories due to libdvdnav4 dependency issue. Thus, the ephemeral viable option was to build mplayer's mencoder from source --which will skip support for DVD during the configure phase.
To solve the first issue, during Debian Jessie installation routine in the virtual machine I selected Russian as an additional language:
I can verify the above action by examining /etc/locale.gen; I can see (scrolling to the bottom) that, in effect, I enabled 2 languages in addition to English: Russian and Mexico's Spanish dialect, all UTF-8.
For the record, at the top of the /etc/locale.gen file the user is advised to execute:
/usr/sbin/locale-gen
after manually enabling any locale (by removing the hash symbol from the beginning of the directive.)
I update Debian repositories:
Shell
apt-get update |
Since I am getting mplayer/mencoder code via Subversion:
Shell
apt-get install subversion |
Then I get the mplayer/mencoder source code:
Shell
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer |
and directory mplayer will be created at my current directory location.
I change directory into mplayer:
Shell
cd mplayer |
Since I am on Debian, and after scanning the README file, I can simply download a couple of DEBs:
Shell
apt-get install git devscripts |
and then could simply execute the script under the debian directory to
"configure, compile and build a proper Debian .deb package with only one command:"
Shell
debian/daily-build.sh -b |
But no. Since I am in a non-stable Debian, the resulting mencoder package may still refuse to install. Thus, I will download the relevant DEB packages manually:
Shell
apt-get install ffmpeg docbook-xsl ladspa-sdk libenca-dev libaa1-dev libasound2-dev libaudio-dev libcaca-dev libcdparanoia-dev libbluray-dev libdirectfb-dev libdts-dev libesd0-dev libfaad-dev libfontconfig1-dev libfreetype6-dev libfribidi-dev libgif-dev libgl1-mesa-dev libgtk2.0-dev libjack-dev libjpeg-dev liblircclient-dev liblivemedia-dev liblzo2-dev libmp3lame-dev libmpcdec-dev libncurses5-dev libopenal-dev libpng12-dev libpulse-dev libschroedinger-dev libsdl1.2-dev libsmbclient-dev libspeex-dev libsvga1-dev libswscale-dev libtheora-dev libvorbis-dev libvorbisidec-dev libx11-dev libx264-dev libxext-dev libxinerama-dev libxv-dev libxvidcore-dev libxvmc-dev libxxf86dga-dev libxxf86vm-dev libvdpau-dev pkg-config vstream-client-dev x11proto-core-dev xsltproc yasm zlib1g-dev mpg123 libmpg123-dev |
After the above operation completes, then we are ready to build mplayer/mencoder from our downloaded source snapshot. Since I am in the mplayer directory:
Shell
./configure --enable-gui |
(sample partial output):
[...]
Creating config.mak
Creating config.hConfig files successfully generated by ./configure --enable-gui !
Install prefix: /usr/local
Data directory: /usr/local/share/mplayer
Config direct.: /usr/local/etc/mplayerByte order: little-endian
Optimizing for: native
[...]
Note: the default installation directory is /usr/local/ and the --enable-gui option is, well, optional. As usual we could change the installation directory and disable/enable options. Simply type ./configure --help for an overview.
Additionally, if you will be downloading codecs, make sure to place the extracted files ending in .so under the directory /usr/local/lib/codecs/
End of note.
In this particular case for this post, I follow a successfully completed ./configure operation with:
Shell
make | |
make install |
You may be required to acquire root privilege to make install into /usr/local --as is usual any time you install software from repositories.
Unless one is brainwashed by one of those three(3) major patriarchal strains spread by fanatics throughout the world imposing a misogynist attitude, the archetype of Cihuatl, Nahuatl -- Mexico's language par excellence -- which translates as женщина in Russian, Woman in English, and Mujer in Spanish, is fascinating. It beams down onto a man's subconsciousness when least expected.
I happen to add an extra feature supporting RuTube videos in b2evolution for Openshift PaaS cloud hosted at my Nepohualtzintzin GitHub repository. And during testing I came across Miss MAXIM 2013 (Ксения Кайгородова: Xenia Kaygorodova). Thus the seed of a proof of concept -- or PoC -- was generated as result of a Russian media video and my chance listening of a melody sung in Spanish: ¿Tú De Que Vas? -- loosely translated as, Do You Even Need To Ask?
Thus, I used youtube-dl utility -- available also from Debian repositories. If it does not exist in your system, all you have to do is:
Shell
apt-get install youtube-dl |
and subsequently downloaded the video from RuTube with command:
Shell
youtube-dl -o nenetl.flv http://rutube.ru/video/cf126c6e54c8e30758fffe75503ca644 |
the option -o is just to assign a name to the file of interest; otherwise, you will end up with an unintelligeble alphanumeric-named file. As for the word nenetl, it is akin to a female image, ideal form, approaching an archetype.
Assuming current location is where the downloaded file resides, I create an ephemeral directory and change into it:
Shell
mkdir --verbose ephemeral | |
cd ephemeral |
At this directory I will operate as follows:
used ffmpeg in order to extract the images from the nenetl.flv video, thus:
Shell
ffmpeg -i ../nenetl.flv -f image2 images%05d.png |
The extracted images will occupy around 1.5 Gb of space. Now, by rough trial and error, I aimed to fit a relevant subset of the images into an interval equal to the length of the melody playing in the background. The final command -- referenced below -- outputs a nenetl_slideshow.mp4 which lasts approximately the length of the melody:
Shell
ffmpeg -r 6.2 -ss 00:00:03 -i images%05d.png -c:v libx264 -r 30 -pix_fmt yuv420p ../nenetl_slideshow.mp4 |
I had to decrease the intake of the images to 6.2 frames per second (fps) by using the -r option to ffmpeg; thus it gives the video somewhat of a slow motion
Also, by feeding the -ss to ffmpeg I advanced the resulting slideshow by hh:mm:03 seconds. Please type:
Shell
man ffmpeg |
for additional information relevant to options specified.
Once we are satisfied with the outcome, we can erase all the extracted .png (picture) files at our current ephemeral directory and thus recover our disk space.
Subsequently, I merged the slideshow file with the .mp3 Franco de Vita audio file as follows:
Shell
ffmpeg -i ../nenetl_slideshow.mp4 -i ../Franco_De_Vita-Tu_De_Que_Vas.mp3 -map 0 -map 1 -codec copy -shortest ../nenetl.mp4 |
Cool! Now we have the length of the melody that is roughly equivalent to the most visually interesting media. We can verify it with the mplayer that was built above:
Shell
mplayer ../nenetl.mp4 |
Or, alternatively, since we enabled the graphical user interface (GUI) as an argument during ./configure
phase:
Shell
gmplayer ../nenetl.mp4 |
Note: If you accepted the default installation path for the mplayer build, please make sure to install your skins under /usr/local/share/mplayer/skins/
. For instance, the location for the Hayraphon skin in the above snapshot would be /usr/local/share/mplayer/skins/hayraphon
End of note.
In Debian, we install the application as:
Shell
apt-get install gnome-subtitles |
After it is completely installed, we start it from our shell:
Shell
gnome-subtitles |
From topmost menu, we select Video, Open from the ensuing cascaded menu, and locate the nenetl.mp4 video/audio media we created before. The media file will be embedded in the upper section of the application.
We select the leftmost blank paper icon labeled New to start creating subtitles for our video -- as it is played using the controls under the embedded media. Further, as our embedded media is played, we can add another line of text by pressing the plus icon labeled Insert located in the upper row of icons -- just below the uppermost menu.
From aforementioned row we also can save our newly created subtitles file by selecting the green arrow pointing down in a drawer icon, labeled as Save.
The named file will default to be saved with an extension .srt and UTF-8 locale.
After we are satisfied assigning subtitles to relevant sections of the embedded audio/visual stream, we are ready to embed the subtitles file into the actual nenetl.mp4 media. For that we will use mencoder.
Assuming our location continues to be our ephemeral directory that we created for this set of tasks and we have a resulting xenia.srt subtitles file also here, we type next command:
Shell
mencoder ../nenetl.mp4 -oac mp3lame -ovc lavc -sub xenia.srt -subcp enca:ru:utf-8 -subfont-outline 4 -of mpeg -o xenia.mp4 |
Alternatively, directive below will add extra font feature to your subtitles:
Shell
mencoder ../nenetl.mp4 -oac mp3lame -ovc lavc -sub xenia.srt -subcp enca:ru:utf-8 -subfont-text-scale 4 -subfont-outline 6 -of mpeg -o Nenetl.mp4 |
References:
1 "Her sister Anne is the founder of the genetic-testing company 23andMe and was married to Google co-founder Sergey Brin." via NeoMcCarthyism as a smoke screen to hide the crisis of neoliberalism
ffmpeg, how to add new audio (not mixing) in video
Past midway during the creation of this post -- researching sources -- I was surprised to find the RuTube source is also available from YouTube, albeit with a different cover:
Десятка финалисток Miss MAXIM 2013. Часть первая (Ксения Кайгородова)
How I got b2evolution to work in both English and Russian with UTF-8
DISCLAIMER although due diligence has been applied, the above post is intended as a proof of concept for encoding Russian 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.
"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.
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.
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: