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
| # Stacking with lag | |
| final_clip_lag = clips_array([[video_unload1, video_unload3.set_start(5)], | |
| [video_unload5.set_start(10), video_unload6.set_start(15)]]) | |
| final_clip_lag = final_clip_lag.volumex(0) | |
| final_clip_lag.write_videofile("stack_lag.mp4") |
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
| # Third Video | |
| start_time = '00:01:10' | |
| end_time = '00:01:25' | |
| t1, t2 = convert_seconds(start_time), convert_seconds(end_time) | |
| video_unload5 = myclip.subclip(t1, t2) | |
| # Fourth Video | |
| start_time = '00:01:47' | |
| end_time = '00:02:02' | |
| t1, t2 = convert_seconds(start_time), convert_seconds(end_time) |
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
| # Second video | |
| start_time = '00:00:43' | |
| end_time = '00:00:58' | |
| t1, t2 = convert_seconds(start_time), convert_seconds(end_time) | |
| video_unload3 = myclip.subclip(t1, t2) | |
| # Concat | |
| video_unload4 = concatenate_videoclips([video_unload1, video_unload3]) | |
| video_unload4.write_videofile("step_12.mp4", fps=25) |
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
| # Remove the sound | |
| video_unload2 = video_unload1.volumex(0) | |
| video_unload2.write_videofile("step_1_mute.mp4", fps=25) |
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
| # First Video | |
| start_time = '00:00:15' | |
| end_time = '00:00:30' | |
| t1, t2 = convert_seconds(start_time), convert_seconds(end_time) | |
| video_unload1 = myclip.subclip(t1, t2) | |
| video_unload1.write_videofile("step_1.mp4", fps=25) |
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
| def convert_seconds(tstamp): | |
| # Format 'hh:mm:ss' | |
| s = int(tstamp[6:8]) | |
| m = int(tstamp[3:5])*60 | |
| h = int(tstamp[0:2])*3600 | |
| total = s + m + h | |
| return total | |
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
| from moviepy.editor import VideoFileClip, CompositeVideoClip, concatenate_videoclips , clips_array, vfx, AudioFileClip | |
| from functions import * | |
| # Import Video | |
| filename = '15-12-2021.mp4' | |
| myclip = VideoFileClip(filename) |
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
| # Add location number | |
| img_draw = ImageDraw.Draw(bg) | |
| font = ImageFont.truetype('arial', 60) | |
| img_draw.text((140, 135),'{}'.format(row['Location']),(0,0,0),font=font, stroke_width=1, | |
| stroke_fill="black") |
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
| # Create a function to generate and save a barcode image | |
| def create_ean(number): | |
| my_code = EAN13(number, writer=ImageWriter()) | |
| my_code.save("Img/barcode") | |
| # Import the bar code | |
| create_ean(str(row['SKU Code'])) | |
| bcode = Image.open('Img/barcode.png').convert("RGBA") | |
| bcode = bcode.resize((int(bcode.size[0]*0.5),int(bcode.size[1]*0.5))) | |
| # Add barcode |
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
| # Open Arrow | |
| arr = Image.open('Img/arrow/{}.png'.format(row['arrow'])).convert("RGBA") | |
| arr = arr.resize((int(arr.size[0]*1.35),int(arr.size[1]*1.35))) | |
| # Paste with Coordinates | |
| bg.paste(arr, (-40, 0), arr) | |
| # Icon 1 | |
| zone = Image.open('Img/log/{}.png'.format(row['log'])).convert("RGBA") | |
| perc_size = 0.45 | |
| l1, l2 = int(zone.size[0]*perc_size), int(zone.size[1]*perc_size) |