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:
after manually enabling any locale (by removing the hash symbol from the beginning of the directive.)
Building mplayer -- defaults to building mencoder, too -- from source in Debian Jessie.
I update Debian repositories:
Since I am getting mplayer/mencoder code via Subversion:
Then I get the mplayer/mencoder source code:
and directory mplayer will be created at my current directory location.
I change directory into mplayer:
Since I am on Debian, and after scanning the README file, I can simply download a couple of DEBs:
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:"
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:
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:
(sample partial output):
Config files successfully generated by ./configure --enable-gui !
Install prefix: /usr/local
Data directory: /usr/local/share/mplayer
Config direct.: /usr/local/etc/mplayer
Byte 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
End of note.
In this particular case for this post, I follow a successfully completed ./configure operation with:
You may be required to acquire root privilege to make install into /usr/local --as is usual any time you install software from repositories.
Cihuatl Archetype And The Human Subconsciousness.
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:
and subsequently downloaded the video from RuTube with command:
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:
At this directory I will operate as follows:
used ffmpeg in order to extract the images from the nenetl.flv video, thus:
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:
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:
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:
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:
Or, alternatively, since we enabled the graphical user interface (GUI) as an argument during ./configure
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
End of note.
Adding Subtitles with GNOME Subtitles Editor
In Debian, we install the application as:
After it is completely installed, we start it from our shell:
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:
Alternatively, directive below will add extra font feature to your subtitles:
Useful FFmpeg Commands.
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.