This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from moviepy.editor import * # !pip install moviepy | |
import os | |
from glob import glob | |
# 定义一个数组 | |
L = [] | |
filelist = glob('/data1/louming/*.mp4') | |
for filePath in filelist: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |