ahmedghani commited on
Commit
debbfad
β€’
1 Parent(s): 5dd27e3
Files changed (1) hide show
  1. video_watermark_remover.py +1 -30
video_watermark_remover.py CHANGED
@@ -80,35 +80,6 @@ def remove_watermark(sketch, images_path='frames', output_path='output_images'):
80
 
81
  return gr.Video.update(value=convert_frames_to_video('output_images'), visible=True), gr.Button.update(value='Done!')
82
 
83
- # def convert_video_to_frames(video):
84
- # print(f" input video is : {video}")
85
- # if os.path.exists('input_video.mp4'):
86
- # os.remove('input_video.mp4')
87
-
88
- # ffmpeg.input(video).output('input_video.mp4').run()
89
- # video_path = 'input_video.mp4'
90
-
91
- # if os.path.exists('frames'):
92
- # shutil.rmtree('frames')
93
- # os.makedirs('frames')
94
-
95
- # video_name = os.path.splitext(os.path.basename(video_path))[0]
96
- # ffmpeg.input(video_path).output(f'frames/{video_name}_%d.jpg', qscale=2).run()
97
- # return gr.Image.update(value=f"{os.getcwd()}/frames/{video_name}_1.jpg", interactive=True), gr.Button.update(interactive=True)
98
-
99
- # def convert_frames_to_video(frames_path):
100
- # if os.path.exists('output_video.mp4'):
101
- # os.remove('output_video.mp4')
102
-
103
- # (
104
- # ffmpeg
105
- # .input(f'{frames_path}/*.jpg', pattern_type='glob', framerate=25)
106
- # .output('output_video.mp4')
107
- # .run()
108
- # )
109
- # return gr.Video.update(value='output_video.mp4', visible=True, interactive=True), gr.Button.update(interactive=False)
110
-
111
-
112
  def convert_video_to_frames(video):
113
  if os.path.exists('input_video.mp4'):
114
  os.remove('input_video.mp4')
@@ -154,4 +125,4 @@ def convert_frames_to_video(frames_path):
154
  out.write(img_array[i])
155
  out.release()
156
 
157
- return gr.Video.update(value='output_video.mp4', visible=True, interactive=True), gr.Button.update(interactive=False)
 
80
 
81
  return gr.Video.update(value=convert_frames_to_video('output_images'), visible=True), gr.Button.update(value='Done!')
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  def convert_video_to_frames(video):
84
  if os.path.exists('input_video.mp4'):
85
  os.remove('input_video.mp4')
 
125
  out.write(img_array[i])
126
  out.release()
127
 
128
+ return 'output_video.mp4'