Fix WMV snippet encoding and simplify UI labels
WMV Encoder Fix: - WMV files now use wmv2 encoder (ffmpeg compatible) instead of wmv3 - Audio uses wmav2 for WMV files - High quality bitrate (2000k) for WMV video - Fallback handling for unsupported source codecs UI Simplification: - Changed "High Quality (source format/codecs)" to "Match Source Format" - Simplified hint text to just "Unchecked = Use Conversion Settings" - More concise and less confusing labels
This commit is contained in:
parent
4d1b853f90
commit
533e779554
73
main.go
73
main.go
|
|
@ -3365,9 +3365,9 @@ func (s *appState) executeSnippetJob(ctx context.Context, job *queue.Job, progre
|
||||||
var args []string
|
var args []string
|
||||||
|
|
||||||
if useSourceFormat {
|
if useSourceFormat {
|
||||||
// High Quality mode: Re-encode with source codecs for PRECISE duration
|
// Source Format mode: Re-encode matching source format for PRECISE duration
|
||||||
// Output to source format to preserve quality
|
|
||||||
conv := s.convert
|
conv := s.convert
|
||||||
|
isWMV := strings.HasSuffix(strings.ToLower(inputPath), ".wmv")
|
||||||
|
|
||||||
args = []string{
|
args = []string{
|
||||||
"-ss", start,
|
"-ss", start,
|
||||||
|
|
@ -3375,12 +3375,28 @@ func (s *appState) executeSnippetJob(ctx context.Context, job *queue.Job, progre
|
||||||
"-t", fmt.Sprintf("%d", snippetLength),
|
"-t", fmt.Sprintf("%d", snippetLength),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use source video codec
|
// Handle WMV files specially - use wmv2 encoder
|
||||||
if src.VideoCodec != "" {
|
if isWMV {
|
||||||
args = append(args, "-c:v", src.VideoCodec)
|
args = append(args, "-c:v", "wmv2")
|
||||||
|
args = append(args, "-b:v", "2000k") // High quality bitrate for WMV
|
||||||
|
args = append(args, "-c:a", "wmav2")
|
||||||
|
if conv.AudioBitrate != "" {
|
||||||
|
args = append(args, "-b:a", conv.AudioBitrate)
|
||||||
|
} else {
|
||||||
|
args = append(args, "-b:a", "192k")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// For non-WMV: use source codec or fallback to H.264
|
||||||
|
videoCodec := src.VideoCodec
|
||||||
|
if videoCodec == "" || strings.Contains(strings.ToLower(videoCodec), "wmv") {
|
||||||
|
videoCodec = "libx264"
|
||||||
|
}
|
||||||
|
|
||||||
|
args = append(args, "-c:v", videoCodec)
|
||||||
|
|
||||||
// Apply encoder preset if supported codec
|
// Apply encoder preset if supported codec
|
||||||
if strings.Contains(strings.ToLower(src.VideoCodec), "264") ||
|
if strings.Contains(strings.ToLower(videoCodec), "264") ||
|
||||||
strings.Contains(strings.ToLower(src.VideoCodec), "265") {
|
strings.Contains(strings.ToLower(videoCodec), "265") {
|
||||||
if conv.EncoderPreset != "" {
|
if conv.EncoderPreset != "" {
|
||||||
args = append(args, "-preset", conv.EncoderPreset)
|
args = append(args, "-preset", conv.EncoderPreset)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -3392,41 +3408,22 @@ func (s *appState) executeSnippetJob(ctx context.Context, job *queue.Job, progre
|
||||||
args = append(args, "-crf", "18")
|
args = append(args, "-crf", "18")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// Fallback to libx264 if no codec detected
|
|
||||||
args = append(args, "-c:v", "libx264")
|
|
||||||
if conv.EncoderPreset != "" {
|
|
||||||
args = append(args, "-preset", conv.EncoderPreset)
|
|
||||||
} else {
|
|
||||||
args = append(args, "-preset", "slow")
|
|
||||||
}
|
|
||||||
if conv.CRF != "" {
|
|
||||||
args = append(args, "-crf", conv.CRF)
|
|
||||||
} else {
|
|
||||||
args = append(args, "-crf", "18")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use source audio codec
|
// Audio codec
|
||||||
if src.AudioCodec != "" {
|
audioCodec := src.AudioCodec
|
||||||
args = append(args, "-c:a", src.AudioCodec)
|
if audioCodec == "" || strings.Contains(strings.ToLower(audioCodec), "wmav") {
|
||||||
// Add bitrate for common codecs
|
audioCodec = "aac"
|
||||||
if strings.Contains(strings.ToLower(src.AudioCodec), "aac") ||
|
}
|
||||||
strings.Contains(strings.ToLower(src.AudioCodec), "mp3") {
|
|
||||||
|
args = append(args, "-c:a", audioCodec)
|
||||||
|
if strings.Contains(strings.ToLower(audioCodec), "aac") ||
|
||||||
|
strings.Contains(strings.ToLower(audioCodec), "mp3") {
|
||||||
if conv.AudioBitrate != "" {
|
if conv.AudioBitrate != "" {
|
||||||
args = append(args, "-b:a", conv.AudioBitrate)
|
args = append(args, "-b:a", conv.AudioBitrate)
|
||||||
} else {
|
} else {
|
||||||
args = append(args, "-b:a", "192k")
|
args = append(args, "-b:a", "192k")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// Fallback to AAC if no codec detected
|
|
||||||
args = append(args, "-c:a", "aac")
|
|
||||||
if conv.AudioBitrate != "" {
|
|
||||||
args = append(args, "-b:a", conv.AudioBitrate)
|
|
||||||
} else {
|
|
||||||
args = append(args, "-b:a", "192k")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
args = append(args, "-y", "-hide_banner", "-loglevel", "error", outputPath)
|
args = append(args, "-y", "-hide_banner", "-loglevel", "error", outputPath)
|
||||||
|
|
@ -5363,12 +5360,12 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Snippet output mode
|
// Snippet output mode
|
||||||
snippetModeLabel := widget.NewLabel("Snippet Mode:")
|
snippetModeLabel := widget.NewLabel("Snippet Output:")
|
||||||
snippetModeCheck := widget.NewCheck("High Quality (source format/codecs)", func(checked bool) {
|
snippetModeCheck := widget.NewCheck("Match Source Format", func(checked bool) {
|
||||||
state.snippetSourceFormat = checked
|
state.snippetSourceFormat = checked
|
||||||
})
|
})
|
||||||
snippetModeCheck.SetChecked(state.snippetSourceFormat)
|
snippetModeCheck.SetChecked(state.snippetSourceFormat)
|
||||||
snippetModeHint := widget.NewLabel("Unchecked = Use Conversion Settings (preview output quality)")
|
snippetModeHint := widget.NewLabel("Unchecked = Use Conversion Settings")
|
||||||
snippetModeHint.TextStyle = fyne.TextStyle{Italic: true}
|
snippetModeHint.TextStyle = fyne.TextStyle{Italic: true}
|
||||||
|
|
||||||
snippetConfigRow := container.NewVBox(
|
snippetConfigRow := container.NewVBox(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user