video_normalizer_ios 0.1.2
video_normalizer_ios: ^0.1.2 copied to clipboard
iOS implementation of the video_normalizer plugin, built on AVFoundation (AVAssetReader and AVAssetWriter).
video_normalizer_ios #
The iOS implementation of video_normalizer. Apps
depend on video_normalizer; this package is endorsed and comes with it.
Status: implemented, never compiled or run. This code was written on Windows against Apple's documentation. Until someone has worked through
docs/handoff/IOS.mdon a Mac, treat it as unverified, and expect the first build to need small fixes.
What it is made of #
| Engine | AVFoundation: AVAssetReader + AVAssetWriter to transcode, AVAssetExportSession (pass-through) to remux |
| Language | Swift, tools version 5.9 |
| Minimum iOS | 15.0 |
| Integration | Swift Package Manager (ios/video_normalizer_ios/Package.swift); a CocoaPods podspec is provided as well |
| Third-party dependencies | none |
| Permissions | none. Videos come from a picker, which grants access to what the user chose |
| Privacy manifest | PrivacyInfo.xcprivacy: no tracking, no collected data; one required-reason API (free disk space, reason E174.1) |
| Channel | generated by Pigeon from the same pigeons/messages.dart as Android |
How a job runs #
JobRegistry is process-wide, so jobs outlive the Flutter engine that started
them. Each job has its own serial queue.
MediaAnalyzerreads the source withAVURLAssetand a Swift port of the Android box scanner: nothing is decoded.EncoderSettingsbuilds the writer's settings from the job the Dart side resolved, andAVAssetWriter.canApplyconfirms them before anything is decoded.AssetTranscoderreads through a video composition that turns the picture upright, scales it and renders in BT.709 (which is also the HDR to SDR step), drops frames when the frame rate is reduced, and writes H.264 and AAC-LC with the index at the front of the file.PassthroughRemuxercopies compliant streams instead.OutputValidatorreopens the file and compares it with what was asked for. Only then does the file get its final name.
A failure at any step deletes the partial file and reaches Dart as one of the
codes in docs/ERRORS.md.
Differences from Android #
- WebM and Matroska sources fail with
unsupported_container: AVFoundation does not read them. - There is no
content://input; pass a path or afile://URL. Security scoped URLs from the document picker are supported. - HDR conversion is reported as supported on every device, so
HdrFallback.passThroughnever comes into play. capabilities()knows the encoders' names, not their limits.
The full comparison is in docs/handoff/IOS.md.
Tests #
38 XCTest methods in
packages/video_normalizer/example/ios/RunnerTests/RunnerTests.swift, and the
same Dart integration suite that runs on Android. Neither has been run; the
handoff document has the commands.