Skip to content

chinsyo/video2ascii

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

video2ascii

Transfer video to ascii animation using ffmpeg.

Screenshot

screenshot raw_video_frame ascii_string ascii_frame

Prerequisite

  • Have ffmpeg installed. It's recommend using homebrew.
  • Download a font file for ascii image.
  • Basic knowledge about using command line.

Steps

  1. extract audio
ffmpeg -i input.mp4 -vn -acodec copy output-audio.aac
  1. extract video frames
ffmpeg -i input.mp4 %04d.bmp
mkdir frame_images
mv *.bmp frame_images
  1. generate ascii string for each frame
mkdir ascii_files
ls frame_images | grep .bmp | xargs -n1 python3 image_to_ascii.py
  1. generate image frame for each ascii string
mkdir ascii_images
ls ascii_files | grep .txt | xargs -n1 python3 ascii_to_image.py
  1. combine frames
cd ascii_images
ffmpeg -framerate 30 -i %04d.png -c:v libx264 -pix_fmt yuv420p -crf 23 -vf scale=-2:720 output-video.mp4
  1. mix video and audio
ffmpeg -i output-video.mp4 -i output-audio.aac -c:v copy -c:a aac -strict experimental output.mp4

About

Transfer video to ascii animation using ffmpeg.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •