Skip to content

v0.8.0.0

Choose a tag to compare

@mugurc mugurc released this 21 Aug 21:01
· 33 commits to main since this release

Answers issue #5 and issue #6 — and closes a long list of defects a full audit of the plugin turned up along the way.

A control center, and a job list that scales (issue #6)

The plugin page fetched every job every two seconds and rendered a row for each one. On a library large enough to fill the queue with tens of thousands of jobs that is megabytes of JSON per poll and a table hundreds of screens long.

The main page is now a control center: the queue counts, what is encoding right now with its progress and ETA, the next few jobs, the last few that finished, and the existing sweep / pause / cancel controls. Open full queue and Open full history lead to a new page holding the whole list — paged, searchable by name or path, with Queue / History / All tabs. Nothing loads more than a screenful.

Finished records are still kept. "Clear finished" now says what it costs: a source with no record can be swept up and re-encoded again.

Replace in place no longer breaks playback (issue #5)

Replacing a file with a profile whose container differs from the source's extension renames it — Movie.mp4 becomes Movie.mkv — and nothing told Jellyfin. The database row kept naming the deleted file and every playback attempt failed with a file-not-found error until a library scan came round, which with real-time monitoring off (the default) can be a day away.

The item is now repointed at the new file the moment the swap is done, its container and size corrected in the same save, and its media info re-probed. Note that Jellyfin derives an item's id from its path, so its next full scan still re-creates the renamed item — keeping the container unchanged avoids that.

Data safety

  • ffmpeg could encode the cover art instead of the film. The stream map matched attached pictures — embedded cover art — while the prober deliberately skipped them, so the two could disagree about which stream is the video. Where that happened the prober read the real track and matched a rule on it while ffmpeg encoded the poster thumbnail, and because verification only compared duration (which the audio track satisfies on its own) the result passed and, under Replace in place, the original film was deleted for it. In practice the ordering saves you: ffmpeg writes an mp4 attached picture as an iTunes covr atom, which is demuxed after the real tracks, and Matroska keeps cover art as an attachment — so on files from normal tools the old map already selected the right stream. This is a guard against unusually ordered files, not a description of something that was routinely happening. The map now excludes attached pictures, and verification also checks the output's shape and audio tracks.
  • Pause could freeze an encode with nothing left to resume it — SIGSTOPped for ever, holding a concurrency slot, with the queue reporting itself as running.
  • A clean restart threw away a running encode, recording it as a user cancellation; it now goes back to Pending. Shutdown also waits for encodes to stop instead of leaving ffmpeg orphaned at full CPU, and the part-finished temp files that every cancel and crash used to leave behind — routinely several gigabytes, permanently — are swept at startup.
  • The queue file is flushed to disk before it is renamed into place, so a power cut cannot take every Completed record with it.

Rules that silently did the wrong thing

  • Container conditions are matched against what ffprobe actually reports (matroska,webm, mov,mp4,m4a,3gp,3g2,mj2). Container Equals mkv used to match no mkv at all, and Container NotEquals mp4 was true for every mp4 — so a rule written to catch what is not yet mp4 queued the whole library.
  • AudioCodec and AudioChannels are answered over every audio track instead of only the first. A remux whose commentary is muxed ahead of the main track was never queued. A positive operator means "some track is like this"; a negating one means "no track is". The explain log lists every track too.
  • -preset is only passed to encoders that take one. Switching a profile from libx264 to libsvtav1 carried medium over and killed every job before a frame was encoded.
  • An image subtitle Matroska cannot store (xsub, from AVI/DivX sources) no longer aborts the whole encode.
  • An admin's own -vf is merged with the plugin's filter chain instead of being silently discarded, and extra video args are no longer dropped entirely on a copy profile.

Performance

Persisting the queue rewrote the whole file on every change. Measured: 50,000 jobs is a 33 MB file and ~95 ms per save, with the queue lock held throughout — so a sweep enqueueing 5,000 items cost 7.9 seconds and 5.7 GB of disk writes, and both scale with the square of the queue size. Writes whose loss costs nothing are batched; a job reaching a final state, a claim and every admin action still write through. Same workload after: 104 ms and 2.3 MB. "Cancel all" got the same treatment.


Also in this release: the browser pages report a failed poll instead of silently showing stale figures as live, rows are no longer rebuilt under the pointer every two seconds (a click aimed at one row's Cancel could land on the next row's Remove), Remove asks first, and "x ago" in Recently finished no longer freezes once the queue goes idle.