Convert video to character video through Python

 September
2020-12-21 / 0 comments / 836 reading / Checking for inclusion

principle

  1. Export each frame of the video
  2. Convert each frame of picture into ASCII code
  3. The converted ASCII image is synthesized into video

For Python installation, refer to this article
https://www.9ywk.com/Python.html

Libraries to install for Python

opencv

 pip3 install opencv-python

pillow

 pip3 install pillow

After installing the library, place the video in the PY script folder and modify it video_ path After the parameter for your video path name can be run

 if __ name__ == '__ main__': video_ path = 'video/heiren.mp4' save_ pic_ path = 'cache_ pic' save_ charpic_ path = 'cache_ char'

The default exported video is .avi Format, you can modify about 107 lines of code, such as MP4

 video_ writter= VideoWriter('video/new_char_video.mp4' ,

source code

https://github.com/hongcyu/char_painting

Final explanation

The script does not deal with audio and can be processed by other software.


zero

comment

Bloggers have closed comments on all pages
//