Jul-03-2022, 09:44 AM
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:
It's the case, ImageMagick is here.
Any suggestions ?
Thanks.
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.