In my video frames, two people talk side by side. I want to first get a small clip of the video and then crop them as person 1 and teacher 1.
I used below code snipped to generate these small clips. Everything work conceptually. However, the end resulting video start with still frames where voice played in the background but the corresponding human move not. After a few frames, it continues plying as it should. How can I improve the trim quality of the video. (tmp_vd=trmmed.mp4) (T1_vf=teacher.mp4) (P2_vf= person.mp4)
with tempfile.TemporaryDirectory() as tmpd:
tmp_vd = Path(tmpd) / "video_tmp.mp4"
#trim vide
command_tm_vd = f"ffmpeg -i {file} -ss {itv[0]} -to {itv[1]} -c:v copy -c:a copy {tmp_vd} "
#crop
command_T_crop_vd = f"ffmpeg -i {tmp_vd} -filter:v 'crop={tw}:{th}:{tx1}:{ty1}' {T1_vf}"
command_P_crop_vd = f"ffmpeg -i {tmp_vd} -filter:v 'crop={pw}:{ph}:{px1}:{py1}' {P2_vf}"
#execute
subprocess.call(command_tm_vd, shell=True)
subprocess.call(command_T_crop_vd, shell=True)
subprocess.call(command_P_crop_vd, shell=True)