Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ the separate sources ZIP is not needed to run the app.

- **Batch processing:** queue several folders at once. Each added folder becomes
its own DVD set, including its subfolders. Each video file becomes a DVD title.
Drop individual videos too; multiple files can share a set or become separate jobs.
- **Automatic disc layout:** spread videos across as many discs as needed. Keep
filename order, or choose space efficiency to make better use of disc space.
Videos stay whole; a file that cannot fit on one disc is reported.
- **Simple, customizable menus:** choose text or thumbnails, set backgrounds,
fonts and colors, and save presets. Menus include title selection, page
navigation and Play All.
- **DVD format choices:** PAL or NTSC, DVD-5 or DVD-9, with 4:3 and 16:9 video
handled automatically.
handled automatically. Confirmed 4:3 footage inside black 16:9 side borders is
cropped without stretching. Single-title jobs can start playback without a menu.
- **Pause and resume:** save the queue and continue later, reusing completed
encodes. Errors are shown against the affected folder so other sets can continue.

Expand All @@ -45,10 +47,33 @@ using easyDVD.
1. Extract the complete Windows ZIP and open **easyDVD.exe**. Keep the `tools`
folder beside it.
2. Drag folders into the window or use **Add folders**. Review the videos and
choose an output folder and a local work folder with enough free space.
choose an output folder and a local work folder with enough free space. You can
also drop video files. Hold Shift while selecting files to select a range.
3. Choose your TV standard, disc capacity and menu style, then select
**Start / resume**. Finished ISO files appear in your output folder.

Save **Default settings** for future jobs. Each new job takes a copy; existing
jobs keep their settings. Use **Job settings** to override the TV standard,
disc capacity, output folder and menu options for one job. Menu layout and
titles per page live in **Menu**.

Job tiles show status and completion percentage. Click a tile to select it;
Ctrl-click toggles additional jobs and Shift-click selects a
range. Files use the same selection behavior. Use **Remove selected** or **Delete**.
The X on a tile removes that job. Removing active jobs asks to stop them first;
source and output files are kept. Overall progress appears in the bottom bar.

FFmpeg performs two-pass MPEG-2 encoding. **Balanced** is the default, targeting
7.5 Mbps video with 256 kbps AC-3 audio for speed and smaller files. Choose
**Quality** in Job settings for 9 Mbps video, 448 kbps audio and more detailed
analysis. easyDVD adds discs instead of reducing the chosen profile's bitrate to
squeeze more footage onto one disc. FFmpeg remains an external dependency;
first run can locate it or download a private copy. See [Encoding quality](docs/ENCODERS.md).
Single-video jobs default to automatic playback without a menu; multi-video
jobs default to a menu. Override either choice in **Job settings → Playback**.
With **No menu**, every disc plays its included videos in order and stops at
the end. Menu editing is disabled until menus are enabled again.

