惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
F
Fortinet All Blogs
博客园 - 聂微东
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Hugging Face - Blog
Hugging Face - Blog
V
Visual Studio Blog
小众软件
小众软件
有赞技术团队
有赞技术团队
雷峰网
雷峰网
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
AWS News Blog
AWS News Blog
C
Cisco Blogs
美团技术团队
T
Threat Research - Cisco Blogs
C
CERT Recently Published Vulnerability Notes
人人都是产品经理
人人都是产品经理
宝玉的分享
宝玉的分享
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
酷 壳 – CoolShell
酷 壳 – CoolShell
Stack Overflow Blog
Stack Overflow Blog
W
WeLiveSecurity
D
DataBreaches.Net
博客园 - 司徒正美
Blog — PlanetScale
Blog — PlanetScale
IT之家
IT之家
云风的 BLOG
云风的 BLOG
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Simon Willison's Weblog
Simon Willison's Weblog
Google DeepMind News
Google DeepMind News
T
The Blog of Author Tim Ferriss
Know Your Adversary
Know Your Adversary
NISL@THU
NISL@THU
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
Vercel News
Vercel News
月光博客
月光博客
T
Tailwind CSS Blog
H
Help Net Security
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Spread Privacy
Spread Privacy
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Cisco Talos Blog
Cisco Talos Blog
Microsoft Security Blog
Microsoft Security Blog
V
V2EX
WordPress大学
WordPress大学
Cyberwarzone
Cyberwarzone
Recent Announcements
Recent Announcements

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
[iOS] Why Passthrough MP4 Export Failed for iPhone Videos
raykim · 2026-06-03 · via DEV Community

A user picks a video from Photos. The app turns that video into a file the server can accept. Then it uploads the file.

On the surface, this sounds like a simple upload flow.

In practice, iOS makes you answer a much more specific question:

How do you reliably turn a video from the user's Photo Library into an uploadable MP4 file?

At first, I used AVAssetExportPresetPassthrough. It looked like the right default. It preserves the original media as much as possible, avoids unnecessary re-encoding, and is fast when it works. No quality loss, less CPU usage, less battery cost.

But some videos failed during export. The error was usually in the AVFoundationErrorDomain Code=-11838 family.

Apple describes this error as operationNotSupportedForAsset: an operation was attempted that is not supported for the asset.

At first, I suspected an iCloud download issue, a Photos permission edge case, or something retryable inside PHImageManager. That was not the real problem.

The actual problem was more fundamental:

I was trying to write an iPhone MOV asset into an MP4 file using a passthrough export.

The Original Flow

The original code was roughly shaped like this:

PHImageManager.default().requestExportSession(
    forVideo: asset,
    options: options,
    exportPreset: AVAssetExportPresetPassthrough
) { exportSession, info in
    exportSession?.outputURL = outputURL
    exportSession?.outputFileType = .mp4
    exportSession?.exportAsynchronously {
        // upload
    }
}

The intention was reasonable:

  1. Ask Photos for an export session for the PHAsset.
  2. Use AVAssetExportPresetPassthrough to preserve the original quality.
  3. Write the result as an .mp4 file for upload.

Many videos exported successfully this way. That is what made the bug confusing. Some videos worked. Some did not.

The hidden assumption was:

Any iPhone video can become an MP4 file through a passthrough export.

That assumption is not always true.

iPhone Videos Are Usually MOV Files

To a user, it is just "a video." Internally, an iPhone camera video is commonly stored as a QuickTime Movie container, or .mov.

Apple documents the QuickTime Movie type as com.apple.quicktime-movie, commonly using the .mov or .qt extension. MP4, on the other hand, is an MPEG-4 movie type. UTType.mpeg4Movie uses the identifier public.mpeg-4.

Both are video containers, but they are not the same file type.

MOV
- QuickTime Movie container
- Common in Apple's media ecosystem
- Usually uses the .mov extension
- Can contain QuickTime-specific metadata and track structures

MP4
- MPEG-4 based container
- Common across web, servers, Android, browsers, and CDNs
- Usually uses the .mp4 extension
- Broadly compatible, but still has its own container rules

MOV and MP4 are structurally related. Some MOV files can be moved into MP4 without re-encoding.

But "similar" does not mean "always interchangeable."

Container and Codec Are Different Things

The easiest way to get confused here is to mix up container and codec.

A container is the file wrapper. MOV, MP4, and MKV are containers.

A codec is how the actual video or audio data is encoded. H.264, HEVC, ProRes, and AAC are codecs.

An iPhone video can look like any of these:

MOV + H.264 + AAC
MOV + HEVC(H.265) + AAC
MOV + HEVC 10-bit HDR + AAC
MOV + Dolby Vision HDR metadata
MOV + Apple ProRes
MOV + Cinematic mode metadata

So it is not enough to ask whether the file is MOV or MP4. You also need to care about the video codec, audio codec, HDR metadata, edit information, QuickTime metadata, and the actual track layout inside the asset.

Apple explains that High Efficiency media on iPhone and iPad uses HEVC, also known as H.265, for video. If the camera is set to Most Compatible, new videos use H.264 instead.

High Efficiency
- video: HEVC / H.265

Most Compatible
- video: H.264

That means "an iPhone video" is not one single format.

One video might be H.264 SDR. Another might be HEVC. Another might be HEVC 10-bit HDR or Dolby Vision. On Pro devices, it might even be ProRes.

Passthrough Is Not a Converter

The name AVAssetExportPresetPassthrough is accurate.

It tries to export the asset close to its current format. It is not a general-purpose "make this compatible with MP4" converter.

