티스토리 뷰
Parameter | Description | Remarks |
SourceVideoPath | ||
MovingOutline | "Y" | "Y", None |
OutputVideoPath | ||
OutlineColor | [0, 255, 255] | [R, G, B] |
def Test_ExtractOutlinefromVideo():
param1 = {
'SourceVideoPath': "./DanceVideos/Dance132.mp4",
'MovingOutline': "Y",
'OutputVideoPath': "./VideoOutput/Test001.mp4",
'OutlineColor': [0, 255, 255]
}
videoClass.ExtractOutlinefromVideo(param1)
def ExtractOutlinefromVideo(self, paramIn):
# paramIn : {'SourceVideoPath', 'OutlineColor', 'MovingOutline', 'TransparentOption', 'OutputVideoPath'}
print("Starting ...... ExtractOutlinefromVideo()")
sourceVideoPath = paramIn.get('SourceVideoPath')
movingOutline = paramIn.get('MovingOutline')
outPath = paramIn.get('OutputVideoPath')
if not outPath: outPath = self.OutputFolder + "/Video" + bTime.GetDateString() + "_" + str(random.randint(2000, 3000)) + ".mp4"
outlineColor = paramIn.get('OutlineColor') # [255, 0, 0]
self.OutlineColor = outlineColor
# Load the video
clip = VideoFileClip(sourceVideoPath)
## audio = AudioFileClip(sourceVideoPath)
# Initialize the previous frame
prev_frame = None
self.prevFrame = None
# Apply the function to each frame of the video
if movingOutline: outline_clip = clip.fl_image(lambda image: self.ExtractMovingOutline(image, ))
else: outline_clip = clip.fl_image(lambda image: self.ExtractOutline(image, ))
outline_clip = outline_clip.without_audio()
# Write the result to a file
## outline_clip = outline_clip.set_audio(audio)
outline_clip.write_videofile(outPath, codec='libx264')
return outPath
반응형
'SWDesk' 카테고리의 다른 글
[Python] Methods for 'List' (0) | 2023.12.16 |
---|---|
[Python] Serial 통신 예제 (0) | 2023.12.14 |
[Python] 오디오 파일의 재생 속도 연장(재생시간 축소) (0) | 2023.11.24 |
[Python] Convert mp3 to wav (0) | 2023.11.23 |
[Python] Frequency Shift (0) | 2023.11.23 |
반응형
250x250
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- badp
- 허들
- Hurdles
- 심심풀이
- BSC
- Innovations&Hurdles
- 절연형
- Innovations
- bilient
- Innovation&Hurdles
- 치매
- 전압전류모니터링
- 전류
- 둎
- DYOV
- arduino
- 티스토리챌린지
- Video
- 혁신
- 아두이노
- 빌리언트
- 배프
- 혁신과허들
- ServantClock
- 심심풀이치매방지기
- Decorator
- image
- 치매방지
- 전압
- 오블완
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
글 보관함