This file contains hidden or 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
# Usage: ffmpeg $(( echo input1.mp4; echo input2.mp4 ) | python3 concat_overlapping_video_framemd5_demuxer.py concat_file.txt) -y -an output.mp4 | |
import os | |
import sys | |
import subprocess | |
ffmpeg_concat_file, md5_last_frame = open(sys.argv[1], 'w'), None | |
for video_path in map(os.path.abspath, list(map(str.strip, sys.stdin))): | |
framemd5 = subprocess.check_output(['ffmpeg', '-nostats', '-hide_banner', '-i', video_path, '-an', '-f', 'framemd5', '-c', 'copy', '-'], stderr = open(os.devnull, 'w')) | |
inpoint, tb_num, tb_den = 0, 1, 1 |