| 
					
				 | 
			
			
				@@ -86,30 +86,26 @@ class FFmpeg(): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      截取原视频最后一帧 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @classmethod 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    def video_png(cls, new_video_path, video_path_url): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    def video_png(cls, new_video_path, video_path_url, pw_random_id): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         jpg_url 生成图片位置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         :param new_video_path: 视频地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         :return: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        try: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            jpg_url = video_path_url + 'png.jpg' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            # 获取视频时长 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            total_duration = cls.get_video_duration(new_video_path) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            time_offset = total_duration - 1  # 提取倒数第一秒的帧 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            # 获取视频最后一秒,生成.jpg 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            subprocess.run( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                ['ffmpeg', '-ss', str(time_offset), '-i', new_video_path, '-t', str(total_duration), '-vf', 'fps=1', "-y", jpg_url]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return jpg_url 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        except Exception as e: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return None 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        jpg_url = video_path_url + str(pw_random_id) + 'png.jpg' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        # 获取视频时长 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        total_duration = cls.get_video_duration(new_video_path) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        time_offset = total_duration - 1  # 提取倒数第一秒的帧 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        # 获取视频最后一秒,生成.jpg 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        subprocess.run( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ['ffmpeg', '-ss', str(time_offset), '-i', new_video_path, '-t', str(total_duration), '-vf', 'fps=1', "-y", jpg_url]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return jpg_url 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      生成片尾视频 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @classmethod 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    def pw_video(cls, jpg_url, video_path_url, pw_url, pw_srt): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    def pw_video(cls, jpg_url, video_path_url, pw_url, pw_srt, pw_random_id): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         # 添加音频到图片 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         jpg_url 图片地址 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -120,7 +116,7 @@ class FFmpeg(): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         pw_url 生成视频地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         :return: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        pw_srt_path = video_path_url + 'pw_video.srt' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pw_srt_path = video_path_url + str(pw_random_id) +'pw_video.srt' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         # 创建临时字幕文件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         with open(pw_srt_path, 'w') as f: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             f.write(pw_srt) 
			 |