Skip to content

feat(clip): marked frames in Cut a clip, with a note, the time under each picture and a PDF or PNG export - #1775

Open
lightscape-jm wants to merge 5 commits into
KnifeLemon:mainfrom
lightscape-jm:feat/frame-export-1205
Open

lightscape-jm wants to merge 5 commits into
KnifeLemon:mainfrom
lightscape-jm:feat/frame-export-1205

Conversation

@lightscape-jm

@lightscape-jm lightscape-jm commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

What does this change?

Closes #1205: step 3 of the three agreed there, the list, note field, time strip and export. A video's marked
frames are listed in Cut a clip, each can carry a note, and they go out as one PDF or a folder of PNGs with the time,
the frame number and the note under each picture.

Cut a clip with its Marked frames list open: three frames, each with its time, frame number and note, and Export 3 frames

For the user

  1. Mark frames as in feat(clip): Mark this frame opens the frame shown in Annotate #1688 (F, or Mark this frame). In Annotate, under the tools, a bar shows the frame's time and
    number (2:04.700 · frame 3,741) and takes an optional note; Enter saves. A frame can be saved with only a note, or
    with nothing drawn. Marking a frame again brings back the note saved with it.
Annotate on a marked frame: the tools, and under them 2:04.700 · frame 3,741 and the note field
  1. In Cut a clip, Marked frames (with how many) sits beside Mark this frame. It lists the video's marked frames in
    time order: the picture as marked, the time and number, the note, and a ✕ that moves that copy to the Recycle Bin /
    Trash. A row moves the playhead to its frame. Ticks on both timelines show where they are.
  2. Export 3 frames… asks for one PDF, a page per frame, or a folder of PNGs, the time and note under each
    picture
    , and runs as an ordinary job (toast, cancel, history). Both go next to the video: Site walk frames.pdf,
    or the folder Site walk frames. A name already taken, the folder's too, gets " (2)", and the card shows the name
    the export will get.
The export card: one PDF, a page per frame, or a folder of PNGs; saved next to the video as Site walk frames.pdf A PDF page: the marked frame, then 2:04.700 · frame 3,741 in bold and the note, the video's name and 2 / 3 at the foot

How it works

  • A copy says what it is. The marked copy feat(clip): Mark this frame opens the frame shown in Annotate #1688 saves now carries one PNG text, Filee:Frame: the video's file
    name, length and size, the frame's time as the playhead had it (shown and compared to the millisecond), its number,
    and the note, as JSON with every letter
    outside ASCII escaped (Magick.NET reads a long compressed iTXt back as nothing). It is written after any metadata is
    dropped, and taken off any other picture made from a copy through the image step, so a resized copy isn't taken for
    one. When Annotate is set to remove metadata, the video's name, length and size are left out: the copy carries
    only a one-way key made from them (the first 16 bytes of their SHA-256), which is enough for the list to match the
    copy to its video and can't be read back to a name.
  • The list comes back. Cut a clip finds a video's copies by that text, never by file name: in the folder Annotate's
    output rules (with Settings › General's default folder) give a frame saved alone, and in the last 500 folders copies
    of it were saved to (marked-frames.json beside the settings). Only the text chunks before the picture data are
    read. Online-only cloud files aren't opened (Windows' recall attributes; on macOS, the file's dataless flag). A
    video of the same name but another length or size never shares a list. A remembered folder on a drive that is away
    is kept for when it is back.
  • The frame number counts from 0, as FFmpeg's n counts, so select=eq(n\,3741) finds the same frame. It is
    counted from the packets' display times without decoding, from the key frame decoding starts at: packets before it
    aren't shown (a recording joined mid-stream), nor is an MP4 or MOV cut's lead-in, which FFmpeg decodes from but
    drops (its edit list), nor an open group's leading pictures after a cut. Where packets have no display time (DVD VOB,
    MPEG-1, AVI) the frames FFmpeg shows are counted by decoding up to the time. The save waits for it. When it can't be
    counted, the frame has its time only.
  • Marking a frame again replaces its copy: once the new one is saved, an earlier copy that Annotate wrote for that
    frame goes to the Recycle Bin / Trash (with the Overwrite rule, the new copy takes its place). A copy written after
    the new one (the same frame saved twice in a row) is left alone, as is a file of one's own made from it (renamed,
    compressed).
  • The export is two ordinary conversions over the copies, in time order (Core/Presets/FrameExport).
    • The PDF is the existing merge into one PDF: A4 (US Letter where the regional format is the United States), each
      page turned to its picture, pages numbered. Each page draws the time and number (bold) and the note (regular)
      under the picture as glyph outlines, at a fixed size on paper (11 and 10 pt), and the video's name at the foot
      (Engines/Pdf/FramePage). No font is embedded; a colour emoji goes in as a small picture. Frames wider than
      1920 px go in as JPEG at quality 92 (PdfOptions.JpegAboveWidth), smaller ones lossless.
    • The PNGs get the same lines in a white strip below the picture, sized to the picture's width
      (ImageOptions.FrameCaption).
    • Both lay the text out as Annotate's labels are (shaped, with the UI's fonts and fallbacks; right-aligned when it
      reads right to left), wrapping the time and number too on a narrow frame.
  • Seen on the way, fixed for the export's PDFs: PDFsharp writes a PDF's dates in the thread's calendar. Where the
    regional format uses another calendar, the PDF's year was that calendar's (2569 under Thailand's, 1405 under Iran's),
    and under Saudi Arabia's the page-numbering step then failed outright. The export's saves now write Gregorian dates
    (PdfSharpConverter.SaveDated). The helper is shared, so this reaches further than the export: every merged PDF,
    every picture → PDF, and every PDF that gets page numbers, a watermark or a password (PdfFinishing.Finish) is now
    saved with Gregorian dates too. The other PDF tools still save with the regional calendar: [Bug]: PDF tools write the regional calendar's year as the PDF's date, and fail in Saudi Arabia and Iran #1972 lists them.

