From 4efdc458a51b7991d1af55ac7f9005d00a3d2716 Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Wed, 3 Dec 2025 22:13:23 -0500 Subject: [PATCH] Fix H.264 profile applied to PNG cover art stream (exit 234) Critical Bug Fix: - H.264 profile and level were being applied globally (-profile:v, -level:v) - When cover art is present, this affected the PNG encoder stream - PNG encoder doesn't support H.264 profiles, causing exit code 234 - Error: "Unable to parse option value 'main'" on PNG stream Solution: - Use stream-specific specifiers when cover art present - Apply -profile:v:0 and -level:v:0 instead of -profile:v / -level:v - This targets only the first video stream (main video) - PNG cover art stream (1:v) is unaffected - Fixed in both executeConvertJob() and startConvert() UI Fix: - Long output filenames were stretching the settings panel - Added outputHint.Wrapping = fyne.TextWrapWord - Filename now wraps properly instead of expanding horizontally Tested with: - Video with embedded cover art - H.264 profile=main encoding - Long filename conversion --- main.go | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index a64e1a9..f1ca69c 100644 --- a/main.go +++ b/main.go @@ -1183,10 +1183,19 @@ func (s *appState) executeConvertJob(ctx context.Context, job *queue.Job, progre // H.264 profile and level for compatibility if videoCodec == "H.264" && (strings.Contains(actualCodec, "264") || strings.Contains(actualCodec, "h264")) { if h264Profile, _ := cfg["h264Profile"].(string); h264Profile != "" && h264Profile != "Auto" { - args = append(args, "-profile:v", h264Profile) + // Use :v:0 if cover art is present to avoid applying to PNG stream + if hasCoverArt { + args = append(args, "-profile:v:0", h264Profile) + } else { + args = append(args, "-profile:v", h264Profile) + } } if h264Level, _ := cfg["h264Level"].(string); h264Level != "" && h264Level != "Auto" { - args = append(args, "-level:v", h264Level) + if hasCoverArt { + args = append(args, "-level:v:0", h264Level) + } else { + args = append(args, "-level:v", h264Level) + } } } } @@ -1739,6 +1748,7 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject { formatLabels = append(formatLabels, opt.Label) } outputHint := widget.NewLabel(fmt.Sprintf("Output file: %s", state.convert.OutputFile())) + outputHint.Wrapping = fyne.TextWrapWord // DVD-specific aspect ratio selector (only shown for DVD formats) dvdAspectSelect := widget.NewSelect([]string{"4:3", "16:9"}, func(value string) { @@ -4312,11 +4322,20 @@ func (s *appState) startConvert(status *widget.Label, btn, cancelBtn *widget.But // H.264 profile and level for compatibility (iPhone, etc.) if cfg.VideoCodec == "H.264" && (strings.Contains(videoCodec, "264") || strings.Contains(videoCodec, "h264")) { if cfg.H264Profile != "" && cfg.H264Profile != "Auto" { - args = append(args, "-profile:v", cfg.H264Profile) + // Use :v:0 if cover art is present to avoid applying to PNG stream + if hasCoverArt { + args = append(args, "-profile:v:0", cfg.H264Profile) + } else { + args = append(args, "-profile:v", cfg.H264Profile) + } logging.Debug(logging.CatFFMPEG, "H.264 profile: %s", cfg.H264Profile) } if cfg.H264Level != "" && cfg.H264Level != "Auto" { - args = append(args, "-level:v", cfg.H264Level) + if hasCoverArt { + args = append(args, "-level:v:0", cfg.H264Level) + } else { + args = append(args, "-level:v", cfg.H264Level) + } logging.Debug(logging.CatFFMPEG, "H.264 level: %s", cfg.H264Level) } }