Convert video to character video through Python

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


  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

Libraries to install for Python


 pip3 install opencv-python


 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

Final explanation

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



Bloggers have closed comments on all pages