On purpose.

  • The PDF footer is the existing page number (2 / 3) with the video's name beside it.
  • The list opens below its button, over the timeline: at the window's smallest size there is little room above.
  • A marked copy carries its note as PNG text, even when Annotate is set to remove metadata: you wrote it, and the list
    needs it. A copy sent on its own still holds the note, unseen in the picture. With metadata removal on, the video's
    name, length and size are not in it (the key above only).
  • Departures from the design in [Feature]: Export marked video frames as a PDF or PNGs #1205, each smaller: one Filee:Frame text instead of several keys (the reason
    above); the time and number in the PDF at a fixed size on paper rather than scaled to the picture.

Limits, with the worst case found.

  • The frame number of a frame near the end of a long DVD VOB, MPEG or AVI is counted by decoding: 11 s at the end of a
    10-minute 720p MPEG-4 AVI, measured in review on a heavily loaded Mac. Past ffprobe's 30 s limit the frame has its
    time only. While it is counted the save waits, with Annotate already on to the next picture; Filee quitting in that
    time drops that save. Files with display times read packets only: 0.7 s (MP4, MKV) and 1.4 s (TS) near the end of a
    1.4 GB hour-long file, 1.6 to 2.2 s near the end of a 3-hour one (warm cache, measured in review; ffprobe reads the
    packets' bytes, so a large file on a slow disk takes longer).
  • A video renamed, moved or edited after marking no longer finds its copies (they are matched by its name, length and
    size).
  • A PNG text placed after the picture data by another program isn't read (only the chunks before it are).
  • The same frame saved twice within the disk's time precision (2 s on FAT, 1 s on HFS+) can't tell which copy is newer:
    both are kept and the list shows one of them; marking it again replaces both.

Not in this PR. DOCX or HWPX export, and selectable PDF text (#1205: "not in this round", "outlines first").

Type of change

  • Bug fix
  • New feature or improvement
  • New format or engine
  • Translation
  • Documentation
  • Build, CI or dependencies

How was it tested?

  • dotnet format --verify-no-changes --severity warn
  • dotnet test, all suites, on this branch rebased on main at 79f03be (22 Nov):
    • macOS (Apple silicon): Core 1,833 and Platform 117 passed; Engines 4,161 passed, 241 skipped; App 3,379 passed,
      22 skipped. The failures also fail on unmodified main on this Mac (its Homebrew FFmpeg's codecs, the ISO/UDF and
      archive-to-ISO tests, the memory-limit test, two App renders, the installer tests that run only on Windows), except
      three LibreOffice and GIMP tests that timed out under load and passed three runs out of three alone.
    • Windows 11 ARM64 (VM): Core 1,828, Platform 122, Setup 255 and App 3,386 passed, none failed. Cli's one failure
      also fails on unmodified main there. Engines: 4,078 passed, 332 skipped, and its 10 failures also fail on
      unmodified main at 79f03be in the same VM. (A first run's test process crashed partway, in tests this PR
      doesn't touch; run again, neither this branch nor main crashed.)
    • Linux (Docker dotnet/sdk:10.0-noble, arm64, as root): App 3,368 passed; the two UpdateServiceTests that
      fail also fail on unmodified main at 79f03be in the same container. The frame-number tests passed with Filee's
      FFmpeg (166). Engines, run on its own: 4,035 passed, 362 skipped, 23 failed, against 20 on unmodified main at
      79f03be in the same container (on the earlier base, the extra failures were timing tests that passed run alone).
    • x64 Windows and macOS on Intel are left to CI.
  • New tests, the code each one covers switched off in turn and the test seen to fail (21 before review, then 34,
    7, 6 and 5 after each round of review fixes, and 9 for the 2 Dec change; the dataless-file check is the one that
    can't be, since only a cloud provider can mark a file so).
    • Engines: the frame number at every frame and between frames for encoders' own B-frames (x264, x265,
      8 B-frames), files cut or trimmed mid-stream (VOB, TS, and MP4 and MOV cuts with an edit list) and packets with
      only a decode time (MPEG-1, AVI, AVI with frames left out); at five frames each of 14 test videos in 6 containers;
      an hour of video, past the end and without video. The frame text round-tripping in any script and length, with
      metadata kept or dropped, replaced whole, and removed from a picture made from a copy. The PNG strip below the
      picture, wrapped, right-aligned for right-to-left text, the time and number wrapped on a 128 and 176 px frame, the
      note regular. A PDF page rendered and read back: the picture as it is, the time, number and note drawn under it as
      outlines with no font embedded; the JPEG rule and quality through the export's own preset. The export through the
      real job queue: one PDF, PNGs with strips, a taken name, a read-only folder, and the PDF written and dated under
      the Saudi, Thai and Iranian regional formats.
    • App: the list in time order with ticks drawn on both timelines, coming back when the video opens again, a
      saved copy joining at once, a row moving the playhead to its frame, ✕ to the Trash or saying why not, a click
      elsewhere closing it, the last video's list gone as soon as the next opens, no row left without its picture after
      a reload; the list and export card taking the keyboard and giving it back (Tab staying in the card, Enter on a
      choice exporting); the export's job, its count, the name it will get and the remembered choice. The list looking
      where a frame saved alone goes, keeping a folder on a drive that is away, a video named with a dot; marking again
      replacing only an earlier copy of that video's frame, never a later one. Annotate's bar under the tools, saving
      with only a note, Enter in the note saving, a note per frame, the earlier note offered while the number is still
      counted, the 300-character limit, typing picking no tool, nothing at the foot covering the picture.
    • Renders: Cut a clip with the list closed, open and the export card, and Annotate's bar, in all 23 languages at
      the windows' smallest size, and in English, Japanese and Arabic dark at the usual size; each text checked whole
      and inside the window.

Screenshots (UI changes)

The pictures above, from this branch's renders and its export. Every language's window is in the render tests'
screenshots (clip-marked-*.png, annotate-frame-*.png).

Checklist

  • New UI strings are in all src/Filee.App/Assets/i18n/*.json files (14 new)
  • New third-party code or binaries are listed in THIRD-PARTY-NOTICES.md (none added)
  • The PR does one thing (unrelated changes go in a separate PR)

🤖 Generated with Claude Code

… export

Closes KnifeLemon#1205 (step 3). A video's marked frames are listed in Cut a clip beside Mark this frame, with how many, ticks on
both timelines, each frame's picture, time, number and note, and a remove button that moves the copy to the Recycle
Bin / Trash. In Annotate, a bar under the tools shows a frame's time and number and takes an optional note; a frame
can be saved with only a note. Export N frames... writes one PDF, a page per frame, or a folder of PNGs, next to the
video, with the time, number and note under each picture.

A marked copy carries its frame's facts as one PNG text (Filee:Frame, ASCII JSON): the video's name, length and size,
the frame's time and number, and the note. The list finds copies by that text, where Annotate's output rules put a
frame and in the folders copies were saved to (marked-frames.json). Marking a frame again replaces its earlier copy.
The frame number counts from 0 as FFmpeg's n, from packet times without decoding (edit-list MP4 and MOV cuts
included), or by decoding where packets have no display time. The PDF draws the text as glyph outlines under the
unchanged picture, frames wider than 1920 px as JPEG; its saves write Gregorian dates whatever the regional calendar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the feature New features label Nov 23, 2026
FrameExportJobTests sets the process's default regional format (Saudi, Thai, Iranian) so
the job queue's threads see it; calendar and GPS-time tests running beside it read their
dates in the Umm al-Qura or Persian calendar (upstream CI on KnifeLemon#1775). The class now runs in a
collection with parallelization off, as ExifToolMemoryTests does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lightscape-jm

Copy link
Copy Markdown
Contributor Author

The three failing portable checks were this PR's: FrameExportJobTests sets the process's default regional format (Saudi, Thai, Iranian) so the job queue's threads see it, and a calendar or GPS-time test running beside it read its dates in the Umm al-Qura or Persian calendar (the 1405-… and 1448-… years in GeoPointTimesTests and ICalendarTests). The Package on Ubuntu 22.04 failure followed from the Linux job having no package. Fixed in db53a6c: those tests are in a collection that runs alone (SetsTheRegionalFormat, as ExifToolMemoryTests does). Run together, FrameExportJobTests, GeoPointTimesTests and ICalendarTests failed 17–21 of 65 in each of five runs before, and pass 65 of 65 in each of five runs with it.

Also, the two test points the description left open:

  • Windows 11 ARM64, Engines: run again on this branch, the whole suite ran with no crash: 4,078 passed, 332 skipped, and its 10 failures also fail on unmodified main at 79f03be in the same VM. The earlier crash didn't come back, and main at 79f03be ran without one too.
  • Linux, Engines: run on its own (the first run had shared Docker's memory with another container), the whole suite ran: 4,035 passed, 362 skipped, 23 failed, against 20 on unmodified main at 79f03be in the same container. The 13 named in the log I kept all fail on main too; on the earlier base, the extra failures were timing tests that passed run alone.

@KnifeLemon KnifeLemon left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @lightscape-jm, and for the follow-up on the CI failures. Running FrameExportJobTests in a collection of its own is the right fix, and CI is now green on every platform, macOS included.

I've read through the Core, Engines and App changes. Two things so far:

  1. The calendar fix reaches further than the description says. SaveDated is now used in Merge, in picture → PDF and in PdfFinishing.Finish. So every merged PDF, every picture → PDF and every PDF that gets page numbers, a watermark or a password is saved with Gregorian dates, not only the export's. That's a good change; please say so in the description. The remaining Save calls still use the thread's calendar: PdfPageTools, PdfSheets, PdfBlankPages, PdfPrintableAnnotations, and in PdfSharpConverter the split/extract, metadata removal and compression paths. Could you open the separate issue you mention and list them there?
  2. The note stays in the copy when metadata is removed. You list this under "On purpose". The copy also carries the video's file name and size. I'd like to think that one over before merging, and I'll come back to it here.

@KnifeLemon

Copy link
Copy Markdown
Owner

@lightscape-jm, here's the answer to point 2 (sorry it took this long):

  • The note stays in a marked copy even when Annotate is set to remove metadata. You wrote it, the list needs it, and keeping it with the frame is the point of the feature.
  • The video's file name and size go when metadata removal is on. They say where the frame came from, which is exactly what someone removing metadata wants gone. If the list needs them to match a copy to its video, keep only what's needed for that, and say so in the code comment.
  • Please add one line to the description and the CHANGELOG bullet: "a marked copy carries its note as PNG text". Then nobody is surprised that a copy sent on its own still holds the note.

With that and point 1 (the description, plus the separate issue for the remaining Save calls), this is ready from our side. main has moved under ImageEncoder.cs and PdfSharpConverter.cs. Once you've pushed, we'll merge main into the branch ourselves, so you don't have to.

…its video

KnifeLemon's decision on KnifeLemon#1775 (2 Dec): the note stays in a marked copy, the video's name and size go when Annotate
removes metadata. Such a copy now carries the frame's time, number and note, and in place of the video's name, length
and size a one-way key made from them (the first 16 bytes of their SHA-256), which is what Cut a clip's list needs to
match the copy to its video. Copies that keep metadata are written as before, and earlier copies still match by name.

The PDF export takes the video's name for the page footer from the export (ImageOptions.FrameVideo), not from the
copy, so it shows on pages made from either kind.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lightscape-jm

Copy link
Copy Markdown
Contributor Author

@KnifeLemon, both points are done in 85dc099:

1. The calendar fix and the remaining saves. The description now says the shared SaveDated also dates every
merged PDF, every picture → PDF and every PDF that gets page numbers, a watermark or a password. The remaining saves
are listed in #1972. The fix for them is ready on my fork and builds on SaveDated, so I'll open it once this one
merges.

2. The note and the video's name and size. When Annotate is set to remove metadata, a marked copy now keeps its
note, frame time and frame number, and drops the video's name, length and size. In their place it carries a one-way
key made from them (the first 16 bytes of their SHA-256). The list matches a copy to its video with that key, and the
name can't be read back from it, though someone who has the video can tell that a copy came from it, as the list
does; the code comment says so. With metadata kept, nothing changes, and copies saved before this keep matching by
name. The PDF export now
takes the video's name for the page footer from the export itself, not from the copy, so it shows on pages made from
either kind.

Tests: a copy written with metadata removal on holds the note and none of the video's name, length or size (its raw
bytes and every text chunk, unpacked, are searched); it is listed for its own video only, not for one of the same
name with another length or size, in another Unicode form of the name too; marking the frame again still replaces it;
a malformed key reads as none; and a PDF made from such copies still shows the video's name at the foot. Each fails
with its piece of the fix turned off. Run on this commit: the affected tests on Linux (Docker) and Windows 11 ARM64,
389 passed on each, none failed; every suite on macOS, with Core 1,843, Platform 117, Engines 4,127 and App 3,382
passed. The Mac's other failures also fail on unmodified main there, or ran out of time under load (LibreOffice,
FFmpeg, Pandoc) and passed run alone.

The description has the line "a marked copy carries its note as PNG text" under On purpose. For the CHANGELOG
bullet: "A marked copy carries its note as PNG text, also when Annotate removes metadata; the video's name and size
are left out then."

I've left main out of the branch, so you can merge it in as you said.

Resolves ImageEncoder.cs (comment), PdfSharpConverter.cs (IsLossyPhoto next to JpegAboveQuality) and the gallery
left-out list (media.dvd), and adds the CHANGELOG lines for marked frames.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@KnifeLemon KnifeLemon left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @lightscape-jm, the metadata-removal change is exactly what we discussed: the note stays, the video's name, length and size give way to a one-way key, and the PDF takes the name from the video it's run on. Thanks also for #1972. I merged main into the branch (conflicts in ImageEncoder.cs, PdfSharpConverter.cs and the gallery left-out list) and added the CHANGELOG lines, including "a marked copy carries its note as PNG text". It will be merged once CI is green.

The gallery's version check counts fields added since 2.5.0; image.frame,
image.frameCaption, image.frameVideo and pdf.jpegAboveWidth were missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KnifeLemon

Copy link
Copy Markdown
Owner

I pushed one more small fix (ce6129a): the gallery's version check needs every field added since 2.5.0 listed in SharedPresetVersions.Fields, so image.frame, image.frameCaption, image.frameVideo and pdf.jpegAboveWidth are now listed as 2.6.0. That was the one test failing on every platform. I'll merge once CI is green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Export marked video frames as a PDF or PNGs

2 participants