티스토리 뷰
| 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
- Innovation&Hurdles
- 치매
- Decorator
- 전류
- 오블완
- DYOV
- BSC
- image
- 아두이노
- 빌리언트
- Video
- Hurdles
- ServantClock
- Innovations&Hurdles
- BiliChild
- 혁신과허들
- bilient
- 허들
- 둎
- 티스토리챌린지
- Innovations
- 혁신
- 심심풀이
- 심심풀이치매방지기
- 치매방지
- arduino
- 빌리칠드
- 배프
- 전압
- 절연형
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
글 보관함

