Compare commits
34 Commits
ab3207d441
...
7717bf13a1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7717bf13a1 | ||
|
|
172e500174 | ||
| f7973769b6 | |||
| c78f11109e | |||
| a27e2eaaeb | |||
| a28d3cac8e | |||
| da5f023390 | |||
| e2a75a64bd | |||
| dd2827dc71 | |||
| c6a1692f90 | |||
| bda7e13042 | |||
| e178f93663 | |||
| 123add14eb | |||
| 0786589239 | |||
| ba41c6dad4 | |||
| d3fc2368c8 | |||
| 3154a9f948 | |||
| c93a2ce892 | |||
| fefb3b8990 | |||
| 637e5b2969 | |||
| 6fa231b010 | |||
|
|
baf1592fc5 | ||
|
|
ec0ac61133 | ||
|
|
d1787dc7e6 | ||
|
|
949deef9e4 | ||
|
|
7c18c01322 | ||
|
|
cb7608ed7b | ||
| 7753c11327 | |||
| b6788f4a37 | |||
| 546c248535 | |||
|
|
29830df36c | ||
|
|
b63d2b668f | ||
| dcfb1397bf | |||
| ce4b4b218a |
1
wails/assets/assets/index-BDrFF8AO.css
Normal file
1
wails/assets/assets/index-BDrFF8AO.css
Normal file
File diff suppressed because one or more lines are too long
17
wails/assets/assets/index-DSuQhuGl.js
Normal file
17
wails/assets/assets/index-DSuQhuGl.js
Normal file
File diff suppressed because one or more lines are too long
@ -4,8 +4,9 @@ import (
|
|||||||
"embed"
|
"embed"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
|
||||||
"videoconcat/services"
|
"videoconcat/services"
|
||||||
|
|
||||||
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed assets
|
//go:embed assets
|
||||||
@ -54,9 +55,9 @@ func main() {
|
|||||||
// 创建窗口
|
// 创建窗口
|
||||||
services.LogDebug("创建应用窗口...")
|
services.LogDebug("创建应用窗口...")
|
||||||
window := app.Window.NewWithOptions(application.WebviewWindowOptions{
|
window := app.Window.NewWithOptions(application.WebviewWindowOptions{
|
||||||
Title: "视频拼接工具",
|
Title: "视频拼接工具",
|
||||||
Width: 1100,
|
Width: 1100,
|
||||||
Height: 800,
|
Height: 800,
|
||||||
MinWidth: 800,
|
MinWidth: 800,
|
||||||
MinHeight: 600,
|
MinHeight: 600,
|
||||||
})
|
})
|
||||||
|
|||||||
@ -23,16 +23,16 @@ func NewExtractService() *ExtractService {
|
|||||||
|
|
||||||
// ExtractFrameRequest 抽帧请求
|
// ExtractFrameRequest 抽帧请求
|
||||||
type ExtractFrameRequest struct {
|
type ExtractFrameRequest struct {
|
||||||
FolderPath string `json:"folderPath"`
|
FolderPath string `json:"folderPath"`
|
||||||
ExtractCount int `json:"extractCount"` // 每个视频生成的数量
|
ExtractCount int `json:"extractCount"` // 每个视频生成的数量
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExtractFrameResult 抽帧结果
|
// ExtractFrameResult 抽帧结果
|
||||||
type ExtractFrameResult struct {
|
type ExtractFrameResult struct {
|
||||||
VideoPath string `json:"videoPath"`
|
VideoPath string `json:"videoPath"`
|
||||||
OutputPath string `json:"outputPath"`
|
OutputPath string `json:"outputPath"`
|
||||||
Success bool `json:"success"`
|
Success bool `json:"success"`
|
||||||
Error string `json:"error,omitempty"`
|
Error string `json:"error,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListVideos 列出文件夹中的视频文件
|
// ListVideos 列出文件夹中的视频文件
|
||||||
@ -213,37 +213,37 @@ func (s *ExtractService) ExtractFrames(ctx context.Context, req ExtractFrameRequ
|
|||||||
|
|
||||||
// 检查文件是否已存在
|
// 检查文件是否已存在
|
||||||
if _, err := os.Stat(t.OutputPath); err == nil {
|
if _, err := os.Stat(t.OutputPath); err == nil {
|
||||||
|
mu.Lock()
|
||||||
|
current++
|
||||||
|
result := ExtractFrameResult{
|
||||||
|
VideoPath: t.VideoPath,
|
||||||
|
OutputPath: t.OutputPath,
|
||||||
|
Success: true,
|
||||||
|
}
|
||||||
|
results = append(results, result)
|
||||||
|
mu.Unlock()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
err := s.RemoveFrameRandom(ctx, t.VideoPath, t.OutputPath)
|
||||||
mu.Lock()
|
mu.Lock()
|
||||||
current++
|
current++
|
||||||
result := ExtractFrameResult{
|
var result ExtractFrameResult
|
||||||
VideoPath: t.VideoPath,
|
if err != nil {
|
||||||
OutputPath: t.OutputPath,
|
result = ExtractFrameResult{
|
||||||
Success: true,
|
VideoPath: t.VideoPath,
|
||||||
|
Success: false,
|
||||||
|
Error: err.Error(),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
result = ExtractFrameResult{
|
||||||
|
VideoPath: t.VideoPath,
|
||||||
|
OutputPath: t.OutputPath,
|
||||||
|
Success: true,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
results = append(results, result)
|
results = append(results, result)
|
||||||
mu.Unlock()
|
mu.Unlock()
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
err := s.RemoveFrameRandom(ctx, t.VideoPath, t.OutputPath)
|
|
||||||
mu.Lock()
|
|
||||||
current++
|
|
||||||
var result ExtractFrameResult
|
|
||||||
if err != nil {
|
|
||||||
result = ExtractFrameResult{
|
|
||||||
VideoPath: t.VideoPath,
|
|
||||||
Success: false,
|
|
||||||
Error: err.Error(),
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
result = ExtractFrameResult{
|
|
||||||
VideoPath: t.VideoPath,
|
|
||||||
OutputPath: t.OutputPath,
|
|
||||||
Success: true,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
results = append(results, result)
|
|
||||||
mu.Unlock()
|
|
||||||
}(task)
|
}(task)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,29 +301,28 @@ func (s *ExtractService) ModifyVideosMetadata(ctx context.Context, folderPath st
|
|||||||
outputFileName := fmt.Sprintf("modify%d%s", randomNum, filepath.Base(videoPath))
|
outputFileName := fmt.Sprintf("modify%d%s", randomNum, filepath.Base(videoPath))
|
||||||
outputPath := filepath.Join(outputDir, outputFileName)
|
outputPath := filepath.Join(outputDir, outputFileName)
|
||||||
|
|
||||||
err := s.ModifyByMetadata(ctx, videoPath, outputPath)
|
err := s.ModifyByMetadata(ctx, videoPath, outputPath)
|
||||||
mu.Lock()
|
mu.Lock()
|
||||||
current++
|
current++
|
||||||
var result ExtractFrameResult
|
var result ExtractFrameResult
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result = ExtractFrameResult{
|
result = ExtractFrameResult{
|
||||||
VideoPath: videoPath,
|
VideoPath: videoPath,
|
||||||
Success: false,
|
Success: false,
|
||||||
Error: err.Error(),
|
Error: err.Error(),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
result = ExtractFrameResult{
|
||||||
|
VideoPath: videoPath,
|
||||||
|
OutputPath: outputPath,
|
||||||
|
Success: true,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
results = append(results, result)
|
||||||
result = ExtractFrameResult{
|
mu.Unlock()
|
||||||
VideoPath: videoPath,
|
|
||||||
OutputPath: outputPath,
|
|
||||||
Success: true,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
results = append(results, result)
|
|
||||||
mu.Unlock()
|
|
||||||
}(video)
|
}(video)
|
||||||
}
|
}
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
return results, nil
|
return results, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -381,16 +381,16 @@ func (s *VideoService) JoinVideos(ctx context.Context, req VideoConcatRequest) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
helper := GetFFmpegHelper()
|
helper := GetFFmpegHelper()
|
||||||
if !helper.IsAvailable() {
|
if !helper.IsAvailable() {
|
||||||
LogError("ffmpeg 不可用")
|
LogError("ffmpeg 不可用")
|
||||||
result.Status = "拼接失败"
|
result.Status = "拼接失败"
|
||||||
result.Progress = "失败"
|
result.Progress = "失败"
|
||||||
mu.Lock()
|
mu.Lock()
|
||||||
results = append(results, result)
|
results = append(results, result)
|
||||||
mu.Unlock()
|
mu.Unlock()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
cmd := helper.Command(args...)
|
cmd := helper.Command(args...)
|
||||||
cmd.Run() // 忽略错误,水印是可选的
|
cmd.Run() // 忽略错误,水印是可选的
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -438,4 +438,3 @@ func (s *VideoService) JoinVideos(ctx context.Context, req VideoConcatRequest) (
|
|||||||
wg.Wait()
|
wg.Wait()
|
||||||
return results, nil
|
return results, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user