import type { Metadata } from "next";
import { PageIntro, SiteShell, StatusNote } from "../_components/SiteShell";

export const metadata: Metadata = { title: "User guide", description: "How to open, navigate, cut, preview, save, accelerate and troubleshoot SmartCut64 workflows." };

const nav = [
  ["First start", "first-start"], ["Navigate", "navigate"], ["Make cuts", "cuts"], ["Preview edits", "preview"],
  ["Save video", "save"], ["Audio and streams", "streams"], ["Hardware", "hardware"], ["Ad-Detective", "ad"],
  ["Joiner and batch", "joiner"], ["Projects", "projects"], ["Shortcuts", "shortcuts"], ["Troubleshooting", "troubleshooting"],
] as const;

export default function HelpPage() {
  return <SiteShell>
    <PageIntro eyebrow="User guide" title="From source file to validated output"><p>This guide is written specifically for SmartCut64. The same guide is included offline under Help &gt; Contents, so normal editing does not depend on this website.</p></PageIntro>
    <div className="section"><div className="content-wide prose-layout">
      <aside className="side-nav" aria-label="Guide contents">{nav.map(([label,id]) => <a href={`#${id}`} key={id}>{label}</a>)}</aside>
      <article className="prose">
        <section id="first-start"><h2>First start</h2><p>Click the large <strong>Open Video</strong> target, use File &gt; Open Video, press Ctrl+O, or drag a media file onto the editor. SmartCut64 probes the streams and builds a frame navigation index. The preview becomes usable as soon as possible while thumbnails and waveform data continue in the background.</p><p>Run the machine self-test under Tools &gt; Options &gt; Hardware for per-codec advice. Full-transcode hardware encoding starts disabled. Smart-render boundary GOPs remain software encoded.</p></section>

        <section id="navigate"><h2>Navigate the exact source</h2><p>Drag the green/red program timeline for coarse movement. Use the fine-position slider, Left/Right, the frame buttons or a thumbnail for exact movement. Ctrl+Left/Right jumps between random-access points. Up/Down and Page Up/Page Down use configurable short and long jumps.</p><p>The selected thumbnail remains in the centre. At the start and end, black inactive cells stand in for frames outside the source. Press +/− or open Thumbnail Options to inspect a wider interval. Red triangles are chapter marks; F5/F6 and the chapter controls move between them.</p></section>

        <section id="cuts"><h2>Make cuts</h2><ol><li>Move to the first selected frame and choose <strong>Mark In</strong> (F3).</li><li>Move to the first frame after the selection and choose <strong>Mark Out</strong> (F4).</li><li>Choose <strong>Cut Selection</strong> (Delete) to remove it, or <strong>Trim Unselected</strong> (Insert) to keep it and remove everything else.</li></ol><p>Green means kept; red means removed. The colour line above the thumbnails, the program timeline, cut list and output length change together. A new In or Out point replaces the previous one. Undo/Redo, Invert All Cuts and Remove Selected Cuts revise the same edit state.</p></section>

        <section id="preview"><h2>Preview Your Edits</h2><p>Press the blue P/E control or P. In Edit mode you move through the original source, including red regions. In Preview Your Edits, playback, sound, thumbnails and navigation map onto the kept output and skip every cut. At a cut boundary playback continues with the first kept frame after the removed range.</p><StatusNote>Preview is an editing aid. Final export validation still checks the delivered container, timestamps, streams and boundary encoding.</StatusNote></section>

        <section id="save"><h2>Save video</h2><p>Choose Save Video or File &gt; Save Video As. Select an output path, profile, stream policy and mode:</p><ul><li><strong>Intelligent smart render</strong> copies safe interior GOPs and encodes unsafe boundary pictures.</li><li><strong>Keyframe-only copy</strong> avoids video encoding by placing cuts on safe random-access boundaries.</li><li><strong>Full transcode</strong> decodes and encodes all kept video for codec, size, frame-rate or picture changes.</li></ul><p>The progress window shows boundary encoding, packet copy and validation separately. Abort removes the temporary output. A completed destination is reported only after the applicable structural, timing, stream, frame-count, payload and metadata checks pass.</p><h3>If the container cannot hold a source stream</h3><p>Follow the explanation in the Save window: choose a compatible container, deselect the track, or select a working transcode. Renaming the extension is not a conversion.</p></section>

        <section id="streams"><h2>Streams, audio, subtitles and metadata</h2><p>Tools &gt; Select Streams includes or excludes video, audio, subtitle, attachment and data tracks. Compatible tracks are preserved by default. Tools &gt; Adjust Audio Synchronization applies a project offset and can loop the selection while you audition it.</p><p>Profiles can copy compressed audio frames or encode the primary track to AAC, AC-3, MP2, Opus or PCM S16LE with gain, bitrate, rate and channel controls. Text subtitles can be trimmed and converted to MOV_TEXT for MP4/MOV. Incompatible bitmap subtitle delivery is rejected with an alternative rather than silently dropped.</p></section>

        <section id="hardware"><h2>Hardware acceleration</h2><p>SmartCut64 uses at most one NVIDIA, Intel or AMD adapter. Preview, thumbnails and Ad-Detective can use D3D11VA for MPEG-2, H.264, HEVC, AV1 and VP9, with supported Vulkan decode paths for FFV1/ProRes. Optional full transcode can use NVENC, Quick Sync, AMF or Vulkan FFV1/ProRes.</p><p>The self-test opens and validates the real codec path on your machine. Recommendations are stored separately per codec. Unsupported, slower or failed hardware paths fall back to software.</p></section>

        <section id="ad"><h2>Ad-Detective</h2><ol><li>Set scene, black-frame, region, interval and review parameters.</li><li>Start the scan; analysis runs outside the GUI process.</li><li>Review candidate frames and statistics, removing false positives.</li><li>Accept candidates as chapter marks or enable automatic cut creation.</li></ol><p>Threshold calibration can use a marked black interval. Batch scans use the same stored settings. Detection remains advisory—review it before export.</p></section>

        <section id="joiner"><h2>Joiner, titles, Batch Manager and QuickStream Fix</h2><p>Add the current source or edited project to the Joiner, then combine it with media files and multi-object title cards. Reorder and revise items before choosing one output profile.</p><p>The Batch Manager queues exports, scans, repair and Joiner work. Watch folders wait for files to become stable and avoid repeating completed identities. QuickStream Fix repairs/remuxes structure without decoding every picture. In evaluation mode it is explicitly replaced by a watermarked full transcode because clean packet copy cannot insert a watermark.</p></section>

        <section id="projects"><h2>Projects, recovery and interchange</h2><p>Save projects to preserve cuts, markers, streams and project-specific settings. The recovery journal can restore a consistent state after interruption, and source identity data warns when the media no longer matches.</p><p>Supported VideoReDo project, batch and Joiner interchange preserves understood paths, selections, cut/scene mode, profile and synchronization fields. It is factual compatibility only; SmartCut64 is independent software.</p></section>

        <section id="shortcuts"><h2>Principal keyboard shortcuts</h2><table className="data-table"><thead><tr><th>Action</th><th>Default</th></tr></thead><tbody>
          <tr><td>Open / Save video</td><td>Ctrl+O / Ctrl+S</td></tr><tr><td>Play or pause</td><td>Space</td></tr><tr><td>Previous / next frame</td><td>Left / Right</td></tr><tr><td>Previous / next keyframe</td><td>Ctrl+Left / Ctrl+Right</td></tr><tr><td>Mark In / Mark Out</td><td>F3 / F4</td></tr><tr><td>Cut / Trim</td><td>Delete / Insert</td></tr><tr><td>Edit/Preview</td><td>P</td></tr><tr><td>Previous / next chapter</td><td>F5 / F6</td></tr><tr><td>Timeline zoom</td><td>Z, F7/F8, comma/period</td></tr><tr><td>Full screen</td><td>Alt+Enter</td></tr>
        </tbody></table><p>Open Help &gt; Keyboard Shortcuts to inspect, change or restore the complete current set.</p></section>

        <section id="troubleshooting"><h2>Troubleshooting</h2><h3>Thumbnails or waveform are late</h3><p>Let the background task finish. Very large, remote, damaged or unusually indexed sources can be slower. An unchanged source should reuse its cache.</p><h3>Preview is frozen or jerky</h3><p>Run the per-codec self-test, update the GPU driver, try its recommended backend, then force software decode if needed. Inspect View &gt; Show Log. Damaged timing may benefit from QuickStream Fix.</p><h3>Save is unexpectedly slow</h3><p>Check the progress phase. Evaluation watermarking, picture processing, codec changes and full-transcode profiles process all kept video. A normal paid smart render should spend most time in fast packet copy after short boundary encoding.</p><h3>Save fails or leaves no output</h3><p>Open Tools &gt; Show Last Export Report. Failed validation deliberately removes the temporary destination. Check container compatibility, selected streams, disk space, encoder availability and whether another program holds the destination open.</p><h3>A DLL is missing</h3><p>Reinstall the complete signed package. Do not move only smartcut-gui.exe; Qt, FFmpeg, runtime and plugin files must remain with it.</p><p>Still stuck? Read <a href="/support">what to include in a support report</a>.</p></section>
      </article>
    </div></div>
  </SiteShell>;
}
