Giter Club home page Giter Club logo

Comments (2)

sindresorhus avatar sindresorhus commented on July 19, 2024

Apple reply:


Is the AVAsset a QuickTime movie file (.mov) or an MPEG file (e.g., .mp4)? These correspond to the UTI types AVFileTypeQuickTimeMovie and AVFileTypeMPEG4.

If so, have you tried:

  • open the source file using AVMutableMovie

  • update the metadata using its metadata property and replace with the new or updated AVMetadataItem(s)

  • rewrite the movie header back to the file using the AVMovie method defined in AVMovie.h:

    • (BOOL)writeMovieHeaderToURL:(NSURL *)URL fileType:(AVFileType)fileType options:(AVMovieWritingOptions)options error:(NSError * _Nullable * _Nullable)outError;

Use the AVMovieWritingAddMovieHeaderToDestination AVMovieWritingOptions value to rewrite the header to the movie file while leaving existing media data in place. You may want to do this in a copy of the source media file.

There’s a WWDC 2015 session video “Editing Movies in AVFoundation” that introduces the API at https://developer.apple.com/wwdc15/506.

If the AVAsset is for other kinds of files than movie files, please let us know the kinds of assets that are important to you for such support.

from reports.

sindresorhus avatar sindresorhus commented on July 19, 2024

My reply:


Thanks for sharing. That is very useful. My use-case is editing the metadata of audio (M4A) files. I’ll try to see if it works with audio-only files too.

I do think it would be useful to have an easy to use API on AVAsset for this (and for video). For example, await AVAsset.setMetadata([AVMetadataItem], for url: URL).

from reports.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.