Posts: 215
Threads: 55
Joined: Sep 2019
(Jun-28-2022, 02:48 PM)snippsat Wrote: Here is a way with free tool Subtitle Edit 3.6.6.
Load .vtt file and now change to .ass(Advanced SubStation Alpha File), then save this .ass file.
Open MKVToolNix and the same,but now drag in the new .ass file generated with Subtitle Edit.
Now get transparent background with the right colors. MKVToolNix embed subtitles in rather strange manner, i.e. they are visible only in VLC player.
At least they are not visible in "Videos" (Ubuntu) and in "Films and TV" (Windows).
GiliSoft do embedding "properly".
Posts: 215
Threads: 55
Joined: Sep 2019
There is another issue with subtitles.
When I use option ydl_opts = {'writesubtitles': True} when downloading videos from arte.tv, I get subtitle file with french subtitles which are not visible when I play video online (because actors speak french).
These French subtitles are probably used when someone plays this video using arte.tv's language settings other than French.
When I use "Web Developer Tools" --> Network on Firefox and put vtt in "Filter", vtt only appears for threads that are not in French, but it seems that yt-dlp is not smart enough to handle this problem.
Posts: 7,317
Threads: 123
Joined: Sep 2016
Jun-29-2022, 01:29 AM
(This post was last modified: Jun-29-2022, 01:29 AM by snippsat.)
(Jun-28-2022, 03:18 PM)Pavel_47 Wrote: MKVToolNix embed subtitles in rather strange manner, i.e. they are visible only in VLC player.
At least they are not visible in "Videos" (Ubuntu) and in "Films and TV" (Windows). The original ones are limited i never use them,it work in many player other than VLC.
Eg SMPlayer, MPC-HC, 5KPlayer..,ect
Posts: 215
Threads: 55
Joined: Sep 2019
Finally, I found a "pure-Python" solution to embed subtitles.
It's based on using MoviePy package.
Here is example how to proceed:
MoviePy example
When I tried this example, error occurred:
Output: =========== RESTART: /home/pavel/python_code/embed_subtitles_v1.py ===========
Traceback (most recent call last):
File "/home/pavel/.local/lib/python3.6/site-packages/moviepy/video/VideoClip.py", line 1137, in __init__
subprocess_call(cmd, logger=None)
File "/home/pavel/.local/lib/python3.6/site-packages/moviepy/tools.py", line 54, in subprocess_call
raise IOError(err.decode('utf8'))
OSError: convert-im6.q16: not authorized `@/tmp/tmpsw5kqzya.txt' @ error/property.c/InterpretImageProperties/3516.
convert-im6.q16: no images defined `PNG32:/tmp/tmpxp1zmiyb.png' @ error/convert.c/ConvertImageCommand/3258.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pavel/python_code/embed_subtitles_v1.py", line 14, in <module>
subtitles = SubtitlesClip(subtl_in, generator)
File "/home/pavel/.local/lib/python3.6/site-packages/moviepy/video/tools/subtitles.py", line 86, in __init__
hasmask = bool(self.make_textclip('T').mask)
File "/home/pavel/python_code/embed_subtitles_v1.py", line 13, in <lambda>
generator = lambda txt: TextClip(txt, font='Arial', fontsize=20, color='yellow')
File "/home/pavel/.local/lib/python3.6/site-packages/moviepy/video/VideoClip.py", line 1146, in __init__
raise IOError(error)
OSError: MoviePy Error: creation of None failed because of the following error:
convert-im6.q16: not authorized `@/tmp/tmpsw5kqzya.txt' @ error/property.c/InterpretImageProperties/3516.
convert-im6.q16: no images defined `PNG32:/tmp/tmpxp1zmiyb.png' @ error/convert.c/ConvertImageCommand/3258.
.
.This error can be due to the fact that ImageMagick is not installed on your computer, or (for Windows users) that you didn't specify the path to the ImageMagick binary in file conf.py, or that the path you specified is incorrect
>>>
I've checked if ImageMagick is installed.
It's the case, ImageMagick is here.
Any suggestions ?
Thanks.
Posts: 215
Threads: 55
Joined: Sep 2019
Here is the workaround to a similar problem:
fix ImageMagick error: convert-im6.q16: unable to open image
But this approach solves the problem, related to PDF, whereas according to my log, the problem is more related to TXT. In ImageMagic's policy.xml, there is no TXT policy. Should I add it?
Posts: 215
Threads: 55
Joined: Sep 2019
(Jun-28-2022, 02:48 PM)snippsat Wrote: Here is a way with free tool Subtitle Edit 3.6.6.
Load .vtt file and now change to .ass(Advanced SubStation Alpha File), then save this .ass file.
Open MKVToolNix and the same,but now drag in the new .ass file generated with Subtitle Edit.
Now get transparent background with the right colors.
Well, here are my "updated" consideration concerning subtitles issue:
There are 3 ways to play a video with subtitles: - hard embedding: this method involves rendering subtitles into particular frames, time-consuming process, requiring intensive processing
- soft embedding: fairly fast method, subtitles are embedded as metadata in the video file, then during playback smart video players (not all!) render the subtitles in particular frames
- do not embed any subtitles, just keep the subtitle file which can be read by smart player while the video is playing
The 2nd method appears to be the most effective because on the one hand it allows rapid processing on the other hand it avoids keeping two files (or more in the case of several languages) - video and subtitles.
The only issue with the 2nd method - there is no possibility to change subtitle color.
In VLC player, this option exists, but seems not to work, regardless specified color subtitles are always white ... at the same time, changing font works.
In another player "Videos" there is no option to work with subtitles... only enable them.
As I understood MKVToolNix do "hard embedding".
It will be nice to find a way to change the color of the subtitles. If this option in VLC is buggy, there are probably other smart players which have such option and this option works.
Posts: 7,317
Threads: 123
Joined: Sep 2016
Jul-04-2022, 10:33 AM
(This post was last modified: Jul-04-2022, 10:33 AM by snippsat.)
(Jul-04-2022, 09:42 AM)Pavel_47 Wrote: The only issue with the 2nd method - there is no possibility to change subtitle color. The meaning is that it show the original colors made in the the .vtt file.
So if look at a file eg Geo Reportage [101139-013-A].fr.vtt.
Then look at one part.
00:01:52.720 --> 00:01:57.320 line:83% align:center
<c.cyan.bg_black>Une femme d'exception a su donner</c>
<c.cyan.bg_black>une âme à ce havre de paix.</c> So at 1:52 to 1:57 the color should be cyan .
Now when convert to .ass with l Subtitle Edit,this work perfectly as show subtitle transparent with right color.
To show this in another player eg SMPlayer
Posts: 215
Threads: 55
Joined: Sep 2019
Jul-04-2022, 11:30 AM
(This post was last modified: Jul-04-2022, 11:30 AM by Pavel_47.)
I've already contacted yt-dlp staff concerning the issue with subtitles on ARTE channel.
As I mentioned before, there are two version of subtitles for German and French: - full version, where everything is subtitled (BAD !)
- correct version, where only languages other than French (or German) are subtitled (GOOD !)
When you specify option -write-subs, it's BAD version that is downloaded.
To access to GOOD, version, you have to use some browser facilities (e.g. "Web Developer Tools" on Ubuntu) and do it manually.
The yt-dlp developer are agree that this bug must be corrected - soon there will be two versions of subtitles: 'FR' and 'GOOD-FR' ('GE' and 'GOOD-GE')
I guess your .vtt is BAD version, because in GOOD there is no color specifications close to titles (example of GOOD vtt in attachment).
Anyway can you confirm that in your VLC you can change color (because I met difficulties with updating my VLC) ?
Sincerely.
Posts: 215
Threads: 55
Joined: Sep 2019
Well ... site refuses .vtt attachments.
Here is fragment of file ...
Output: WEBVTT
STYLE
::cue(.black) {
color: black;
}
STYLE
::cue(.red) {
color: red;
}
STYLE
::cue(.green) {
color: green;
}
STYLE
::cue(.yellow) {
color: yellow;
}
STYLE
::cue(.blue) {
color: blue;
}
STYLE
::cue(.magenta) {
color: magenta;
}
STYLE
::cue(.cyan) {
color: cyan;
}
STYLE
::cue(.white) {
color: white;
}
STYLE
::cue(.bg_black) {
background-color: black;
}
STYLE
::cue(.bg_red) {
background-color: red;
}
STYLE
::cue(.bg_green) {
background-color: green;
}
STYLE
::cue(.bg_yellow) {
background-color: yellow;
}
STYLE
::cue(.bg_blue) {
background-color: blue;
}
STYLE
::cue(.bg_magenta) {
background-color: magenta;
}
STYLE
::cue(.bg_cyan) {
background-color: cyan;
}
STYLE
::cue(.bg_white) {
background-color: white;
}
00:00:45.880 --> 00:00:47.080 line:91% align:center
100 % HUMAIN
00:08:28.920 --> 00:08:31.120 line:83% align:center
REAL HUMANS
(100 % Humain)
00:08:37.040 --> 00:08:38.640 line:91% align:center
Gracieux, élégant,
00:08:39.000 --> 00:08:39.920 line:91% align:center
efficace,
00:08:41.800 --> 00:08:43.960 line:91% align:center
il prolongera votre vie.
00:08:44.560 --> 00:08:46.040 line:91% align:center
Bonjour !
00:08:46.600 --> 00:08:47.400 line:91% align:center
Le HubMax PHD
00:08:47.720 --> 00:08:50.400 line:83% align:center
se charge de toutes
les tâches quotidiennes
00:08:50.600 --> 00:08:53.960 line:83% align:center
Posts: 7,317
Threads: 123
Joined: Sep 2016
Jul-04-2022, 12:02 PM
(This post was last modified: Jul-04-2022, 12:02 PM by snippsat.)
There is no problem at all with .ass(Subtitle Edit) and embed with MKVToolNix.
There is no color change when is embedded then use color in .vtt.
Here in VLC(i have own skin).
![[Image: auwOoA.png]](https://imagizer.imageshack.com/v2/xq90/923/auwOoA.png)
If not embedded just use .vtt the color is white.
Both work fine.
Now i am finish with this as all wok as except,what you mess🧬 up i am not sure.
|