Skip to content

Instantly share code, notes, and snippets.

View CathyLou's full-sized avatar
🎃
go in search of life

Cathy Lou CathyLou

🎃
go in search of life
  • Peking University
  • Beijing
View GitHub Profile
import subprocess
command = 'ffmpeg -y -i {} -strict -2 {}'.format('SRC.mp4', 'SRC_VOICE.wav')
subprocess.call(command, shell=True)
save_filename = 'result.mp4'
command = 'ffmpeg -y -i {} -i {} -strict -2 -q:v 1 {}'.format('SRC_VOICE.wav', 'TARGET.mp4', save_filename)
subprocess.call(command, shell=True)
from moviepy.editor import * # !pip install moviepy
import os
from glob import glob
# 定义一个数组
L = []
filelist = glob('/data1/louming/*.mp4')
for filePath in filelist:
import os
from PIL import Image
import numpy as np
def add_alpha_channel_path(source_img_path,alpha_img_path):
alpha_img=Image.open(alpha_img_path)
source_img=Image.open(source_img_path)
output_img = source_img.convert('RGBA')
output_img.putalpha(alpha_img)
result_img=Image.new('RGB',output_img.size,(255,255,255))
from PIL import Image
import numpy as np
from add_alpha_channel import add_alpha_channel
import cv2
def color_transfer(source_img, target_img, image_mask=None, target_image_mask=None, img_filename=None):
"""
transfer iamge color according to target_image
:param source_image: PIL image, RGB
:param target_image: PIL image, RGB