Passthrough tries to preserve the original tracks when possible.

passthrough
- Does not re-encode the video track
- Tries to preserve the audio track
- Fast
- Minimal or no quality loss
- Requires the original track structure to be compatible with the output container

That makes this combination stronger than it first appears:

exportPreset: AVAssetExportPresetPassthrough
outputFileType = .mp4

This is effectively asking AVFoundation:

Take the video, audio, and metadata from this original MOV asset, preserve them as much as possible, and write them into an MP4 file.

Some MOV files can satisfy that request.

Some cannot.

Cases That Can Cause Trouble

The following cases are not guaranteed to fail. They are just the kinds of assets that make passthrough + .mp4 a risky assumption.

HEVC / H.265

HEVC itself is not the problem. HEVC can exist inside MP4.

But real compatibility depends on more than the codec name. Profile, level, bit depth, codec tag, color information, OS version, and the export session's supported file types all matter.

Copying an original HEVC track into MP4 is not the same thing as re-encoding that video into an MP4-friendly output.

HDR / Dolby Vision

Supported iPhone models can record Dolby Vision HDR video.

HDR video carries more information than a normal SDR video: HEVC 10-bit data, HLG or Dolby Vision metadata, color space information, and related signaling.

Those details make sense in Apple's Photos and MOV ecosystem. But if you ask AVFoundation to preserve them and write an MP4 file through passthrough, the specific combination still has to be supported.

If it is not supported, export fails.

Apple ProRes

ProRes is a high-quality codec intended for editing workflows.

A ProRes source is very different from the small, widely compatible MP4 file an upload backend usually expects. Passthrough does not turn ProRes into H.264 or HEVC.

If the server needs a normal MP4 file, ProRes may need to be transcoded.

Cinematic Mode

Cinematic mode is not just a visual effect baked into a video.

It allows focus points and depth-of-field effects to be changed after capture. Apple also exposes QuickTime metadata related to Cinematic Video intent in AVFoundation.

That metadata is meaningful in Apple's MOV and Photos ecosystem. It does not mean the same information can always be preserved into an upload-oriented MP4 file through passthrough.

Slo-mo, Time-lapse, and Edited Videos

Slow-motion, time-lapse, and edited videos can be more complex than a single plain video track.

Time mapping, current versus original versions, audio mixes, and edit metadata can all be involved.

The video may play perfectly in Photos, but still fail for a specific export preset and output file type combination.

MOV Files Saved by Other Apps

Videos in the Photo Library are not always captured by Apple's Camera app.

They may be saved by other apps, downloaded from the web, or produced by editing tools. These files can have more varied codecs, audio formats, metadata, and track layouts.

Assuming every one of them can be passed through into MP4 is risky.

So It Was Not Just a Codec Problem

It is tempting to ask:

  • Is this failing because it is HEVC?
  • Is it failing because it is MOV?
  • Is iCloud failing to download the original?

The more accurate explanation is:

The original MOV asset contained a combination of tracks and metadata that could not be written into an MP4 container without re-encoding.

So the problem was not one codec by itself.

Possible contributors
- MOV container
- HEVC, HDR, ProRes, or codec profile
- QuickTime metadata
- Cinematic/depth/focus metadata
- Edit information
- Photos current asset representation
- MP4 outputFileType
- passthrough export preset

Actual failure
- This combination could not be written as MP4 through passthrough

That is why AVFoundationErrorDomain Code=-11838 was an important clue.

It did not mean "try again later." It was closer to "this operation is not supported for this asset."

Repeating the same request was not a real fix.

Remux vs Transcode

This issue becomes easier to reason about if you separate remuxing from transcoding.

remux
- Keeps the original video/audio data
- Changes only the container
- Can turn MOV into MP4 quickly
- No quality loss
- Works only if the original tracks are compatible with the target container

transcode
- Re-encodes video and/or audio
- Creates new streams suitable for the target container
- Slower and more CPU intensive
- May change quality or file size
- More compatible

AVAssetExportPresetPassthrough is closer to remuxing.

An export preset such as AVAssetExportPreset1920x1080 is closer to transcoding. It can create a new output that is more suitable for MP4 upload.

If your goal is to preserve the original media, passthrough is a good first attempt.

If your goal is to produce an uploadable MP4 file for a backend and other clients, passthrough alone is not enough.

The Fix

The fix was not to blindly retry the same export.

The fix was to use a fallback pipeline.

1. passthrough + mp4
   - Fastest path when it works.
   - Minimal quality loss.
   - Use it when the original tracks are compatible with MP4.

2. 1920x1080 + mp4
   - If passthrough is unsupported, switch to re-encoding.
   - Do not try to preserve the original MOV structure.
   - Produce a more upload-friendly MP4 file.

3. requestAVAsset + export
   - If the Photos requestExportSession path fails, request the AVAsset directly.
   - Build another export path from the requested asset.

The important part is that passthrough was not removed.

It is still the best first path when it works. The mistake was treating it as the only path.

What I Learned

The main lesson was simple:

"An iPhone video" is not one format.

Every selected video may look like PHAsset.mediaType == .video, but internally it can involve MOV, H.264, HEVC, HDR, ProRes, Cinematic metadata, edits, and iCloud state.

AVAssetExportPresetPassthrough does not normalize all of that into a standard MP4 file. It preserves the original when possible.

The right question for the upload pipeline was:

Are we trying to preserve the original, or are we trying to produce a reliably uploadable file?

In this case, the answer was both.

Try to preserve the original first. If that is not supported, fall back to a transcoding path.

That turned the issue from "retry a failed export" into "switch export strategies when the current strategy is not supported."

References