For more on menu appearance and presets, see [Menu settings](docs/MENUS.md).
Report problems or suggest changes through [GitHub Issues](https://github.com/maghofer/easyDVD/issues).

Expand Down
5 changes: 2 additions & 3 deletions THIRD_PARTY.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,5 @@ files used by older candidates. The current helper source recipe is in
`scripts/toolchain/README.md`. No bit-identical reproduction claim is made; the
matching source and all our build changes are supplied.

HCenc, AviSynth, FFMS2, and mpeg2enc are optional benchmark inputs and are not
distributed by easyDVD. No encoder superiority claim is made without a
completed comparison on representative material.
FFmpeg is the sole video encoder. No AviSynth runtime or separately installed
MPEG-2 encoder is required.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.0-preview.8
0.1.0-preview.9
207 changes: 124 additions & 83 deletions cmd/easydvd-benchmark/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// easydvd-benchmark compares MPEG-2 encoders against a single normalized reference.
// easydvd-benchmark measures the production encoder against a normalized reference.
package main

import (
Expand All @@ -8,10 +8,10 @@ import (
"fmt"
"io"
"os"
"os/exec"
"os/signal"
"path/filepath"
"regexp"
"runtime"
"strconv"
"strings"
"time"
Expand All @@ -23,21 +23,33 @@ import (
)

type Result struct {
Encoder string
Status string
Seconds float64
Bytes int64
PSNR string
SSIM string
DVDISO string
Error string
Run int
Encoder string
Status string
Seconds float64
CPUSeconds float64
CPUPercent float64
EncodingSeconds float64
EncodingCPUPercent float64
EncodingFPS float64
Steps []process.Metrics
Bytes int64
PSNR string
SSIM string
DVDISO string
Error string
}
type Report struct {
InputMode string
LogicalCPUs int
Repeats int
Preparation []process.Metrics
Source string
SourceSHA256 string
Reference string
ReferenceSHA256 string
Standard string
Profile string
Duration float64
Tools []media.ToolStatus
Results []Result
Expand All @@ -61,13 +73,17 @@ func run() error {
input := flag.String("input", "", "Representative source video")
output := flag.String("output", "", "New directory for references, encoded samples, ISOs and report")
standard := flag.String("standard", "PAL", "PAL or NTSC")
profile := flag.String("profile", model.ProfileBalanced, "Balanced or Quality production encoding")
seconds := flag.Float64("seconds", 10, "Maximum sample duration")
mpeg := flag.String("mpeg2enc", "", "Optional mpeg2enc executable")
hc := flag.String("hcenc", "", "Optional HCenc executable")
ffms := flag.String("ffms2", "", "FFMS2 AviSynth plugin DLL, required for HCenc")
offset := flag.Float64("offset", 0, "Start time in seconds for the sample")
repeats := flag.Int("repeats", 1, "Number of sequential production encoder runs")
sourcePipeline := flag.Bool("source-pipeline", false, "Include source decoding/scaling; input must be a complete sample within -seconds, with -offset 0")
flag.Parse()
if *offset < 0 || *repeats < 1 {
return fmt.Errorf("offset must be nonnegative and repeats positive")
}
if *input == "" || *output == "" {
return fmt.Errorf("use -input VIDEO -output NEW_DIRECTORY [-mpeg2enc EXE] [-hcenc EXE -ffms2 DLL]")
return fmt.Errorf("use -input VIDEO -output NEW_DIRECTORY")
}
if *seconds <= 0 {
return fmt.Errorf("sample duration must be positive")
Expand All @@ -88,6 +104,7 @@ func run() error {
}
s := model.DefaultSettings(dir)
s.Standard = *standard
s.EncodingProfile = *profile
s.WorkDir = filepath.Join(dir, "work")
s.OutputDir = filepath.Join(dir, "output")
s.Encoders = 1
Expand All @@ -109,85 +126,96 @@ func run() error {
if err != nil {
return err
}
duration := min(original.Duration, *seconds)
// Normalize once; encoder comparisons must not include different scaling or cadence conversions.
var preparation []process.Metrics
prepCtx := process.Observe(ctx, func(m process.Metrics) { preparation = append(preparation, m) })
original, err = tools.DetectPillarbox(prepCtx, original, source, log)
if err != nil {
return err
}
duration := min(original.Duration-*offset, *seconds)
if duration <= 0 {
return fmt.Errorf("offset is beyond source duration")
}
if *sourcePipeline && (*offset != 0 || duration < original.Duration) {
return fmt.Errorf("-source-pipeline needs a complete sample: use -offset 0 and -seconds at least the source duration")
}
// Progressive references make frame-aligned PSNR/SSIM meaningful. The full
// source pipeline benchmark deliberately excludes retained interlaced input.
interlaced := original.FieldOrder == "tt" || original.FieldOrder == "bb" || original.FieldOrder == "tb" || original.FieldOrder == "bt"
if *sourcePipeline && interlaced {
return fmt.Errorf("use a progressive sample for -source-pipeline frame quality measurements")
}
normalized := original
normalized.FieldOrder = "progressive"
filter, _ := media.VideoFilter(normalized, s)
if interlaced {
filter = "bwdif=mode=send_frame:parity=auto:deint=all," + filter
}

reference := filepath.Join(dir, "reference.y4m")
if err = process.Run(ctx, tools.FFmpeg, []string{"-hide_banner", "-nostdin", "-y", "-i", source, "-map", fmt.Sprintf("0:%d", original.VideoStream), "-vf", filter, "-t", fmt.Sprintf("%.6f", duration), "-pix_fmt", "yuv420p", "-an", "-f", "yuv4mpegpipe", reference}, process.Options{Log: log}); err != nil {
if err = process.Run(prepCtx, tools.FFmpeg, []string{"-hide_banner", "-nostdin", "-y", "-ss", fmt.Sprintf("%.6f", *offset), "-i", source, "-map", fmt.Sprintf("0:%d", original.VideoStream), "-vf", filter, "-t", fmt.Sprintf("%.6f", duration), "-pix_fmt", "yuv420p", "-an", "-f", "yuv4mpegpipe", reference}, process.Options{Log: log}); err != nil {
return err
}
ref := model.Video{ID: "reference", Path: reference, Relative: "reference.y4m", Label: "Encoder sample", Width: 720, Height: s.Height(), DAR: 4.0 / 3, FPS: media.Ratio(s.FPS()), Duration: duration, AudioStream: -1, FieldOrder: "progressive"}
ref := model.Video{ID: "reference", Path: reference, Relative: "reference.y4m", Label: "Encoder sample", Width: 720, Height: s.Height(), DAR: 4.0 / 3, FPS: media.Ratio(s.FPS()), Duration: duration, AudioStream: -1, FieldOrder: "progressive", CropChecked: true, CropVersion: media.PillarboxVersion}
if original.Aspect() == "16:9" {
ref.DAR = 16.0 / 9
}
report := Report{Source: source, Reference: reference, Standard: s.Standard, Duration: duration, Tools: tools.Check(ctx), Notes: []string{"Prepared frames are identical for all encoder inputs; audio and menu size are excluded from video-size comparisons.", "FFmpeg and HCenc target 8 Mbps average / 9 Mbps peak. mpeg2enc uses quality 2 with an 8 Mbps cap; compare measured sizes as well as quality.", "SSIM and PSNR are supporting measurements. Review grain, fine detail, motion, banding and cadence visually before choosing an encoder.", "A generated ISO confirms basic authoring interoperability; physical-player validation and full DVD/VBV conformance remain separate checks.", "HCenc requires a matching AviSynth installation and FFMS2 plugin. Optional encoders are not redistributed by easyDVD."}}
report.SourceSHA256, _ = media.HashFile(ctx, source)
report.ReferenceSHA256, _ = media.HashFile(ctx, reference)
for _, name := range []string{"FFmpeg", "mpeg2enc", "HCenc"} {
result := Result{Encoder: name, Status: "not available"}
candidate := filepath.Join(dir, strings.ToLower(name))
report := Report{Source: source, Reference: reference, Standard: s.Standard, Profile: s.Profile(), Duration: duration, Tools: tools.Check(ctx),
LogicalCPUs: runtime.NumCPU(), Repeats: *repeats, Preparation: preparation,
InputMode: "DVD-resolution prepared progressive reference",
Notes: []string{
fmt.Sprintf("The %s two-pass FFmpeg profile targets %d kbps video with a 9 Mbps peak and %d kbps stereo AC-3. Video sizes exclude audio and DVD muxing.", s.Profile(), s.VideoBitrate()/1000, s.AudioBitrate()/1000),
"Seconds includes production encoding, audio/mux, complete decode validation and checkpoint hashing; EncodingSeconds isolates both MPEG-2 passes. Reference preparation, quality measurements and authoring are outside these timings.",
"CPU percentages divide process CPU seconds by wall seconds and all logical CPUs. Runs are sequential.",
"SSIM/PSNR compare decoded output against the DVD-resolution reference. Visual assessment and physical-player compatibility still require separate review.",
}}
if *sourcePipeline {
report.InputMode = "Original-resolution progressive source decoding and scaling"
}

report.SourceSHA256, err = media.HashFile(ctx, source)
if err != nil {
return err
}
report.ReferenceSHA256, err = media.HashFile(ctx, reference)
if err != nil {
return err
}
failed := false
for run := 1; run <= *repeats; run++ {
name := "FFmpeg"

result := Result{Run: run, Encoder: name, Status: "encoding"}
measured := process.Observe(ctx, func(m process.Metrics) { result.Steps = append(result.Steps, m) })
candidate := filepath.Join(dir, fmt.Sprintf("%02d-%s", run, strings.ToLower(name)))
if err = os.MkdirAll(candidate, 0755); err != nil {
return err
}
encoded := ""
start := time.Now()
switch name {
case "FFmpeg":
var v model.Video
v, err = tools.Encode(ctx, ref, s, reference, candidate, log, nil)
encoded = v.Encoded
case "mpeg2enc":
binary := *mpeg
if binary == "" {
binary, _ = exec.LookPath("mpeg2enc")
}
if binary == "" {
report.Results = append(report.Results, result)
continue
}
binary, _ = filepath.Abs(binary)
encoded = filepath.Join(candidate, "video.m2v")
f, e := os.Open(reference)
if e != nil {
return e
}
norm := "p"
if s.Standard == "NTSC" {
norm = "n"
}
aspect := "2"
if ref.Aspect() == "16:9" {
aspect = "3"
}
err = process.Run(ctx, binary, []string{"-f", "8", "-n", norm, "-a", aspect, "-b", "8000", "-q", "2", "-I", "0", "-o", encoded}, process.Options{Stdin: f, Log: log})
f.Close()
case "HCenc":
if *hc == "" || *ffms == "" {
result.Error = "Supply -hcenc and -ffms2; install matching AviSynth separately"
report.Results = append(report.Results, result)
continue
}
binary, _ := filepath.Abs(*hc)
plugin, _ := filepath.Abs(*ffms)
script := fmt.Sprintf("LoadPlugin(\"%s\")\nFFVideoSource(\"%s\", cache=false)\nConvertToYV12(interlaced=false)\n", plugin, reference)
if err = os.WriteFile(filepath.Join(candidate, "source.avs"), []byte(script), 0644); err != nil {
return err
}
ini := fmt.Sprintf("*INFILE %s\n*OUTFILE %s\n*BITRATE 8000\n*MAXBITRATE 9000\n*PROFILE BEST\n*ASPECT %s\n*PROGRESSIVE\n", filepath.Join(candidate, "source.avs"), filepath.Join(candidate, "video.m2v"), ref.Aspect())
if err = os.WriteFile(filepath.Join(candidate, "HC.ini"), []byte(ini), 0644); err != nil {
return err
}
encoded = filepath.Join(candidate, "video.m2v")
err = process.Run(ctx, binary, []string{"-ini", filepath.Join(candidate, "HC.ini")}, process.Options{Dir: candidate, Log: log})
video, input := ref, reference
if *sourcePipeline {
video, input = original, source
}
v, encodeErr := tools.Encode(measured, video, s, input, candidate, log, nil)
err = encodeErr
encoded := v.Encoded

result.Seconds = time.Since(start).Seconds()
var encodingCPU float64
for _, step := range result.Steps {
result.CPUSeconds += step.CPUSeconds
if hasArg(step.Args, "-pass") {
result.EncodingSeconds += step.Seconds
encodingCPU += step.CPUSeconds
}
}
result.CPUPercent = result.CPUSeconds / result.Seconds / float64(runtime.NumCPU()) * 100
if result.EncodingSeconds > 0 {
result.EncodingCPUPercent = encodingCPU / result.EncodingSeconds / float64(runtime.NumCPU()) * 100
result.EncodingFPS = duration * media.Ratio(s.FPS()) / result.EncodingSeconds
}
if err != nil {
failed = true
result.Status = "failed"
result.Error = err.Error()
report.Results = append(report.Results, result)
Expand All @@ -196,27 +224,27 @@ func run() error {
result.Status = "encoded"
st, e := os.Stat(encoded)
if e != nil {
failed = true
result.Status = "failed"
result.Error = e.Error()
report.Results = append(report.Results, result)
continue
}
result.Bytes = st.Size()
if name == "FFmpeg" {
elementary := filepath.Join(candidate, "video.m2v")
err = process.Run(ctx, tools.FFmpeg, []string{"-v", "error", "-y", "-i", encoded, "-map", "0:v:0", "-c:v", "copy", "-an", "-f", "mpeg2video", elementary}, process.Options{Log: log})
elementary := filepath.Join(candidate, "video.m2v")
err = process.Run(ctx, tools.FFmpeg, []string{"-v", "error", "-y", "-i", encoded, "-map", "0:v:0", "-c:v", "copy", "-an", "-f", "mpeg2video", elementary}, process.Options{Log: log})
if err == nil {
st, err = os.Stat(elementary)
if err == nil {
st, _ = os.Stat(elementary)
result.Bytes = st.Size()
}
}
result.PSNR = metric(ctx, tools, reference, encoded, "psnr", log)
result.SSIM = metric(ctx, tools, reference, encoded, "ssim", log)
dvdVideo := encoded
if name != "FFmpeg" {
dvdVideo = filepath.Join(candidate, "video.mpg")
err = process.Run(ctx, tools.FFmpeg, []string{"-hide_banner", "-nostdin", "-y", "-i", encoded, "-f", "lavfi", "-i", "anullsrc=r=48000:cl=stereo", "-map", "0:v:0", "-map", "1:a:0", "-c:v", "copy", "-c:a", "ac3", "-ac", "2", "-b:a", "256k", "-t", fmt.Sprintf("%.6f", duration), "-f", "dvd", "-muxrate", "10080k", "-packetsize", "2048", dvdVideo}, process.Options{Log: log})
if err == nil && (strings.HasPrefix(result.PSNR, "failed:") || strings.HasPrefix(result.SSIM, "failed:") || result.PSNR == "unavailable" || result.SSIM == "unavailable") {
err = fmt.Errorf("quality measurement failed: PSNR %s; SSIM %s", result.PSNR, result.SSIM)
}
dvdVideo := encoded
if err == nil {
v := ref
v.Encoded = dvdVideo
Expand All @@ -231,10 +259,11 @@ func run() error {
}
if err != nil {
result.Error = err.Error()
result.Status = "authoring failed"
result.Status = "validation failed"
failed = true
}
report.Results = append(report.Results, result)
fmt.Printf("%s: %s · %.2fs · %d bytes · SSIM %s · PSNR %s\n", name, result.Status, result.Seconds, result.Bytes, result.SSIM, result.PSNR)
fmt.Printf("Run %d %s: %s · %.2fs total · %.2fs MPEG-2 · %.1f%% CPU · %d bytes · SSIM %s · PSNR %s\n", run, name, result.Status, result.Seconds, result.EncodingSeconds, result.EncodingCPUPercent, result.Bytes, result.SSIM, result.PSNR)
}
b, err := json.MarshalIndent(report, "", " ")
if err != nil {
Expand All @@ -244,8 +273,20 @@ func run() error {
return err
}
fmt.Println("Report:", filepath.Join(dir, "report.json"))
if failed {
return fmt.Errorf("benchmark failed; inspect report.json and benchmark.log")
}
return ctx.Err()
}

func hasArg(args []string, want string) bool {
for _, arg := range args {
if arg == want {
return true
}
}
return false
}
func metric(ctx context.Context, t media.Tools, reference, encoded, name string, log io.Writer) string {
var b strings.Builder
filter := "[0:v]setpts=PTS-STARTPTS[r];[1:v]setpts=PTS-STARTPTS[d];[r][d]" + name
Expand Down
Loading
Loading