Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6053149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:00:27+00:00 2026-05-23T08:00:27+00:00

I was able to create a *.mov file using the AVAssetWriter. I used screenshot

  • 0

I was able to create a *.mov file using the AVAssetWriter. I used screenshot images and audio CMSampleBuffer i got from using AVCaptureSession and passed it to the inputs for the AVAssetWriter and it worked.

Now I would like to merge the *.mov file with a music from the ipod/iphone music library (most likely *.mp3). So my initial idea is to use AVAssetReader to get samples from the *.mp3 and *.mov file and pass the samples to an AVAssetWriter. Will this work? Just by reading the documentation i think that its possible.

I played with the idea for a bit but i cant make it to work.

My first attempt is to use 2 AVAssetReaders, one for each file. I used AVAssetReaderAudioMixOutput as an output for the 1st reader and then an AVAssetReaderVideoCompositionOutput for the 2nd one. The problem is using the AVAssetReaderVideoCompositionOutput requires that you pass it an AVVideoComposition. I had problems creating AVVideoComposition/AVMutableVideoComposition so I gave up on this solution. I dont get why I need to pass an AVVideoComposition, I just want to get samples of the movie.

So my 2nd attempt is similar but instead of using AVAssetReaderVideoCompositionOutput as an output for the 2nd reader, I used 2 AVAssetReaderTrackOutput instead. So now I have 2 readers with total of 3 outputs, and I tried using the sample from the outputs and pass it to an AVAssetWriter to create a *.mov file. I was able to run it, without errors/crashes. But I cant play the resulting *.mov file. Its play duration is 0.So again, no luck with the AVAssetReader+AVAssetWriter idea.

So my question/s: Can you use AVAssetReader and AVAssetWriter to merge two files? Has anybody tried doing this and make it to work? Should I just use AVMutableVideoComposition instead?

I will post my code if necessary.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:00:28+00:00Added an answer on May 23, 2026 at 8:00 am

    You could use AVAssetReader and AVAssetWriter to merge the two files, but that’s probably further along the control/power curve than you need.

    An AVAssetExportSession is probably a better fit as you can merge audio and video tracks in a few lines of code:

    1. create an AVComposition containing the mp3 and the mov as AVCompositionTracks
    2. export the AVComposition with AVAssetExportSession.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am able to create a UIImage from a Core Animation layer using the
I need to be able to create a WAV file using the mic in
I have been able to create a csv with python using the input from
I am able to create and execute a DTS package that copies tables from
I am able to create a connection to a local sqlite3 database ( Using
I am able to create alternate dictation grammars using the dictation resource kit or
I want to be able create stored procedures using phpMyAdmin and later on use
We have been able to create a web site. We did this using the
We are not able to create the installer after migrating the code from VS2005
i am able to create an iframe using appendChild, without jquery, is it possible

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.